ib: Solve lingering bugs for non-vlm contracts

Contract matching in live setup was borked; switch to
`MktPair.dst.atype` matching, don't override the `cmdty` "venue" (a
weird special case) in `get_mkt_info()` otherwise lookup will fail..
master
Tyler Goodlet 2023-05-24 09:11:24 -04:00
parent e8787d89c6
commit 9a063ccb11
1 changed files with 11 additions and 7 deletions

View File

@ -803,7 +803,11 @@ async def get_mkt_info(
init_info: dict = {} init_info: dict = {}
atype = _asset_type_map[con.secType] atype = _asset_type_map[con.secType]
if atype == 'commodity':
venue: str = 'cmdty'
else:
venue = con.primaryExchange or con.exchange venue = con.primaryExchange or con.exchange
price_tick: Decimal = Decimal(str(details.minTick)) price_tick: Decimal = Decimal(str(details.minTick))
if atype == 'stock': if atype == 'stock':
@ -918,12 +922,12 @@ async def stream_quotes(
# it might be outside regular trading hours so see if we can at # it might be outside regular trading hours so see if we can at
# least grab history. # least grab history.
if ( if (
isnan(first_ticker.last) isnan(first_ticker.last) # last quote price value is nan
and type(first_ticker.contract) not in ( and mkt.dst.atype not in {
ibis.Commodity, 'commodity',
ibis.Forex, 'forex',
ibis.Crypto, 'crypto',
) }
): ):
task_status.started((init_msgs, first_quote)) task_status.started((init_msgs, first_quote))