Krakenex API multiple pairs query

亡梦爱人 提交于 2021-02-07 20:01:21

问题


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.


回答1:


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.




回答2:


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

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



来源:https://stackoverflow.com/questions/44488326/krakenex-api-multiple-pairs-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!