From 504040eb59338edde5d678aa3b2580de3b0e5312 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 8 Sep 2021 14:03:18 -0400 Subject: [PATCH] Add an `account` field to EMS msging schemas --- piker/clearing/_messages.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/piker/clearing/_messages.py b/piker/clearing/_messages.py index 126326ab..e7fadccd 100644 --- a/piker/clearing/_messages.py +++ b/piker/clearing/_messages.py @@ -45,6 +45,7 @@ class Order(BaseModel): # internal ``emdsd`` unique "order id" oid: str # uuid4 symbol: Union[str, Symbol] + account: str # should we set a default as '' ? price: float size: float @@ -86,6 +87,7 @@ class Status(BaseModel): # 'broker_cancelled', # 'broker_executed', # 'broker_filled', + # 'broker_errored', # 'alert_submitted', # 'alert_triggered', @@ -118,6 +120,7 @@ class BrokerdCancel(BaseModel): oid: str # piker emsd order id time_ns: int + account: str # "broker request id": broker specific/internal order id if this is # None, creates a new order otherwise if the id is valid the backend # api must modify the existing matching order. If the broker allows @@ -131,6 +134,7 @@ class BrokerdOrder(BaseModel): action: str # {buy, sell} oid: str + account: str time_ns: int # "broker request id": broker specific/internal order id if this is @@ -162,6 +166,7 @@ class BrokerdOrderAck(BaseModel): # emsd id originally sent in matching request msg oid: str + account: str = '' class BrokerdStatus(BaseModel): @@ -170,6 +175,9 @@ class BrokerdStatus(BaseModel): reqid: Union[int, str] time_ns: int + # XXX: should be best effort set for every update + account: str = '' + # { # 'submitted', # 'cancelled', @@ -224,7 +232,11 @@ class BrokerdError(BaseModel): This is still a TODO thing since we're not sure how to employ it yet. ''' name: str = 'error' - reqid: Union[int, str] + oid: str + + # if no brokerd order request was actually submitted (eg. we errored + # at the ``pikerd`` layer) then there will be ``reqid`` allocated. + reqid: Union[int, str] = '' symbol: str reason: str