Lean icon indicating copy to clipboard operation
Lean copied to clipboard

Buying power validation for combo orders updates

Open jhonabreul opened this issue 11 months ago • 0 comments

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

  • [x] I have completely filled out this template
  • [x] I have confirmed that this issue exists on the current master branch
  • [x] I have confirmed that this is not a duplicate issue by searching issues
  • [x] I have provided detailed steps to reproduce the issue

jhonabreul avatar Jan 31 '25 14:01 jhonabreul