9.6

Trading with Pricing Models

PYTHON PLUGIN Commodities Model

Description

Strategy 9.6: OU mean-reversion model for commodity pricing

Strategy Logic

Strategy 9.6: OU mean-reversion pricing model. Fit an Ornstein-Uhlenbeck process: dX = kappa * (a - X) * dt + sigma * dW to log-prices. Estimate kappa (speed of mean reversion), a (long-run mean), sigma via OLS on the discretised equation: X(t) - X(t-1) = kappa * a * dt - kappa * X(t-1) * dt + eps Compare model equilibrium price to market price: if market < model => buy; if market > model => sell.

Parameters

Parameter Default Value Type
ou_lookback 252 int
z_entry 1.5 float
z_exit 0.5 float

Risk Configuration

Risk Parameter Value
Max Position Pct 8.0%
Stop Loss Pct 6.0%
Take Profit Pct 12.0%
Max Drawdown Pct 15.0%