From eb70baf161cebbdab59de8e124a9df03fabfd1da Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 13 Sep 2021 08:21:09 -0400 Subject: [PATCH] Pass account names on wire: brokerd => emsd --- piker/brokers/ib.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/piker/brokers/ib.py b/piker/brokers/ib.py index a9d04156..21946802 100644 --- a/piker/brokers/ib.py +++ b/piker/brokers/ib.py @@ -1333,7 +1333,10 @@ async def stream_quotes( # last = time.time() -def pack_position(pos: Position) -> dict[str, Any]: +def pack_position( + pos: Position + +) -> dict[str, Any]: con = pos.contract if isinstance(con, Option): @@ -1480,6 +1483,7 @@ async def trades_dialogue( for client in _client_cache.values(): for pos in client.positions(): msg = pack_position(pos) + msg.account = accounts_def.inverse[msg.account] all_positions.append(msg.dict()) await ctx.started(all_positions) @@ -1636,6 +1640,7 @@ async def deliver_trade_events( elif event_name == 'position': msg = pack_position(item) + msg.account = accounts_def.inverse[msg.account] if getattr(msg, 'reqid', 0) < -1: