Liquidate options strategies in batch
Originally posted by @jhonabreul in https://github.com/QuantConnect/Lean/issues/7221#issuecomment-1526022776
Expected Behavior
The Liquidate API takes care of multi-asset position groups (like option strategies) by liquidating them in batch (with a group order) to avoid the insufficient margin issue.
Actual Behavior
The Liquidate API liquidates multi-asset position groups using individual market orders, causing potential insiffucient buying power issues that won't allow the assets liquidation (see #7221)
Potential Solution
The Liquidate API could use combo orders to liquidate option strategies position groups in batch.
Reproducing the Problem
Run the ComboLimitOrderAlgorithm but reduce the initial cash to something like 10000. It places a butterfly call order which margin requirement is zero (0), but after Liquidate() is called, the portfolio will still have invested securities because some of the market orders fail with insufficient buying power.
System Information
Windows 11
Checklist
- [x] I have completely filled out this template
- [x] I have confirmed that this issue exists on the current
masterbranch - [x] I have confirmed that this is not a duplicate issue by searching issues
- [x] I have provided detailed steps to reproduce the issue