Hi;
I am trying to understand how insights work for the time period they are set to. So I set the initial insight to 20 days which then bought a stock as expected.
I then set it 10 days later to return an insight for the same stock saying it was going down. I expected a sell and wanted to see if that overrode the previous insight. This new setting was for 1 day to see if that was a complete override, or just for 1 day and then it would revert.
What's very weird is it bought 8866 shares (correct), then sold on 02-14 (correct), but sold -17661 shares. Where did those extra shares come from. It then bought and sold on random additional days. Some of those additional buys make sense if the sell (down) insight expired and the buy (up) insight is still in scope. But that doesn't explain all of them.
Question 1: What's going on?
Question 2: If I want to buy stocks, then do a daily decision as to if it's time to now sell them, is AlphaModel.Update() & insights a bad way to do this? And should I instead just use OnData() each evening to do explicit buys & sells?
thanks - dave
ps - If the answer to #2 is don't use insights, the answer to #1 is not critical, but I would like to know.
Mak K
Hi Dave,
I don't have much time right now, so I will give a more detailed answer later but;
The reason for it selling 17661 shares is that sending a Down Insight means it will go short. So to go short it sold your current position minus the amount you told it to go short. If you want to simply liquidate you have to use the “Flat” insight.
https://www.quantconnect.com/docs/algorithm-framework/alpha-creation#Alpha-Creation-Creating-Insights
The rest I will look at later, thanks!
Cole S
Hi David,
I struggled with insights when they first came out and fought against these types of issues. what I realized was that I simply needed to write my own PortfolioConstructionModel which allowed me to handle the insights the way I wanted to. This did involve deep diving into the Lean code that runs the framework algorithm but I was able to achieve most of what I wanted. I especially did not like that insights remained active even after the risk management model closed the position.
Hope that helps.
-Cole
David Thielen
Thanks - this helps a lot.
David Thielen
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!