Skip to content

A systematic Momentum and Carry strategy for WTI Crude Oil.

Notifications You must be signed in to change notification settings

Rakeshks7/quant-oil-strategy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Quantitative Oil Trading Strategy 🛢️

A systematic trading framework for WTI Crude Oil futures, based on the research by Quant Insider. This project implements a multi-factor strategy that combines Momentum, Term Structure (Carry), and Volatility Risk Premium, managed by a nonlinear reaction function for position sizing.

📊 Strategy Overview

This algorithm automates the analysis of three core quantitative edges in commodity markets:

  1. Momentum: Captures inventory-driven price trends using volatility-normalized filters.
  2. Carry (Curve Structure): Exploits the "roll yield" by tracking the spread between near-term (USO) and long-term (USL) exposure.
    • Backwardation (Tight Supply) $\rightarrow$ Long Signal
    • Contango (Oversupply) $\rightarrow$ Short/Neutral Signal
  3. Volatility Risk Premium (VRP): Uses the spread between Implied Volatility (OVX) and Realized Volatility to bias direction.

🧠 Risk Management: The Reaction Function

Unlike linear models, this strategy uses a Nonlinear Reaction Function to size positions. $$R(z) = z \cdot e^{0.5(1-z^2)}$$

  • Logic: As signal strength increases, position size increases. However, if the signal becomes too strong (>2 Sigma), the model reduces exposure to avoid "crowded trades" and mean reversion risk.

🛠️ Installation & Usage

1. Install Dependencies

pip install -r requirements.txt

### 2. Run the Strategy
```bash
python live_oil_strategy.py

## Sample Output
========================================
   QUANT OIL STRATEGY: 2025-11-24
========================================
Oil Price (WTI):   $58.84
Implied Vol (OVX): 36.30%
--------------------
Momentum Signal:   BEARISH
Carry (Structure): TIGHT/BACKWARDATION
--------------------
RAW SIGNAL STRENGTH: 0.20
FINAL POSITION SIZE: 0.35 (34.6%)
========================================

## ⚠️ Disclaimer
Educational Use Only. This software is for research and testing purposes. It is not financial advice. Trading commodities involves substantial risk of loss.

Based on concepts from "How Does Algorithmic Oil Trading Work?" by Quant Insider.

About

A systematic Momentum and Carry strategy for WTI Crude Oil.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages