mcpj
mcpj

Reputation: 95

AssetPairs query with multiple pairs

When calling the query_public 'AssetPairs' from Krakenex with multiple pairs of assets, I have no errors but only the last pair of the query is available.

I tried the following:

import krakenex
tst = k.query_public('AssetPairs', {'pair':['ADAXBT','ADAEUR']})

and this gives me the following result:

{'error': [], 'result': {'ADAEUR': {'altname': 'ADAEUR', 'wsname': 'ADA/EUR', 'aclass_base': 'currency', 'base': 'ADA', 'aclass_quote': 'currency', 'quote': 'ZEUR', 'lot': 'unit', 'pair_decimals': 6, 'lot_decimals': 8, 'lot_multiplier': 1, 'leverage_buy': [], 'leverage_sell': [], 'fees': [[0, 0.26], [50000, 0.24], [100000, 0.22], [250000, 0.2], [500000, 0.18], [1000000, 0.16], [2500000, 0.14], [5000000, 0.12], [10000000, 0.1]], 'fees_maker': [[0, 0.16], [50000, 0.14], [100000, 0.12], [250000, 0.1], [500000, 0.08], [1000000, 0.06], [2500000, 0.04], [5000000, 0.02], [10000000, 0]], 'fee_volume_currency': 'ZUSD', 'margin_call': 80, 'margin_stop': 40}}}

but the ADAXBT pair is missing from the tst dictionary.

I would have expected to get both pairs, as the doc from Kraken https://www.kraken.com/features/api#get-tradable-pairs mentions that we can call multiple pairs within a list.

Any workaround on how to call info on multiple pairs at the same time (without killing my API call count)?

Upvotes: 1

Views: 238

Answers (1)

Tim Stack
Tim Stack

Reputation: 3248

The Kraken API documentation states:

pair = comma delimited list of asset pairs to get info on (optional. default = all)

Here, "list" refers to a string list, not a Python list object.

>>> import krakenex
>>> api = krakenex.API()
>>> tst = api.query_public('AssetPairs', {'pair': 'ADAXBT, ADAEUR'})
>>> print(tst['result'].keys())

dict_keys(['ADAEUR', 'ADAXBT'])

Upvotes: 2

Related Questions