Port ib to new provide new tick size fields in symbol info

basic_orders
Tyler Goodlet 2021-02-06 14:37:24 -05:00
parent 69df73afc3
commit 0c184b1b41
1 changed files with 11 additions and 6 deletions

View File

@ -386,7 +386,7 @@ class Client:
self, self,
symbol: str, symbol: str,
to_trio, to_trio,
opts: Tuple[int] = ('375', '233',), opts: Tuple[int] = ('375', '233', '236'),
contract: Optional[Contract] = None, contract: Optional[Contract] = None,
) -> None: ) -> None:
"""Stream a ticker using the std L1 api. """Stream a ticker using the std L1 api.
@ -818,8 +818,8 @@ async def fill_bars(
sym: str, sym: str,
first_bars: list, first_bars: list,
shm: 'ShmArray', # type: ignore # noqa shm: 'ShmArray', # type: ignore # noqa
# count: int = 20, # NOTE: any more and we'll overrun underlying buffer count: int = 20, # NOTE: any more and we'll overrun underlying buffer
count: int = 6, # NOTE: any more and we'll overrun the underlying buffer # count: int = 6, # NOTE: any more and we'll overrun the underlying buffer
) -> None: ) -> None:
"""Fill historical bars into shared mem / storage afap. """Fill historical bars into shared mem / storage afap.
@ -952,8 +952,13 @@ async def stream_quotes(
# pass back some symbol info like min_tick, trading_hours, etc. # pass back some symbol info like min_tick, trading_hours, etc.
# con = asdict(contract) # con = asdict(contract)
# syminfo = contract # syminfo = contract
symdeats = asdict(details) syminfo = asdict(details)
symdeats.update(symdeats['contract']) syminfo.update(syminfo['contract'])
# TODO: more consistent field translation
syminfo['price_tick_size'] = syminfo['minTick']
# for "traditional" assets, volume is discreet not a float
syminfo['lot_tick_size'] = 0
# TODO: for loop through all symbols passed in # TODO: for loop through all symbols passed in
init_msgs = { init_msgs = {
@ -962,7 +967,7 @@ async def stream_quotes(
sym: { sym: {
'is_shm_writer': not writer_already_exists, 'is_shm_writer': not writer_already_exists,
'shm_token': shm_token, 'shm_token': shm_token,
'symbol_info': symdeats, 'symbol_info': syminfo,
} }
} }
await ctx.send_yield(init_msgs) await ctx.send_yield(init_msgs)