Back to Community
Automated Futures Rolling

I'm excited to see futures on the platform. I recently wrote an algo and have started backtesting it, I noticed that once I entered into a contract it is not automatically rolled to the next contract after expiry (just like real life trading).

The ContinuousFuture data type has a specified way to roll each contract. I was wondering if there was some way to reuse the code to roll historical data for rolling current contracts. For example I would like to use volume to decide when to roll my contracts, the ContinuousFuture does that for historical data why not make it available for live positions.

I think this would be a useful feature.

1 response

I have written something myself, it didn't take too long.
See the attached code lines 41-53.

Maybe this will help out other people.

Clone Algorithm
4
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
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
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 59837ec0b215a755608ed961
There was a runtime error.