From 6c10c2f6234d5dd0d447181435bf05a788cbaf9e Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 20 Jun 2023 14:40:57 -0400 Subject: [PATCH] order_mode: add comment around `Order` being a dict bug --- piker/ui/order_mode.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/piker/ui/order_mode.py b/piker/ui/order_mode.py index 3e07eb5e..0b3a1897 100644 --- a/piker/ui/order_mode.py +++ b/piker/ui/order_mode.py @@ -1143,13 +1143,17 @@ async def process_trade_msg( case Status(resp='fill'): # handle out-of-piker fills reporting? - order: Order = client._sent_orders.get(oid) - if not order: + order: Order | None + if not (order := client._sent_orders.get(oid)): + + # set it from last known request msg log.warning(f'order {oid} is unknown') order = msg.req - action = order.action - details = msg.brokerd_msg + # XXX TODO: have seen order be a dict here!? + # that should never happen tho? + action: str = order.action + details: dict = msg.brokerd_msg # TODO: state tracking: # - put the actual exchange timestamp?