Optimizer launcher cannot resolve its default grid-search strategy

Open Beginner friendly
#10,059 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
76/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
backend

Research direction

Start in Optimizer.Launcher/Program.cs and trace how the launcher chooses the default strategy when optimization-strategy is omitted. Reproduce with the provided config.json and dotnet ... --estimate; compare with the explicitly selected strategy, which produces an estimate of 5. Done means the omitted-setting path resolves the default and a regression test covers it.

Written by the indexing model from the issue text.

Description

Problem

The optimizer launcher supplies QuantConnect.Optimizer.GridSearchOptimizationStrategy when optimization-strategy is omitted (Optimizer.Launcher/Program.cs). The class actually lives in QuantConnect.Optimizer.Strategies, so LeanOptimizer cannot resolve the default type and its constructor throws ArgumentNullException (type).

This default is already present on master.

Reproduction

Build Optimizer.Launcher/QuantConnect.Optimizer.Launcher.csproj. In a fresh working directory, save this as config.json:

{
  "optimization-strategy-settings": {
    "$type": "QuantConnect.Optimizer.Strategies.StepBaseOptimizationStrategySettings, QuantConnect.Optimizer"
  },
  "optimization-criterion": {"target": "Statistics.TotalProfit", "extremum": "max"},
  "parameters": [{"name": "x", "min": 0, "max": 4, "step": 1}],
  "log-handler": "ConsoleLogHandler"
}

Run:

dotnet /path/to/QuantConnect.Optimizer.Launcher.dll --estimate

Observed: the launcher logs a TargetInvocationException wrapping ArgumentNullException: Value cannot be null. (Parameter 'type') from LeanOptimizer's constructor; no estimate is produced.

Add "optimization-strategy": "QuantConnect.Optimizer.Strategies.GridSearchOptimizationStrategy" to the same file and rerun. Observed: Optimization estimate: 5, exit 0.

Expected

Omitting the strategy must select a resolvable default and produce the same estimate as explicitly selecting that strategy. A regression test should exercise the omitted-setting path.

Dominant language
C#
Stars
22.6k
Forks
5.4k
Avg merge
11h 39m
Merged PRs (30d)
104

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from QuantConnect/Lean

All issues in QuantConnect/Lean

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.