Try explicit matches of symbol to our adhoc set for pp msgs

fsp_feeds
Tyler Goodlet 2021-09-07 09:22:56 -04:00
parent 7b86b6ae20
commit 2bc07ae05b
1 changed files with 14 additions and 7 deletions

View File

@ -1277,8 +1277,6 @@ async def stream_quotes(
calc_price=calc_price
)
# con = quote['contract']
# topic = '.'.join((con['symbol'], suffix)).lower()
quote['symbol'] = topic
await send_chan.send({topic: quote})
@ -1295,12 +1293,21 @@ def pack_position(pos: Position) -> dict[str, Any]:
symbol = con.localSymbol.replace(' ', '')
else:
symbol = con.symbol
symbol = con.symbol.lower()
exch = (con.primaryExchange or con.exchange).lower()
symkey = '.'.join((symbol, exch))
if not exch:
# attempt to lookup the symbol from our
# hacked set..
for sym in _adhoc_futes_set:
if symbol in sym:
symkey = sym
break
# TODO: options contracts into a sane format..
symkey = '.'.join([
symbol.lower(),
(con.primaryExchange or con.exchange).lower(),
])
return BrokerdPosition(
broker='ib',
account=pos.account,