Expect `Order` msg instance to ems client `.send()`

fsp_feeds
Tyler Goodlet 2021-08-15 12:31:26 -04:00
parent 374967dc6f
commit c1379001e5
1 changed files with 4 additions and 19 deletions

View File

@ -58,35 +58,20 @@ class OrderBook:
_ready_to_receive: trio.Event = trio.Event() _ready_to_receive: trio.Event = trio.Event()
def send( def send(
self, self,
uuid: str, msg: Order,
symbol: str,
brokers: list[str],
price: float,
size: float,
action: str,
exec_mode: str,
) -> dict: ) -> dict:
msg = Order( self._sent_orders[msg.oid] = msg
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._to_ems.send_nowait(msg.dict()) self._to_ems.send_nowait(msg.dict())
return msg return msg
def update( def update(
self, self,
uuid: str, uuid: str,
**data: dict, **data: dict,
) -> dict: ) -> dict:
cmd = self._sent_orders[uuid] cmd = self._sent_orders[uuid]
msg = cmd.dict() msg = cmd.dict()