From f81d47efc42882df300b9ea09b1be7b8c2e269ae Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 11 Sep 2021 13:10:20 -0400 Subject: [PATCH] Detail some comments --- piker/clearing/_allocate.py | 10 +++++++++- piker/ui/_position.py | 7 +++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/piker/clearing/_allocate.py b/piker/clearing/_allocate.py index 999f9ff9..94c7af12 100644 --- a/piker/clearing/_allocate.py +++ b/piker/clearing/_allocate.py @@ -134,6 +134,10 @@ class Allocator(BaseModel): def next_order_info( self, + # we only need a startup size for exit calcs, we can the + # determine how large slots should be if the initial pp size was + # larger then the current live one, and the live one is smaller + # then the initial config settings. startup_pp: Position, live_pp: Position, price: float, @@ -191,9 +195,13 @@ class Allocator(BaseModel): else: slot_size = u_per_slot + # TODO: ensure that the limit can never be set **lower** + # then the current pp size? It should be configured + # correctly at startup right? + # if our position is greater then our limit setting # we'll want to use slot sizes which are larger then what - # the limit would normally determine + # the limit would normally determine. order_size = max(slotted_pp, slot_size) if ( diff --git a/piker/ui/_position.py b/piker/ui/_position.py index db250625..225663bc 100644 --- a/piker/ui/_position.py +++ b/piker/ui/_position.py @@ -75,10 +75,10 @@ class SettingsPane: log.info(f'selection input: {value}') mode = self.order_mode + # an account switch request if key == 'account': - # an account switch request - # hide detail on the old pp + # hide details on the old selection old_tracker = mode.current_pp old_tracker.hide_info() @@ -86,6 +86,9 @@ class SettingsPane: account_name = value tracker = mode.trackers.get(account_name) + # if selection can't be found (likely never discovered with + # a ``brokerd`) then error and switch back to the last + # selection. if tracker is None: sym = old_tracker.chart.linked.symbol.key log.error(