Validate allocator assignments with pydantic

ordermodepps_backup
Tyler Goodlet 2021-08-10 16:59:44 -04:00
parent ebfb700cd2
commit 7a8e612228
1 changed files with 5 additions and 5 deletions

View File

@ -45,8 +45,7 @@ from ._style import _font
class Position(BaseModel): class Position(BaseModel):
'''Basic pp (personal position) data representation with attached '''Basic pp (personal position) model with attached fills history.
fills history.
This type should be IPC wire ready? This type should be IPC wire ready?
@ -91,6 +90,9 @@ def mk_pp_alloc(
class Allocator(BaseModel): class Allocator(BaseModel):
class Config:
validate_assignment = True
account: Account = None account: Account = None
_accounts: dict[str, Optional[str]] = accounts _accounts: dict[str, Optional[str]] = accounts
@ -154,11 +156,9 @@ class PositionTracker:
avg_price=0, avg_price=0,
) )
self.pp_label = None
view = chart.getViewBox() 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( self.pp_label = pp_label = Label(
view=view, view=view,
fmt_str='pp', fmt_str='pp',