Add an `account` field to EMS msging schemas

fsp_feeds
Tyler Goodlet 2021-09-08 14:03:18 -04:00
parent 0d2cddec9a
commit 504040eb59
1 changed files with 13 additions and 1 deletions

View File

@ -45,6 +45,7 @@ class Order(BaseModel):
# internal ``emdsd`` unique "order id" # internal ``emdsd`` unique "order id"
oid: str # uuid4 oid: str # uuid4
symbol: Union[str, Symbol] symbol: Union[str, Symbol]
account: str # should we set a default as '' ?
price: float price: float
size: float size: float
@ -86,6 +87,7 @@ class Status(BaseModel):
# 'broker_cancelled', # 'broker_cancelled',
# 'broker_executed', # 'broker_executed',
# 'broker_filled', # 'broker_filled',
# 'broker_errored',
# 'alert_submitted', # 'alert_submitted',
# 'alert_triggered', # 'alert_triggered',
@ -118,6 +120,7 @@ class BrokerdCancel(BaseModel):
oid: str # piker emsd order id oid: str # piker emsd order id
time_ns: int time_ns: int
account: str
# "broker request id": broker specific/internal order id if this is # "broker request id": broker specific/internal order id if this is
# None, creates a new order otherwise if the id is valid the backend # None, creates a new order otherwise if the id is valid the backend
# api must modify the existing matching order. If the broker allows # api must modify the existing matching order. If the broker allows
@ -131,6 +134,7 @@ class BrokerdOrder(BaseModel):
action: str # {buy, sell} action: str # {buy, sell}
oid: str oid: str
account: str
time_ns: int time_ns: int
# "broker request id": broker specific/internal order id if this is # "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 # emsd id originally sent in matching request msg
oid: str oid: str
account: str = ''
class BrokerdStatus(BaseModel): class BrokerdStatus(BaseModel):
@ -170,6 +175,9 @@ class BrokerdStatus(BaseModel):
reqid: Union[int, str] reqid: Union[int, str]
time_ns: int time_ns: int
# XXX: should be best effort set for every update
account: str = ''
# { # {
# 'submitted', # 'submitted',
# 'cancelled', # 'cancelled',
@ -224,7 +232,11 @@ class BrokerdError(BaseModel):
This is still a TODO thing since we're not sure how to employ it yet. This is still a TODO thing since we're not sure how to employ it yet.
''' '''
name: str = 'error' 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 symbol: str
reason: str reason: str