Its possible to submit a manual order for any security in your universe during live trading however doing so won't add that security to your active insights if you're using the framework models. Unless you specifically code for the occurence your weighting might be thrown off. It would be awesome if we had the options to manually fill out the fields for a new insight as an addtional way to fill out a manual order that way the framework process would treat it as if the trade was emitted by a specific alpha model. Assinging a specific name to this manual freature would help quite a bit as well although its probably not necessary. It would just make handling manual orders easier from the portfolio construction in some cases.
Shile Wen
Hi Stephen,
While it's possible to submit manual orders alongside insights, it violates the separation of concerns intended for the Algorithm Framework, and they may cause unintended effects. I suggest only using insights or only using manual orders.
Best,
Shile Wen
Stephen Hyer
That makes sense, but here's an example of why I brought this up. Let's say on Friday my algorithm emits an insight and takes a position. Over the weekend I find a serious bug that could cause unintended performance and I fix it and redeploy. The insight that created my current position is no longer in the insight collection my PCM is using and so I need to create a manual order to exit the position at some point in the future. If other insights are generated while holding this asset, which doens't exist in the insight collection, then weights could be calculated incorrectly if they are using the count of the active insights such as in the equal weight PCM. So if an algorithm, for whatever reason it may be, needs to be redeployed while positions are open it would be convenient to have a way to fill the insight collection to refresh the state of the algorithm prior to resetting. I understand your point though, so I get it if such a tool won't be implemented.
Alexandre Catarino
Hi Stephen Hyer ,
We have created a GitHub issue to address algorithm states between redeployments:
Support Portfolio Recovery Between Live Algorithm Deployments Using QuantConnect Paper Brokerage #4996
Meanwhile, your algorithms can collect the generated insights using the following code:
def Initialize(self) # ... self.InsightsGenerated += self.OnInsightsGenerated def OnInsightsGenerated(self, algorithm, insightsCollection): insights = insightsCollection.Insights
and save them in the ObjectStore in OnEndOfAlgorithm method call. When the algorithm restarts, a custom PCM can read the information from the ObjectStore and populate its InsightCollection.
Stephen Hyer
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!