Adjust async orders handling in backtesting (#8979)
Build & Test Lean / build (push) Has been cancelled
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Regression Tests / build (push) Has been cancelled
Report Generator Tests / build (push) Has been cancelled
Research Regression Tests / build (push) Has been cancelled
Syntax Tests / build (push) Has been cancelled
Python Virtual Environments / build (push) Has been cancelled

Submit (and fill in case of market orders) in the same time step even if orders are asynchronous in backtesting since it's data driven instead of real time driven.
This commit is contained in:
Jhonathan Abreu
2025-09-18 11:53:28 -04:00
committed by GitHub
parent 496f210116
commit 36404a6187
4 changed files with 167 additions and 17 deletions
@@ -42,10 +42,8 @@ class OrderTicketAssignmentDemoAlgorithm(QCAlgorithm):
ticket = order_event.ticket
if ticket is None:
raise AssertionError("Expected order ticket in order event to not be null")
if self.ticket is None:
raise AssertionError("Expected the ticket to have been returned by the MarketOrder call")
if ticket.order_id != self.ticket.order_id:
raise AssertionError("Expected the ticket in the order event to be the same instance as the one returned by MarketOrder")
if order_event.status == OrderStatus.SUBMITTED and self.ticket is not None:
raise AssertionError("Field self.ticket not expected no be assigned on the first order event")
self.debug(ticket.to_string())