Add scheduled walk-forward optimization support#9611
Open
scarab-systems wants to merge 3 commits into
Open
Conversation
Adds QCAlgorithm Optimize overloads backed by a pluggable walk-forward optimization provider contract in Common, including request/result DTOs and Python wrapper forwarding. Verification: dotnet build Tests/QuantConnect.Tests.csproj /p:Configuration=Debug /v:quiet in the SDS Lean workspace; PYTHONNET_PYDLL=/usr/local/lib/libpython3.13.so dotnet test Tests/bin/Debug/QuantConnect.Tests.dll --filter FullyQualifiedName~AlgorithmWalkForwardOptimizationTests.
Exports the walk-forward optimization provider contract through Composer and injects the configured provider when LocalLeanManager receives the algorithm. Verification: dotnet build Tests/QuantConnect.Tests.csproj /p:Configuration=Debug /v:quiet; PYTHONNET_PYDLL=/usr/local/lib/libpython3.13.so dotnet test Tests/bin/Debug/QuantConnect.Tests.dll --filter FullyQualifiedName~WalkForwardOptimizationProviderRoutingTests.
Adds local and cloud walk-forward optimization providers, captures lightweight optimizer backtests for selector flows, and covers target, selector, timeout, abort, and engine-routing behavior with focused tests. Verification: dotnet build Tests/QuantConnect.Tests.csproj /p:Configuration=Debug /v:quiet; dotnet test QuantConnect.Tests.dll --filter WFO provider/algorithm/routing filters; dotnet test QuantConnect.Tests.dll --filter FullyQualifiedName~QuantConnect.Tests.Optimizer.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds scheduled walk-forward optimization support for algorithms:
QCAlgorithm.Optimize(...)overloads that schedule walk-forward optimization similarly toTrain(...).Related Issue
Addresses #7031
Motivation and Context
Issue #7031 requests walk-forward optimization support in LEAN. This PR adds a core API contract and provider routing so algorithms can trigger optimization over time and apply chosen parameters without hard-coding a single execution backend.
Requires Documentation Change
Yes. If accepted, documentation should describe the new
Optimize(...)API and thewalk-forward-optimization-*configuration keys for local and cloud execution.How Has This Been Tested?
Local environment: macOS, .NET SDK in this checkout.
dotnet build Tests/QuantConnect.Tests.csproj /p:Configuration=Debug /v:quietgit diff --check origin/master...HEADTypes of changes
Checklist:
bug-<issue#>-<description>orfeature-<issue#>-<description>Disclosure: I used AI-assisted coding tools while preparing this PR. I reviewed the changes myself, tested them, and take responsibility for the implementation and any follow-up revisions needed.