Back

Price availability issue

I guess like many others, I place orders like this:
Order(ETF.Symbol, (int)(PortfolioValue / Symbol.Close ), OrderType.Market);
However, in reality, sometimes the price of a particular symbol is not available, and a "Divided by 0" error showed up. This will blow up my order process.
My question is how I can tell if the symbol price is unavailable at a certain time so I can kick it out and prevent this problem?

Thank you!
Update Backtest








Hey Travis! This should be covered by fill forward in most cases, but sometimes it doesn't make sense to fill forward - e.g. we only fill forward at times the market is open for a symbol so if you're mixing weekend daily data you won't get any intraday equities.

The best way to check for this is as shown in "How do I ensure there's always data?" in the university, or more simply using the ContainsKey method:
if (!data.ContainsKey("IBM")) return;
1

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.


Hi Jared,

Thank you very much, that is very helpful! I do see some data missing such as "OIH" and "SMH". They should be able to be traced back to 2000, but I couldn't find the values until 2012. The days I was looking was not holiday or weekend, since I can find data for other tickers.

Travis
0

Update Backtest





0

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.


Loading...

This discussion is closed