QuantConnect / QuantConnect/Lean
Buying power validation for combo orders updates
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 21.7k
- Forks
- 5.3k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 34
Description
Expected Behavior
Buying power validation is done for combo orders, so that updates are rejected if margin is not enough for the requested new order settings.
Actual Behavior
Buying power validation is done only for individual orders and skipped for combo orders.
See https://github.com/QuantConnect/Lean/pull/8553.
Potential Solution
OrderTicket.Update might have an overload to take a collection of updates for each leg of a combo, and updates request can be queued in a batch together. That way the brokerage transaction handler can validate the buying power for the whole combo.
Reproducing the Problem
See https://github.com/QuantConnect/Lean/pull/8553 and comment out if (order.GroupOrderManager == null) in BrokerageTransactionHandler.HandleUpdateOrderRequest() to allow updates to combo orders legs. The regression algorithms that update combo orders start failing.
System Information
Windows 11
Checklist
- I have completely filled out this template
- I have confirmed that this issue exists on the current
masterbranch - I have confirmed that this is not a duplicate issue by searching issues
- I have provided detailed steps to reproduce the issue
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with BrokerageTransactionHandler.HandleUpdateOrderRequest() and review the related changes in pull request 8553. Reproduce the issue using the regression algorithms that update combo orders, then trace OrderTicket.Update and combo-leg handling. Done means combo-order updates are rejected when the requested settings exceed available buying power, while valid updates continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100