Lean
Lean copied to clipboard
Suggestions for Improvements to `PortfolioConstructionModel`
Expected Behavior
- The method
GetTargetInsightsshould correctly handle insights emitted simultaneously from multiple Alpha Models. - The method
DetermineTargetPercentshould provide target portfolio weights per symbol instead of per insight.
Actual Behavior
- Currently,
GetTargetInsightsonly supports a singleAlphaModel. If two or more Alpha Models emit insights simultaneously, only the insights from the most recently addedAlphaModelare considered, ignoring the otherAlphaModelentirely. See also this backtest. -
DetermineTargetPercentreturns aDictionary<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 multiplePortfolioTargetobjects for that symbol at the same time, causing unnecessay trades in theExecutionModel.
Potential Solution
- Adjust
GetTargetInsightsto group insights by bothSymbolandAlphaModel/SourceModel, providing condideration of insights from all Alpha Models. - 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()
- Introducing an overload method such as:
Open for additional suggestions or alternative ideas. 😊
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
- The InsightManager is supposed to be cleaned up regularly to only keep the last active insight for each (AlphaModel, Symbol) pair. I don't see a use case where people need older insight objects that were already overriden by a newer one. For backwards compatibility we could make it optional with a setting like
settings.auto_cleanup_insights = False(default). This will also help a lot in terms of performance as it will keep the number of insights as small as possible.