From 374967dc6fc7271b435948098c657d5d9c6691aa Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 15 Aug 2021 12:30:22 -0400 Subject: [PATCH] Support temp `Symbol` and non-copied model refs on `Order` msg --- piker/clearing/_messages.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/piker/clearing/_messages.py b/piker/clearing/_messages.py index 7db06c57..126326ab 100644 --- a/piker/clearing/_messages.py +++ b/piker/clearing/_messages.py @@ -24,6 +24,8 @@ from typing import Optional, Union # import msgspec from pydantic import BaseModel +from ..data._source import Symbol + # Client -> emsd @@ -42,7 +44,7 @@ class Order(BaseModel): action: str # {'buy', 'sell', 'alert'} # internal ``emdsd`` unique "order id" oid: str # uuid4 - symbol: str + symbol: Union[str, Symbol] price: float size: float @@ -56,6 +58,13 @@ class Order(BaseModel): # the backend broker exec_mode: str # {'dark', 'live', 'paper'} + class Config: + # just for pre-loading a ``Symbol`` when used + # in the order mode staging process + arbitrary_types_allowed = True + # don't copy this model instance when used in + # a recursive model + copy_on_model_validation = False # Client <- emsd # update msgs from ems which relay state change info