Back

Back testing option strategy for sp 500 is taking very long time

Hi, 

as I'm still not familiar with unvierse/alpha. I'm manually addOption for all the sp 500 tickers. if I run back test for 3 month it is taking very long time. also many times getting different crash errors. I noticed backtesting Options  are so slow compared with equity. I'm not sure, performance will improve if I move to QC 500 universe with alpha?  please help me on this.  any workaround to improve performance?
I plan to test a strategy for 5 years.  


//Initialize
SetStartDate(2019, 01, 14);
SetEndDate(2019, 2, 27);
SetCash(1000000);

//SP 500.
string tickersString = "<all 500 tickers as comma separated>";

string[] tickers = tickersString.Split(new string[1] { "," }, StringSplitOptions.RemoveEmptyEntries);

foreach (string ticker in tickers)
{
var equity = AddEquity(ticker, Resolution.Minute);
Stock stock = new Stock(ticker);
stock.EMA10 = EMA(stock.Symbol, 60, Resolution.Hour);
stock.NATR = NATR(stock.Symbol, 10, Resolution.Daily);
selectedStocks.Add(stock);

var option = AddOption(ticker, Resolution.Minute);
option.SetFilter(x => x.IncludeWeeklys().Strikes(0, 150).Expiration(TimeSpan.FromDays(45), TimeSpan.FromDays(120)));
}

 

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.


got this error:

96015_1584391496.jpg

0

Hi Saravana,

You're subscribing a massive amount of data. When you subscribe to an option chain for a symbol, it represents subscribing to data for possibly hundreds of contracts. Doing this for 500 symbols means that you are subscribed to an enormous amount of data. Instead, when using many underlying symbols, you should use the OptionChainProvider with AddOptionContract to subscribe to specific contracts for that symbol, instead of the entire chain.

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.


Thanks Rahul Chowdhury.. performance is so better by using OptionChainProvider. Thanks a lot.

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