`kraken`: Explicitly report missing `Pair` fields in error

kraken_limits_fields
Tyler Goodlet 2022-12-10 15:21:20 -05:00
parent de93da202b
commit 0de2f863bd
1 changed files with 7 additions and 1 deletions

View File

@ -352,7 +352,13 @@ async def stream_quotes(
# transform to upper since piker style is always lower
sym = sym.upper()
sym_info = await client.symbol_info(sym)
si = Pair(**sym_info) # validation
try:
si = Pair(**sym_info) # validation
except TypeError:
fields_diff = set(sym_info) - set(Pair.__struct_fields__)
raise TypeError(
f'Missing msg fields {fields_diff}'
)
syminfo = si.to_dict()
syminfo['price_tick_size'] = 1 / 10**si.pair_decimals
syminfo['lot_tick_size'] = 1 / 10**si.lot_decimals