HI! I'm running local backtests on multiple securities.
I've read about Importing Custom Data, but I think it doesn't solve my problem.
When you calling ‘AddSecurity()’ method it creates main data subscription. And this data is not found.
As I understand, when you calling ‘AddData<YouCustomDataName>()’, it creates additional subscription for this data and you get them in ‘void OnData(YouCustomDataName data)’ method which is mapped by reflection.
Main problem of this approach is that Security state (OHLC + Price, Volume) doesn't get updated with this custom data, because ‘Security.Update()’ method is not called. I can call it manually in my YouCustomDataName class, in Reader() method, but I think it's a hack and this can break backtest internal state =(
My main goal is to write my custom data source logic and use it as main data source for my backtest.
Can you help me with this problem? Should I implement some interfaces and change config properties?
Additional question:
If my data source has missing dates in history (weekend and holidays) how I should handle this? Will It brake backtest's time continuity?
Should I use FillForward option? If so, how to use FillForward? I couldn't find documentation about this functionality.
Louis Szeto
Hi Sava
Please find the format of importing custom data in this doc. It is possible to include OHLC and volume as attributes of the custom security object as mapped to different columns of the .csv file. In that way, you will also need to specify the attribute .Value as the close price data. There is no need to fill in data on the time without any, just delete the row in the .csv file if that is empty.
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.
Sava Lifanov
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!