Typecast config, add type hint to pair in init message creation and turn init msg vals into floats

small_kucoin_fixes
jaredgoldman 2023-04-13 21:57:54 -04:00
parent 92f372dcc8
commit 63e34cf595
1 changed files with 4 additions and 4 deletions

View File

@ -176,7 +176,7 @@ def get_config() -> BrokerConfig | None:
log.warning('No config section found for kucoin in config') log.warning('No config section found for kucoin in config')
return None return None
return BrokerConfig(**section) return BrokerConfig(**section).typecast()
class Client: class Client:
@ -448,7 +448,7 @@ async def stream_quotes(
for sym in symbols: for sym in symbols:
token, ping_interval = await client._get_ws_token() token, ping_interval = await client._get_ws_token()
pairs = await client.cache_pairs() pairs = await client.cache_pairs()
pair = pairs[sym]: KucoinMktPair pair: KucoinMktPair = pairs[sym]
kucoin_sym = pair.symbol kucoin_sym = pair.symbol
init_msgs = { init_msgs = {
@ -457,8 +457,8 @@ async def stream_quotes(
sym: { sym: {
'symbol_info': { 'symbol_info': {
'asset_type': 'crypto', 'asset_type': 'crypto',
'price_tick_size': pair.baseIncrement, 'price_tick_size': float(pair.baseIncrement),
'lot_tick_size': pair.baseMinSize, 'lot_tick_size': float(pair.baseMinSize),
}, },
'shm_write_opts': {'sum_tick_vml': False}, 'shm_write_opts': {'sum_tick_vml': False},
'fqsn': sym, 'fqsn': sym,