I am working with Quandl dataset, and I realized that each call to self.History demands about 1 second. I expected an initial delay, because it is getting all the info from Quandl. But I haven't expected 1 second for each self.History, after the dataset was downloaded.

I did 3 tests to summarize. I run a 5 days simulation (daily) with: 

* I) getting 3 last VIX and VXV from Quandl. The whole backtests processed 59 datapoints in 11.08 seconds

* II) Don't call any self.History command. The backtests processed 20 datapoints in 2.12 seconds 

* III) getting 3 last SPY and AAPL (for comparison). The backtest processed 20 datapoints in 3.20 seconds

 

Questions:

* A) Currently it is taking about 2 seconds *per backtesting day* to get VIX and VXV history of a 3 days. Is there any way to improve the times?

* B) Why when I process Quandl VIX and VXV it process 59 datapoints, but when I process SPY and AAPL only 20 datapoints.

Attached is an example backtest for reference. 

Thanks

Author