Quantopian's community platform is shutting down. Please read this post for more information and download your code.
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.