From ce7eb75ada06ad6cde55534a60528eff42cc1a11 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 10 Aug 2021 16:59:44 -0400 Subject: [PATCH] Validate allocator assignments with pydantic --- piker/ui/_position.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/piker/ui/_position.py b/piker/ui/_position.py index 6c1325ce..e8b030df 100644 --- a/piker/ui/_position.py +++ b/piker/ui/_position.py @@ -45,8 +45,7 @@ from ._style import _font class Position(BaseModel): - '''Basic pp (personal position) data representation with attached - fills history. + '''Basic pp (personal position) model with attached fills history. This type should be IPC wire ready? @@ -91,6 +90,9 @@ def mk_pp_alloc( class Allocator(BaseModel): + class Config: + validate_assignment = True + account: Account = None _accounts: dict[str, Optional[str]] = accounts @@ -154,11 +156,9 @@ class PositionTracker: avg_price=0, ) - self.pp_label = None - view = chart.getViewBox() - # literally 'pp' label that's always in view + # literally the 'pp' (pee pee) label that's always in view self.pp_label = pp_label = Label( view=view, fmt_str='pp',