← About me & projects
Stage 04 · derivatives + RL

GBM options agent

Can the agent trade options it prices itself?

The agent prices one-month SPY options with a geometric Brownian motion model, forecasts volatility five ways, and buys or sells calls and puts under margin rules and a crash filter. Three training episodes, each tested out of sample from late 2021 on a $100k account.

+59%final episode vs SPY +80%
20%max drawdown vs 25%
0.74Sharpe vs SPY 0.76
168 / 168trades were short puts

How it works

  1. Model the price. GBM fitted by maximum likelihood, with diagnostics showing where fat tails and crashes break it.
  2. Forecast volatility. Historical, EWMA, GARCH(1,1), HAR-RV and VIX, refitted walk-forward and scored on the next 21 days.
  3. Price and verify. Monte Carlo with antithetic variates, checked against Black-Scholes; Greeks checked against finite differences.
  4. Find the edge. Compare the model’s expected payoff with the market price at implied volatility.
  5. Trade. Six actions: hold, buy or sell a call or put, close. Longs pay the ask, shorts collect the bid and post Reg-T-style margin.
  6. Control risk. At most six contracts and three naked shorts, forced buy-backs on margin calls, and a crash filter that blocks new shorts in falling, high-volatility markets.

Results

Histogram of daily SPY log returns against the fitted normal, and a normal Q-Q plot
gbm_options_rl_agent.ipynb · GBM fit

Does GBM fit? Not in the tails

Daily SPY log returns are more peaked than the fitted normal, with far heavier tails: the Q-Q plot bends away from the line at both ends, out to about −10 and +11 standard units. GBM is a useful pricing model, but it understates crash risk, which matters for a strategy that sells puts.

Monte Carlo price of an at-the-money 21-day call converging to the Black-Scholes value
gbm_options_rl_agent.ipynb · Monte Carlo pricing

Pricing, checked against Black-Scholes

For an at-the-money 21-day call (spot $735.29, 17.4% volatility), both Monte Carlo estimates converge to the Black-Scholes value of $16.00. The antithetic version gets there with fewer paths and a tighter 95% interval, which is why the agent uses it.

Black-Scholes delta, gamma, vega and theta for calls and puts against spot
gbm_options_rl_agent.ipynb · Greeks

The Greeks the agent trades with

Delta, gamma, vega and theta for 21-day options struck at $735 (17.4% volatility). Gamma and vega peak at the strike, and theta is most negative there: an at-the-money option sold short earns the most time decay and carries the most sensitivity to a sharp move. The Greeks were checked against finite differences before the agent used them.

Volatility forecasts versus realized and the variance risk premium
gbm_options_rl_agent.ipynb · section 3

Options were usually priced for more volatility than arrived

HAR-RV, GARCH and VIX track every volatility spike from 2010 to 2026. Implied volatility exceeded what followed on 85% of days, by 3.8 points on average: the premium option sellers collect.

$40k$80k$120k$160k$200k20222023202420252026SPY +80%Ep 3 +59%Ep 2 +42%Ep 1 −44%
Daily account equity, marked to market · options_agent_equity_ep1–3.csv · SPY is price only

Three episodes, one lesson: training found the put seller

Ep 1Ep 2Ep 3SPY
Total return−44%+42%+59%+80%
CAGR−10.9%7.1%9.6%12.4%
Volatility31.3%25.3%13.6%17.2%
Sharpe-0.220.400.740.76
Max drawdown65%43%20%25%
Trades · win rate293 · 41%321 · 59%168 · 79%—

Each episode is the same network saved at a later stage of training, run on the same unseen 2021–2026 data. Episode 1 mostly bought puts and sold calls (231 of 293 trades) and lost 44%. Episode 2 split between long calls (168) and short puts (151). Episode 3 sold only puts and was the best on every measure.

Episode 3 still trails SPY’s +80%, but with lower volatility and a smaller drawdown, for a Sharpe ratio close to the index’s.

Account equity and drawdown of the DQN agent, a GBM-edge rule, a random policy and SPY
gbm_options_rl_agent.ipynb · out-of-sample backtest

Against simple rules

DQN agent (ep 3)GBM-edge ruleRandom policySPY
Total return+59%−1.6%−39.0%+80%
Volatility13.6%22.4%14.9%17.2%
Sharpe0.740.10−0.580.76
Max drawdown20%46%49%25%

The GBM-edge rule simply trades whichever option shows the largest model edge, with no learning. It made 301 trades, mostly long calls, won about half of them, and ended slightly down with a 46% drawdown. A random policy lost 39%. Pricing an edge is not enough on its own: the agent learned which edges to act on, and that the reliable one was selling puts.

PositionEp 1Ep 2Ep 3
Short Put38 · +$3,458151 · +$44,729168 · +$59,033
Short Call116 · −$5,4752 · +$224—
Long Call24 · −$158168 · −$3,327—
Long Put115 · −$42,070——
All293 · −$44,244321 · +$41,627168 · +$59,033

What it learned: sell puts

Trades and realized P&L by position. Short puts made money in every episode; long puts cost episode 1 $42,070. By the final episode the agent sold a put on every trade and won 79% of them: the variance risk premium at work.

The cost of selling shows in falling markets: September 2022, and the end of the test, when the last 3 puts lost $9,568 as SPY dropped. The trading desk replays every trade of all three episodes.

How I tested this

Data
Daily SPY, VIX (as the implied-volatility proxy) and the 13-week T-bill rate.
Out-of-sample test
Trained on earlier years; tested from October 2021 to November 2026 on a $100k account. Three saved training episodes are each run on the same unseen period.
Costs
Options are priced with Black–Scholes at the VIX level plus or minus 1 volatility point, so buyers pay the ask and sellers receive the bid; shorts post Reg-T-style margin.
What this does not show
Prices are model prices from VIX, not historical option quotes for each strike, and SPY is compared on price only (no dividends). Episode 3 is the final policy, but it is still one training run.

Takeaways

  • Implied volatility usually runs high. Buying options tends to overpay; selling collects a premium for bearing crash risk.
  • Training changes the strategy, not just the score. The same network went from −44% buying puts to +59% selling them across three episodes.
  • Every number reconciles. In every episode, final account equity equals $100k plus the trade log’s P&L to the cent: +$59,033 in episode 3.

In the repository

View on GitHub: damion-m/Quantitative-Strategies

gbm_options_rl_agent.ipynboptions_dqn_ep1–3.kerasoptions_agent_trade_log_ep1–3.csvoptions_agent_equity_ep1–3.csvgbm-options-rl-agent-design.mdfunc_lib.py