So I have an existing portfolio that I'm trying to run a QC algorithm in conjunction with.
I've tried using self.Debug() to print some of the portfolio details just to check that the data is being stored correctly but nothing seems to appear in the console. It connects and everything but I don't see the debug messages that ought to appear automatically.
Part of the difficulty is that I'm trying to work with an existing portfolio from IB. This makes it a bit harder to initialise something similar for testing without coding up purchase orders.
The other thing I'm not sure about is option securities. I add all the existing option contract symbols to the universe using AddOptionContract and store the resulting securities.option.option object. Then I add the option pricing model to each one individually. The whole thing of how securities objects work is relatively under documented in terms of the fact it seems pretty important to how the whole underlying OnData command works but it's unclear what's going on. Any pointers in that direction or advice would be appreciated.
Sherry Yang
Hi there,
Thanks for sharing your algorithm and your suggestion about increased documentation. We will work on that.
Per what you shared: in terms of the debugging issue, try adding the line self.Debug(f'{self.Securities.Keys}') in Initialize() to figure out which securities are in your portfolio and if there are discrepancies. In backtesting OnData is not called but in Live trading using that Debug message should be helpful in diagnosing what is going on in OnData.
Assuming your portfolio has open positions, OnData should have symbol data. One minor issue seems to be that the OptionChains object has no attribute Value. It needs to be data.OptionChains.Values. Let us know if that helps!
Sherry
Hello
It looks like there might be a different issue that I'm dealing with causing the log messages to be delayed. Thanks for the advice!
Hello
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!