Yohan Obadia
Yohan Obadia

Reputation: 2672

Krakenex API multiple pairs query

I am trying to use the Krakenex python library to query the order book for multiple currency pairs at once. When I do it for a single currency is works, like this:

con = krakenex.API()
con.load_key('kraken.key')
con.query_public('Depth', {'pair':'GNOETH'})

However, if I do:

con = krakenex.API()
con.load_key('kraken.key')
con.query_public('Depth', {'pair':['GNOETH', 'GNOEUR']})

I get {'error': ['EQuery:Unknown asset pair']}. I assume that the syntax is incorrect but can't figure out the correct one. This is the first time that I use an API and the example provided are not covering enough info yet.

Upvotes: 4

Views: 1431

Answers (2)

Michael Cariello
Michael Cariello

Reputation: 11

Spent a lot of time trying different combos, finally figured it out.

try con.query_public('Depth', {'pair':'GNOETH, GNOEUR'})

Upvotes: 0

meztelentsiga
meztelentsiga

Reputation: 171

Unfortunately you can not query the Depth of multiple asset pairs with a single request. I had the same question to Kraken's support: their reason not allowing it, is high computational cost.

On contrary, querying e.g. AssetPairs endpoint in the same manner works.

Upvotes: 3

Related Questions