From b9ee0997a7d22de5eb574192c60bfccd372612c3 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 6 Sep 2021 12:42:25 -0400 Subject: [PATCH] Only do tracker update if pp msg is received for sym --- piker/ui/order_mode.py | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/piker/ui/order_mode.py b/piker/ui/order_mode.py index 00f67540..85555bad 100644 --- a/piker/ui/order_mode.py +++ b/piker/ui/order_mode.py @@ -574,31 +574,32 @@ async def open_order_mode( # so that view handlers can access it view.order_mode = mode + our_sym = mode.chart.linked._symbol.key + + # update any exising position + pp_msg = None + for sym, msg in positions.items(): + if sym.lower() in our_sym: + pp_msg = msg + break + # make fill bar and positioning snapshot # XXX: this need to be called *before* the first # pp tracker update(s) below to ensure the limit size unit has # been correctly set prior to updating the line's pp size label - # (the one on the RHS) + # (the one on the RHS). + # TODO: should probably split out the alloc config from the UI + # config startup steps.. order_pane.init_status_ui() - # update any exising position - for sym, msg in positions.items(): + # we should probably make the allocator config + # and explitict helper func call that takes in the aloc and + # the postion / symbol info then take that alloc ref and + # update the pp_tracker and pp_pane? + if pp_msg: + pp_tracker.update_from_pp_msg(msg) - our_sym = mode.chart.linked._symbol.key - if sym.lower() in our_sym: - - - # call this again now since we've configured - # the allocator from the asset type...super dumb. - # we should probably make the allocator config - # and explitict helper func call that takes in the aloc and - # the postion / symbol info then take that alloc ref and - # update the pp_tracker and pp_pane. - # pp_tracker.update(msg, position=pp_tracker.startup_pp) - - pp_tracker.update_from_pp_msg(msg, position=pp_tracker.startup_pp) - pp_tracker.update_from_pp_msg(msg) - break + order_pane.update_status_ui() live_pp = mode.pp.live_pp size = live_pp.size