Hi, two questions:
One of my newer custom sources has two lines of data as "headers" in the csv file. In my custom code, I invoke base subscription reader, etc, but not sure if it will throw warnings or errors when attempting to read a line that doesn't parse correctly. Is there a way to control how many lines are skipped in reading custom files?
Also, is there a way to invoke custom data so that it redownloads a new file every day in live mode, but only download the file once in backtesting mode (so that during backtesting the custom data source doesn't get pinged millions of times within the span of five minutes)?
Thanks!
-Stephen
Stephen Oehler
And in traditional fashion, I shall answer my first question! Apparently headers don't matter at all to the LEAN engine; I just used a csv file with header rows and it skipped right over them.
However if anyone has an answer to the second question, I'd much appreciate it.
Alexandre Catarino
Regarding you first answer, we can either check whether the line is a header or use a try-catch to return null. nulls are skipped. If we have a try-catch statement with a catch that doesn't return/throw, when we try to parse a header into a DateTime, the result is an instance with EndTime equals to DateTime.MinValue. That instance will be skipped since DateTime.MinValue is lower than StartDate.
In backtesting, a file is pinged and redownloaded only once during the execution.
Jared Broad
backtesting use the same URL each time,
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.
Stephen Oehler
Ah fantastic, thanks!
Stephen Oehler
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!