Back to Posts
Listen to Thread

I get a "runtime error" when using set_universe with a batch_transform (one that gets past prices). If you comment out the set_universe line and un-comment the context.stocks line, it backtests fine. Am I using batch_transform with set_universe correctly?

Clone Algorithm
10
Loading...
Backtest from to with initial capital ( data)
Cumulative performance:
Algorithm Benchmark
Custom data:
Week
Month
All
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Information Ratio
--
Benchmark Returns
--
Volatility
--
Max Drawdown
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Information Ratio 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
There was a runtime error.

The backtest that works (using context.stocks, set_universe commented out)

Clone Algorithm
10
Loading...
Backtest from to with initial capital ( data)
Cumulative performance:
Algorithm Benchmark
Custom data:
Week
Month
All
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Information Ratio
--
Benchmark Returns
--
Volatility
--
Max Drawdown
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Information Ratio 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
This backtest was created using an older version of the backtester. Please re-run this backtest to see results using the latest backtester. Learn more about the recent changes.
There was a runtime error.

I think the bug is in our end, not in your code. If you turn down the lookback period to 62 days, it works, but if you lookback 63 days, it fails.

We have some code in batch transform that loads a batch warmup period. For instance, your test starts on 2012-09-03, and it therefore tries to load the previous 63 days of data. For whatever reason it's working if you load 62 days, but not 63! At first I thought it was going to be just one SID with bad data, but it appears to be happening for many, if not all SIDs. Again, not clear what's wrong.

I'm writing a bug and we'll look into it.

Thanks!

Any updates on this? I'm participating in the Upgrade Capital Algorithmic Trading Competition and would like to use set_universe with a batch_transform that has a lookback period greater than 62 days. Thank you!

Hello Troy,

We know pretty much what is causing this, but we haven't fixed it yet. We're looking to do a release later this week with a bunch of bug fixes, and the goal is to have this one fixed and included in that release. Fingers crossed, but I'm hoping Weds/Thurs.

Dan

Log in to reply to this thread.
Not a member? Sign up!