Merge pull request #432 from pikers/kraken_limits_fields

Kraken limits fields
dark_clearing_improvements
goodboy 2022-12-10 16:12:54 -05:00 committed by GitHub
commit cc1694760c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -88,6 +88,9 @@ class Pair(Struct):
tick_size: float # min price step size
status: str
short_position_limit: float
long_position_limit: float
class OHLC(Struct):
'''
@ -352,7 +355,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