From 077d9bf1d296b8bfca46a377fb5a0d2f44bb85a9 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 10 Aug 2023 12:41:53 -0400 Subject: [PATCH] Better commenting around order-mode error block --- piker/ui/order_mode.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/piker/ui/order_mode.py b/piker/ui/order_mode.py index 14d8b821..a64bb718 100644 --- a/piker/ui/order_mode.py +++ b/piker/ui/order_mode.py @@ -1088,9 +1088,16 @@ async def process_trade_msg( mode.on_submit(oid) case Status(resp='error'): - # delete level line from view + + # do all the things for a cancel: + # - drop order-msg dialog from client table + # - delete level line from view mode.on_cancel(oid) - broker_msg = msg.brokerd_msg + + # TODO: parse into broker-side msg, or should we + # expect it to just be **that** msg verbatim (since + # we'd presumably have only 1 `Error` msg-struct) + broker_msg: dict = msg.brokerd_msg log.error( f'Order {oid}->{resp} with:\n{pformat(broker_msg)}' ) @@ -1111,8 +1118,12 @@ async def process_trade_msg( case Status( resp='triggered', - # req=Order(exec_mode='live', action='alert') as req, # TODO - req={'exec_mode': 'live', 'action': 'alert'} as req, + # TODO: do the struct-msg version, blah blah.. + # req=Order(exec_mode='live', action='alert') as req, + req={ + 'exec_mode': 'live', + 'action': 'alert', + } as req, ): # should only be one "fill" for an alert # add a triangle and remove the level line