From f792ecf3af6c22f2ded489d7db2c63a706b9c9db Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 14 Jun 2023 16:48:57 -0400 Subject: [PATCH] binance: use new `open_trade_dialog()` endpoint name B) --- piker/brokers/binance/__init__.py | 4 ++-- piker/brokers/binance/broker.py | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/piker/brokers/binance/__init__.py b/piker/brokers/binance/__init__.py index cfdbd3a5..fb584468 100644 --- a/piker/brokers/binance/__init__.py +++ b/piker/brokers/binance/__init__.py @@ -31,14 +31,14 @@ from .feed import ( stream_quotes, ) from .broker import ( - trades_dialogue, + open_trade_dialog, ) __all__ = [ 'get_client', 'get_mkt_info', - 'trades_dialogue', + 'open_trade_dialog', 'open_history_client', 'open_symbol_search', 'stream_quotes', diff --git a/piker/brokers/binance/broker.py b/piker/brokers/binance/broker.py index c5c84549..ec4edfc4 100644 --- a/piker/brokers/binance/broker.py +++ b/piker/brokers/binance/broker.py @@ -58,6 +58,7 @@ async def handle_order_requests( ems_order_stream: tractor.MsgStream ) -> None: async with open_cached_client('binance') as client: + async for request_msg in ems_order_stream: log.info(f'Received order request {request_msg}') @@ -79,11 +80,14 @@ async def handle_order_requests( # deliver ack that order has been submitted to broker routing await ems_order_stream.send( BrokerdOrderAck( + # ems order request id oid=order.oid, + # broker specific request id reqid=reqid, time_ns=time.time_ns(), + ).dict() ) @@ -97,7 +101,7 @@ async def handle_order_requests( @tractor.context -async def trades_dialogue( +async def open_trade_dialog( ctx: tractor.Context, loglevel: str = None @@ -123,7 +127,6 @@ async def trades_dialogue( client.manage_listen_key() as listen_key, ): n.start_soon(handle_order_requests, ems_stream) - # await trio.sleep_forever() ws: NoBsWs async with open_autorecon_ws(