From 4c96a4878e45192ba1c4cd50be72890b48b6aa0c Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 6 Oct 2022 08:38:19 -0400 Subject: [PATCH] Process unknown order mode msgs --- piker/clearing/_ems.py | 5 +++++ piker/ui/order_mode.py | 14 ++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/piker/clearing/_ems.py b/piker/clearing/_ems.py index 17b63730..99b268be 100644 --- a/piker/clearing/_ems.py +++ b/piker/clearing/_ems.py @@ -842,6 +842,11 @@ async def translate_and_relay_brokerd_events( status_msg.reqid = reqid status_msg.brokerd_msg = msg + # TODO: if no client is connected (aka we're + # headless) we should record the fill in the + # ``.msg_flow`` chain and re-transmit on client + # connect so that fills can be displayed in a + # chart? await router.client_broadcast( status_msg.req.symbol, status_msg, diff --git a/piker/ui/order_mode.py b/piker/ui/order_mode.py index b049aa7c..3cda56ff 100644 --- a/piker/ui/order_mode.py +++ b/piker/ui/order_mode.py @@ -433,7 +433,7 @@ class OrderMode: size = dialog.order.size # NOTE: sends modified order msg to EMS - self.book.update( + self.book.send_update( uuid=line.dialog.uuid, price=level, size=size, @@ -1047,12 +1047,12 @@ async def process_trade_msg( case Status(resp='fill'): # handle out-of-piker fills reporting? - known_order = book._sent_orders.get(oid) - if not known_order: + order: Order = book._sent_orders.get(oid) + if not order: log.warning(f'order {oid} is unknown') - return + order = msg.req - action = known_order.action + action = order.action details = msg.brokerd_msg # TODO: some kinda progress system @@ -1077,7 +1077,9 @@ async def process_trade_msg( ), ) - # TODO: how should we look this up? + # TODO: append these fill events to the position's clear + # table? + # tracker = mode.trackers[msg['account']] # tracker.live_pp.fills.append(msg)