Hello QuantConnect Community,

I am currently working on implementing a trading strategy using the Algorithm Framework, specifically focusing on the Portfolio Construction Model. I've encountered an issue that I hope to get some guidance on.

Problem Description: I am using PortfolioTarget.Percent() within my Portfolio Construction Model to set portfolio targets based on the percentage of total portfolio value. However, I've noticed that even though targets are set as percentages, they are internally calculated into quantities (number of shares) at the time of target setting, using the current market prices available at that moment. This approach seems to lead to issues because the actual execution prices later on (when the Execution Model processes these targets) can be different due to price movements. Consequently, the executed quantities do not accurately reflect the intended portfolio percentages, sometimes rendering orders invalid or inconsistent with the strategic allocation decided by the PCM.

Specific Issues Faced:

  • Orders sometimes exceed available capital due to price changes between target setting and order execution.
  • The inaccuracy in quantity calculation from percentage targets due to real-time price fluctuations.

This situation undermines the separation of concerns intended by the Algorithm Framework, as I find myself needing to either:

  1. Manually track and adjust prices within the PCM, which seems counterintuitive to the framework’s design.
  2. Rewrite the Execution Model to dynamically adjust quantities at the time of order execution, which adds complexity.

Questions:

  1. Has anyone else encountered this issue with PortfolioTarget.Percent() and found a way to ensure that the targets set as a percentage of the portfolio are executed accurately reflecting current market prices?
  2. Are there recommended practices or modifications within the Execution Model to handle such discrepancies between target setting and order execution times?
  3. Any general advice on maintaining the integrity of percentage-based portfolio targets through market fluctuations?

I appreciate any insights or suggestions on how to address these challenges. Thank you in advance for your help!