diff --git a/piker/brokers/ib/feed.py b/piker/brokers/ib/feed.py index ead4b8e4..e06ae29c 100644 --- a/piker/brokers/ib/feed.py +++ b/piker/brokers/ib/feed.py @@ -619,7 +619,7 @@ async def _setup_quote_stream( async def open_aio_quote_stream( symbol: str, - contract: Optional[Contract] = None, + contract: Contract | None = None, ) -> trio.abc.ReceiveStream: @@ -741,9 +741,9 @@ async def stream_quotes( try: ( - con, - first_ticker, - details, + con, # Contract + first_ticker, # Ticker + details, # ContractDetails ) = await proxy.get_sym_details(symbol=sym) except ConnectionError: log.exception(f'Proxy is ded {proxy._aio_ns}') @@ -759,6 +759,7 @@ async def stream_quotes( ''' # pass back some symbol info like min_tick, trading_hours, etc. + con: Contract = details.contract syminfo = asdict(details) syminfo.update(syminfo['contract']) @@ -785,6 +786,11 @@ async def stream_quotes( price_tick: Decimal = Decimal(str(syminfo['minTick'])) size_tick: Decimal = Decimal(str(syminfo['minSize']).rstrip('0')) + # XXX: GRRRR they don't support fractional share sizes for + # stocks from the API?! + if con.secType == 'STK': + size_tick = Decimal('1') + syminfo['price_tick_size'] = price_tick # NOTE: as you'd expect for "legacy" assets, the "volume # precision" is normally discreet.