I have an algo running but I logged into Interactive Brokers and placed a manual options trade. I have the initialize section set up to recognize QQQ options and the algo itself purchases them so it should recognize when it is owned in the portfolio. In case I need to restart the algo I have a section of OnData as follows below. In case the algo restarts and an option is held in securities. It can pull that option, change a list number that would suggest it is holding the option, etc. For some reason it did not do that at all when I manually purchased the option with the algo actively running. In fact, the option that I purchased is not even in my Holdings section on the Live Deploy. Any reason why when purchasing securities or options manually (though IB and not on the live deploy tab) it doesn't register it on the live algo even though it is in the portfolio? I thought that the next minute Ondata runs it would pull the option that is in my portfolio.
calloptioninvestedQQQ = [symbol for symbol, holding in self.Portfolio.items() if holding.IsLong and holding.Type == SecurityType.Option and symbol.Underlying.Equals(self.symbolqqq) and symbol.ID.OptionRight == OptionRight.Call]
#trading logic for QQQ options
#if algo restarts and option invested this will update the lists and option logs
if calloptioninvestedQQQ:
if self.qqqcalloptionlist[0] == 0:
self.qqqcalloptionlist[0] = 5
self.callcontractqqq = calloptioninvestedQQQ[0]
Louis Szeto
Hi David
The Portfolio manager of LEAN only manage the securities within that algorithm instance. It won't recognise your manual trades nor positions.
Best
Louis
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.
David Eldringhoff
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!