Skip to content

Commit

Permalink
Fix Strategy cancellation of managed GTD on start
Browse files Browse the repository at this point in the history
  • Loading branch information
cjdsellers committed Oct 25, 2023
1 parent 63e1b7b commit 958e0a1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nautilus_trader/trading/strategy.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,14 @@ cdef class Strategy(Actor):

if self.manage_gtd_expiry:
for order in open_orders:
if order.time_in_force == TimeInForce.GTD and not self._has_gtd_expiry_timer(order.client_order_id):
self._set_gtd_expiry(order)
if order.time_in_force == TimeInForce.GTD:
if self._clock.timestamp_ns() >= order.expire_time_ns:
if self._has_gtd_expiry_timer(order.client_order_id):
self.cancel_gtd_expiry(order)
self.cancel_order(order)
continue
if not self._has_gtd_expiry_timer(order.client_order_id):
self._set_gtd_expiry(order)

self.on_start()

Expand Down

0 comments on commit 958e0a1

Please sign in to comment.