Lean
Lean copied to clipboard
Backtesting: Flexible Settlement date
Expected Behavior
Create flexible DefaultSettlementDays depending on Securities.
For instance:
Run algo before May 28, 2024 the DefaultSettlementDays for Equites => 2 days.
Actual Behavior
Use the DefaultSettlementDays for Equites => 1 day always.
Potential Solution
Should use different SettlementDays by Securties and backtesting time. The SettlementDays was changed (look at attached PR) to 1 day, but if the user runs algo before SettlementDays changed it will use the wrong amount of settled cash in the user balance.
Also, we should pay attention to different markets (international ones). Different SettlementDaya values can be used.
Reproducing the Problem
Run algo before May 28, 2024. Buy or sell' SPY' on the same day and ensure that cash is settled successfully.
Related PRs
- https://github.com/QuantConnect/Lean/pull/8657
System Information
N/a
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