I constantly get this error when backtesting basic options + equity strategy:
Runtime Error: System.Exception: Algorithm took longer than 10 minutes on a single time loop. at QuantConnect.Isolator.ExecuteWithTimeLimit
Is there any tip to avoid it? increase the filter / time frame?
It is the same strategy as the one below but longer time-frame
Quant Trader
Hi, basically you are executing your algo every minute...not sure if you are going to do that in practice? Look for the onschedule method and put your algo to trade every 5 minutes and see if it is capable of getting all data in in 5 minutes of time, or have it executed once a day. The ondata has a limitation as it wants to pump the next minute data in your also, but your calculations take more than 1 minute to run. You can also use a consolidator that is triggered every 5 minutes to trade. i guess onschedule will do, but trading every minute must also make your calculation can be done in a minute.
Or do this part daily as it might take time to collect all the data from all contracts:
contracts = self.OptionChainProvider.GetOptionContractList(self.underlyingsymbol, self.Time.date()) if len(contracts) == 0: return filtered_contracts = self.InitialFilter(self.underlyingsymbol, contracts, -3, 3, 0, 30) call = [x for x in filtered_contracts if x.ID.OptionRight == 0]
Lucas Silva
The computation that happens every minute is:
if not self.Portfolio[self.call].Invested and self.Time.hour != 0 and self.Time.minute == 1:
The real computation happens once every couple of months, but I will try the scheduler
Quant Trader
I cloned your algo to see how to get it work. I get next errors and in july 2012 it becomes slow.
136 | 16:39:39: Backtest Handled Error: QQQ 110416C00053000: asset price is $0. If using custom data make sure you've set the 'Value' property. 137 | 16:39:39: Algorithm-Id: d3cced16a9be52caabe93159e17bd17e successfully sent to cloud. 138 | 16:41:01: Backtest Handled Error: QQQ 120121C00053000: asset price is $0. If using custom data make sure you've set the 'Value' property. 139 | 16:42:51: Backtest Handled Error: QQQ 120218C00057000: asset price is $0. If using custom data make sure you've set the 'Value' property. 140 | 16:45:15: Backtest Handled Error: QQQ 120330C00060000: asset price is $0. If using custom data make sure you've set the 'Value' property. 141 | 16:48:15: Backtest Handled Error: QQQ 120421C00063000: asset price is $0. If using custom data make sure you've set the 'Value' property. 142 | 16:51:10: Backtest Handled Error: QQQ 120519C00062000: asset price is $0. If using custom data make sure you've set the 'Value' property. 143 | 16:54:48: Backtest Handled Error: QQQ 120629C00058000: asset price is $0. If using custom data make sure you've set the 'Value' property. 144 | 16:59:36: Backtest Handled Error: QQQ 120721C00060000: asset price is $0. If using custom data make sure you've set the 'Value' property. 145 | 17:04:41: Backtest Handled Error: QQQ 120818C00061000: asset price is $0. If using custom data make sure you've set the 'Value' property.
Lucas Silva
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!