QuantConnect / QuantConnect/Lean

Suggestions for Improvements to `PortfolioConstructionModel`

Open
#8,630 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

framework
Dominant language
C#
Stars
21.7k
Forks
5.3k
Avg merge
2d 22h
Merged PRs (30d)
34

Description

Expected Behavior
  1. The method GetTargetInsights should correctly handle insights emitted simultaneously from multiple Alpha Models.
  2. The method DetermineTargetPercent should provide target portfolio weights per symbol instead of per insight.
Actual Behavior
  1. Currently, GetTargetInsights only supports a single AlphaModel. If two or more Alpha Models emit insights simultaneously, only the insights from the most recently added AlphaModel are considered, ignoring the other AlphaModel entirely. See also this backtest.
  2. DetermineTargetPercent returns a Dictionary<Insight, double>. Assigning weights based on insights is uncommon and impractical since insights themselves cannot be traded. Additionally, having multiple active insights for the same symbol results in multiple PortfolioTarget objects for that symbol at the same time, causing unnecessay trades in the ExecutionModel.
Potential Solution
  1. Adjust GetTargetInsights to group insights by both Symbol and AlphaModel/SourceModel, providing condideration of insights from all Alpha Models.
  2. Since method overloading by return type isn't possible, consider either:
    • Introducing an overload method such as:
      Dictionary<Symbol, double> DetermineTargetPercent(List<Insight> activeInsights, bool groupBySymbol = false)
    • Or creating a separate method explicitly named:
      DetermineTargetPercentBySymbol()

Open for additional suggestions or alternative ideas. 😊

Checklist
  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues

Contributor guide

Open the contributing guide

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.

Research direction

Start by reading PortfolioConstructionModel's GetTargetInsights and DetermineTargetPercent entry points. Trace how simultaneous insights from multiple Alpha Models are selected and how target weights are keyed. Done means the behavior accounts for all relevant Alpha Models and supports symbol-level portfolio targets, with the API choice resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend-api-design
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.