binance: use new `open_trade_dialog()` endpoint name B)
parent
3c89295efe
commit
f792ecf3af
|
@ -31,14 +31,14 @@ from .feed import (
|
||||||
stream_quotes,
|
stream_quotes,
|
||||||
)
|
)
|
||||||
from .broker import (
|
from .broker import (
|
||||||
trades_dialogue,
|
open_trade_dialog,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'get_client',
|
'get_client',
|
||||||
'get_mkt_info',
|
'get_mkt_info',
|
||||||
'trades_dialogue',
|
'open_trade_dialog',
|
||||||
'open_history_client',
|
'open_history_client',
|
||||||
'open_symbol_search',
|
'open_symbol_search',
|
||||||
'stream_quotes',
|
'stream_quotes',
|
||||||
|
|
|
@ -58,6 +58,7 @@ async def handle_order_requests(
|
||||||
ems_order_stream: tractor.MsgStream
|
ems_order_stream: tractor.MsgStream
|
||||||
) -> None:
|
) -> None:
|
||||||
async with open_cached_client('binance') as client:
|
async with open_cached_client('binance') as client:
|
||||||
|
|
||||||
async for request_msg in ems_order_stream:
|
async for request_msg in ems_order_stream:
|
||||||
log.info(f'Received order request {request_msg}')
|
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
|
# deliver ack that order has been submitted to broker routing
|
||||||
await ems_order_stream.send(
|
await ems_order_stream.send(
|
||||||
BrokerdOrderAck(
|
BrokerdOrderAck(
|
||||||
|
|
||||||
# ems order request id
|
# ems order request id
|
||||||
oid=order.oid,
|
oid=order.oid,
|
||||||
|
|
||||||
# broker specific request id
|
# broker specific request id
|
||||||
reqid=reqid,
|
reqid=reqid,
|
||||||
time_ns=time.time_ns(),
|
time_ns=time.time_ns(),
|
||||||
|
|
||||||
).dict()
|
).dict()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -97,7 +101,7 @@ async def handle_order_requests(
|
||||||
|
|
||||||
|
|
||||||
@tractor.context
|
@tractor.context
|
||||||
async def trades_dialogue(
|
async def open_trade_dialog(
|
||||||
ctx: tractor.Context,
|
ctx: tractor.Context,
|
||||||
loglevel: str = None
|
loglevel: str = None
|
||||||
|
|
||||||
|
@ -123,7 +127,6 @@ async def trades_dialogue(
|
||||||
client.manage_listen_key() as listen_key,
|
client.manage_listen_key() as listen_key,
|
||||||
):
|
):
|
||||||
n.start_soon(handle_order_requests, ems_stream)
|
n.start_soon(handle_order_requests, ems_stream)
|
||||||
# await trio.sleep_forever()
|
|
||||||
|
|
||||||
ws: NoBsWs
|
ws: NoBsWs
|
||||||
async with open_autorecon_ws(
|
async with open_autorecon_ws(
|
||||||
|
|
Loading…
Reference in New Issue