Term Structure Commodities (Python). StockSharp

Author: StockSharp
N: 2077
v5.0.0 (8/7/2025)
Downloads: 0

The strategy trades the slope of commodity futures curves. It buys contracts in backwardation and sells those in contango, betting on mean reversion in the term structure.
Each month the system ranks futures by carry, going long the strongest backwardation and short the steepest contango. Positions roll prior to expiry.

  • Data: Front and deferred futures prices.
  • Entry: Long top carry commodities, short bottom carry.
  • Exit: Roll on contract expiration or if carry flips sign.
  • Instruments: Commodity futures.
  • Risk: Equal dollar weighting with stop on adverse carry change.