I am following the documentation below to stream custom data to the OnData method from a Google Sheet. When I log the symbol object every hour, it just returns 0. I can't determine why it isn't coming through.
QUANTCONNECT COMMUNITY
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.
Mia Alissi
Based on the information provided, it seems like you're trying to stream custom data from a CSV file into your algorithm using the
OnData
method. If the symbol object is returning 0, it might be due to a few reasons:The data in your CSV file might not be in the correct format. According to the documentation, the data in the file must be in chronological order.
The custom data type might not be correctly defined. You need to inherit the
BaseData
orPythonData
class and override theGetSource
andReader
methods.Here is an example of how to define a custom data type in Python:
Initialize
method of your algorithm, you need to call theAddData
method. Here is an example:Please ensure that your CSV file, custom data type, and algorithm setup align with these guidelines. If you're still facing issues, it would be helpful to have more specific details about your implementation.
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.
Eli Laycock
Hi Mia,
Thank you very much for your reply! I believe I have followed the documentation to a tee, having defined the custom data type extending the PythonData class and using the AddData method. The data in the CSV is chronologically correct. Any guidance why the attached algorithm in my original post isn't pulling in the value would be greatly appreciated.
Thank you!
Eli
Jared Broad
Hi Eli,
There were many errors - but the key was:
It was fun to see data imported from Google Sheets!
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.
Eli Laycock
Hi Jared,
Thank you for your reply - and catching my errors! I was seeing an error (below in red) in the console, however after removing column headers in the Google Sheet, the error went away. It works!
For live trading, are there any considerations for switching from Google Sheets (backtesting) to pulling in these symbols from the IB feed? When switching to live trading would I simply switch:
self.VIX3M = self.AddData(VIX3M, "VIX3M", Resolution.Hour).Symbol
to
self.VIX3M = self.AddIndex("VIX3M", Resolution.Hour).Symbol
And then VIX3M's symbol would stream to OnData from the IBKR feed? Would I need to replace the VIX3M source argument in self.AddData() with an argument specific for IB's data feed?
Thanks again,
Eli
Error invoking VIX3M.VIX3M data reader. Line: Date,VIX3M,VIX6M Error: time data 'Date' does not match format '%Y-%m-%d %H:%M'
Eli Laycock
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!