Support asynchronous non-market orders (#8946)
API Tests / build (push) Has been cancelled
Benchmarks / build (push) Has been cancelled
Build & Test Lean / 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

* Add 'asynchronous' parameter to trading api

* Add regression algorithms

* More fixes for asynchronous orders

* Fix failing unit tests

* Fix failing unit tests

* Add multiple orders requests in transaction handler

Make each transaction thread handle requests corresponding to the same order

* Refactor order state machine in BrokerageTransactionHandler

Now using a single dictionary to hold orders and their state, either pending for submission, open or closed.

* Revert: remove complete orders from new state machine in BTH

* Add order ticket to new BTH open orders state machine

* Run syn in Backtesting transaction handler for new orders submission

* Remove OpenOrderState.SubmissionPending property

* Add Security to OpenOrderState

* Minor fix

* Cleanup

* Some cleanup in BTH

* Cleanup

* Minor fix

* Minor unit test fix

* Minor fix

* Make Brokerage.ConcurrencyEnable property virtual

* Minor change

* Cleanup

* Add 'asynchronous' parameter to SetHoldings api

* Improve regression algorithms
This commit is contained in:
Jhonathan Abreu
2025-09-10 08:29:50 -04:00
committed by GitHub
parent 23afff13fc
commit d82d70dacf
49 changed files with 1226 additions and 242 deletions
@@ -42,8 +42,10 @@ class OrderTicketAssignmentDemoAlgorithm(QCAlgorithm):
ticket = order_event.ticket
if ticket is None:
raise AssertionError("Expected order ticket in order event to not be null")
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")
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")
self.debug(ticket.to_string())