Ugh, positions relay hotfix
Must have run into some confusion with data structures in `brokerd` vs. `emsd`. This fixes the ems `relay.positions` state tracking to be composed maps, vs. messages from `brokerd` should just be a sequence.fsp_feeds
parent
cecba8904d
commit
6acfd6c38a
|
@ -1465,7 +1465,7 @@ async def trades_dialogue(
|
|||
global _client_cache
|
||||
|
||||
# deliver positions to subscriber before anything else
|
||||
all_positions = {}
|
||||
all_positions = []
|
||||
|
||||
clients: list[tuple[Client, trio.MemoryReceiveChannel]] = []
|
||||
for account, client in _accounts2clients.items():
|
||||
|
@ -1480,9 +1480,7 @@ async def trades_dialogue(
|
|||
for client in _client_cache.values():
|
||||
for pos in client.positions():
|
||||
msg = pack_position(pos)
|
||||
all_positions.setdefault(
|
||||
msg.symbol, []
|
||||
).append(msg.dict())
|
||||
all_positions.append(msg.dict())
|
||||
|
||||
await ctx.started(all_positions)
|
||||
|
||||
|
|
|
@ -429,10 +429,13 @@ async def open_brokerd_trades_dialogue(
|
|||
# by receiving order submission response messages,
|
||||
# normalizing them to EMS messages and relaying back to
|
||||
# the piker order client set.
|
||||
pps = {}
|
||||
for msg in positions:
|
||||
pps.setdefault(msg['symbol'], {})['account'] = msg
|
||||
|
||||
relay = TradesRelay(
|
||||
brokerd_dialogue=brokerd_trades_stream,
|
||||
positions=positions,
|
||||
positions=pps,
|
||||
consumers=1
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue