From c1379001e5e6a5da67509a51e5210d3b9b1d2bee Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 15 Aug 2021 12:31:26 -0400 Subject: [PATCH] Expect `Order` msg instance to ems client `.send()` --- piker/clearing/_client.py | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/piker/clearing/_client.py b/piker/clearing/_client.py index 89630722..a23fdb5e 100644 --- a/piker/clearing/_client.py +++ b/piker/clearing/_client.py @@ -58,35 +58,20 @@ class OrderBook: _ready_to_receive: trio.Event = trio.Event() def send( - self, - uuid: str, - symbol: str, - brokers: list[str], - price: float, - size: float, - action: str, - exec_mode: str, + msg: Order, ) -> dict: - msg = Order( - action=action, - price=price, - size=size, - symbol=symbol, - brokers=brokers, - oid=uuid, - exec_mode=exec_mode, # dark or live - ) - - self._sent_orders[uuid] = msg + self._sent_orders[msg.oid] = msg self._to_ems.send_nowait(msg.dict()) return msg def update( self, + uuid: str, **data: dict, + ) -> dict: cmd = self._sent_orders[uuid] msg = cmd.dict()