Repository navigation
Run past consolidators before scheduled events - #9542
yinli-systems wants to merge 3 commits into
Conversation
|
Follow-up with the intended behavior this PR is trying to lock down: when a scheduled event and a consolidator are both due at the same frontier time, the consolidator should be advanced first so the scheduled event observes the latest completed bar, not stale state from the previous frontier. The regression test covers that ordering directly. I kept the change localized to the time-slice ordering path rather than changing scheduled event semantics more broadly. Happy to adjust if there is a more appropriate Lean convention for this case. |
…ed-events-after-consolidators
…ed-events-after-consolidators
|
Synced this branch with current master (104d3dc) using the repository’s post-push merge workflow and reran it on .NET 10. The focused regression passes, all six AlgorithmManagerTests pass, and restoring the old order makes the regression fail at ScanPastEvents because the consolidator has not yet scanned. @Martin-Molinero, since you linked the related scheduling issue, could you confirm that consolidator-before-scheduled-event is the intended engine ordering? |
Description
Fixes #8649.
AlgorithmManager.Run currently scans past scheduled events before it scans past consolidators. When LEAN advances across a period with no data, a due scheduled callback can therefore observe indicator state from the previous frontier even though the consolidator is due at an earlier time.
This moves ScanPastConsolidators ahead of ScanPastEvents while preserving the existing live-mode scan-time rounding and both performance-tracking blocks.
The regression drives AlgorithmManager with one time-pulse slice and a registered consolidator. Its real-time handler asserts that the consolidator has already been scanned when ScanPastEvents runs, directly locking down the ordering that caused the stale-indicator report.
Related
Related to #5595.
Testing
Validated after merging current upstream master through 104d3dc with .NET SDK 10.0.302 on macOS Arm64:
I also restored the old upstream ordering as a negative control. The regression then failed inside ScanPastEvents because the consolidator flag was still false. Restoring this PR's ordering made the same test pass again.
The build emits existing dependency-advisory and analyzer warnings from the current repository; there were no build or test failures.
AI assistance
AI assistance was used to synchronize current master, inspect the event-ordering path, run the .NET 10 regression and fixture, perform the negative-control check, and refine this description. I reviewed the implementation and evidence before pushing it.