Don't submit limits on alerts
parent
ecd94ce24d
commit
4d03d62641
|
@ -179,31 +179,40 @@ async def execute_triggers(
|
||||||
# majority of iterations will be non-matches
|
# majority of iterations will be non-matches
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# submit_price = price + price*percent_away
|
action = cmd['action']
|
||||||
submit_price = price + abs_diff_away
|
|
||||||
|
|
||||||
log.info(
|
if action != 'alert':
|
||||||
f'Dark order triggered for price {price}\n'
|
# executable order submission
|
||||||
f'Submitting order @ price {submit_price}')
|
|
||||||
|
|
||||||
reqid = await client.submit_limit(
|
# submit_price = price + price*percent_away
|
||||||
oid=oid,
|
submit_price = price + abs_diff_away
|
||||||
|
|
||||||
# this is a brand new order request for the
|
log.info(
|
||||||
# underlying broker so we set out "broker request
|
f'Dark order triggered for price {price}\n'
|
||||||
# id" (brid) as nothing so that the broker
|
f'Submitting order @ price {submit_price}')
|
||||||
# client knows that we aren't trying to modify
|
|
||||||
# an existing order.
|
|
||||||
brid=None,
|
|
||||||
|
|
||||||
symbol=sym,
|
reqid = await client.submit_limit(
|
||||||
action=cmd['action'],
|
oid=oid,
|
||||||
price=submit_price,
|
|
||||||
size=cmd['size'],
|
|
||||||
)
|
|
||||||
|
|
||||||
# register broker request id to ems id
|
# this is a brand new order request for the
|
||||||
book._broker2ems_ids[reqid] = oid
|
# underlying broker so we set out "broker request
|
||||||
|
# id" (brid) as nothing so that the broker
|
||||||
|
# client knows that we aren't trying to modify
|
||||||
|
# an existing order.
|
||||||
|
brid=None,
|
||||||
|
|
||||||
|
symbol=sym,
|
||||||
|
action=cmd['action'],
|
||||||
|
price=submit_price,
|
||||||
|
size=cmd['size'],
|
||||||
|
)
|
||||||
|
|
||||||
|
# register broker request id to ems id
|
||||||
|
book._broker2ems_ids[reqid] = oid
|
||||||
|
|
||||||
|
else:
|
||||||
|
# alerts have no broker request id
|
||||||
|
reqid = ''
|
||||||
|
|
||||||
resp = {
|
resp = {
|
||||||
'resp': 'dark_executed',
|
'resp': 'dark_executed',
|
||||||
|
|
Loading…
Reference in New Issue