Better live order handling logic
parent
a7e106be96
commit
8f05254c80
|
@ -556,9 +556,7 @@ async def process_client_order_cmds(
|
||||||
|
|
||||||
# check for live-broker order
|
# check for live-broker order
|
||||||
if live_entry:
|
if live_entry:
|
||||||
|
reqid = live_entry.reqid
|
||||||
reqid = reqid or live_entry.reqid
|
|
||||||
assert reqid
|
|
||||||
|
|
||||||
msg = BrokerdCancel(
|
msg = BrokerdCancel(
|
||||||
oid=oid,
|
oid=oid,
|
||||||
|
@ -566,11 +564,13 @@ async def process_client_order_cmds(
|
||||||
time_ns=time.time_ns(),
|
time_ns=time.time_ns(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# NOTE: cancel response will be relayed back in messages
|
||||||
|
# from corresponding broker
|
||||||
|
if reqid:
|
||||||
|
|
||||||
# send cancel to brokerd immediately!
|
# send cancel to brokerd immediately!
|
||||||
log.info("Submitting cancel for live order {reqid}")
|
log.info("Submitting cancel for live order {reqid}")
|
||||||
|
|
||||||
# NOTE: cancel response will be relayed back in messages
|
|
||||||
# from corresponding broker
|
|
||||||
await brokerd_order_stream.send(msg.dict())
|
await brokerd_order_stream.send(msg.dict())
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -580,7 +580,8 @@ async def process_client_order_cmds(
|
||||||
# order request can be cancelled at that time.
|
# order request can be cancelled at that time.
|
||||||
dark_book._ems_entries[oid] = msg
|
dark_book._ems_entries[oid] = msg
|
||||||
|
|
||||||
# check for EMS active exec
|
# dark trigger cancel
|
||||||
|
else:
|
||||||
try:
|
try:
|
||||||
# remove from dark book clearing
|
# remove from dark book clearing
|
||||||
dark_book.orders[symbol].pop(oid, None)
|
dark_book.orders[symbol].pop(oid, None)
|
||||||
|
|
Loading…
Reference in New Issue