Validate allocator assignments with pydantic
parent
a7920689b6
commit
ce7eb75ada
piker/ui
|
@ -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',
|
||||||
|
|
Loading…
Reference in New Issue