# Deep Hedging Eval

> Evaluates a model's ability to learn optimal dynamic hedging strategies for financial derivatives under discrete trading and varying risk preferences. The protocol simulates market paths using a Heston stochastic volatility model and trains a neural network to minimize a convex risk measure of the terminal hedging error. Performance is assessed out-of-sample against a theoretical benchmark. Use when the user wants to benchmark on Discretized Heston model, or asks about evaluating this task. Reports Average Value at Risk (AVaR) / Conditional Value at Risk (CVaR).

- Skill: `qhjqhj00/deep-hedging-eval` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/deep-hedging-eval`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/deep-hedging-eval/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: qhjqhj00 (https://skillmd.com/u/qhjqhj00)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/qhjqhj00/deep-hedging-eval

---


# deep-hedging-eval

> Deep Hedging — Hans Buehler et al. (arXiv:1802.03042, 2018)

## What this evaluates

Evaluates a model's ability to learn optimal dynamic hedging strategies for financial derivatives under discrete trading and varying risk preferences. The protocol simulates market paths using a Heston stochastic volatility model and trains a neural network to minimize a convex risk measure of the terminal hedging error. Performance is assessed out-of-sample against a theoretical benchmark.

## Datasets

- **Discretized Heston model** — total ?; splits: train (-1), test (-1)

## Metrics

- `Average Value at Risk (AVaR) / Conditional Value at Risk (CVaR)` **(primary)** — range: other
  - Computed as $\rho(X) = \frac{1}{1-\alpha}\int_{0}^{1-\alpha}\mathrm{VaR}_{\gamma}(X)\mathrm{d}\gamma$, where $X$ is the terminal hedging error (P&L) and $\alpha \in [0,1)$ controls risk aversion. Measures the expected loss in the worst $(1-\alpha)$ fraction of scenarios.

## Input / output format

**Input**: Sampled trajectories of hedging instruments $S$, payoff $Z$, transaction cost structure $c$, and risk measure $\rho$.

**Output**: Dynamic hedging strategy $\delta^\theta$, i.e., positions in each instrument at each discrete time step $k=0,\dots,n$.

## Scoring recipe

```python
def score(predictions, gold):
    # predictions: hedging strategy delta at each step
    # gold: payoff Z, initial price q, price paths S
    pnl = gold['q'] - gold['Z'] + sum(delta_k * (S[k+1] - S[k]) for k in range(n))
    # Compute CVaR at level alpha
    var_gamma = np.percentile(pnl, alpha * 100)
    tail = pnl[pnl <= var_gamma]
    cvar = np.mean(tail) / (1 - alpha)
    return cvar
```

## Common pitfalls

- The risk measure parameter $\alpha$ must be consistent between training and evaluation; changing $\alpha$ changes the optimal strategy.
- Out-of-sample evaluation requires a separate set of simulated trajectories (e.g., $10^6$) to avoid overfitting to the training paths.
- The benchmark 'model hedge' assumes continuous-time trading or uses exact Greeks, which is not feasible in discrete time without transaction costs.

## Evidence (verbatim from paper)

> the risk measure $\rho$ is chosen as the average value at risk (also called conditional value at risk or expected shortfall), defined for any random variable $X$ by $\rho(X):=\frac{1}{1-\alpha}\int_{0}^{1-\alpha}\mathrm{VaR}_{\gamma}(X)\mathrm{d}\gamma$ for some $\alpha\in[0,1)$, where $\mathrm{VaR}_{\gamma}(X):=\inf{m\in\mathbb{R}\,:\mathbb{P}(X<-m)\leq\gamma}$. As an out-of-sample test, one can then simulate another set of sample trajectories (here $10^{6}$) and evaluate the terminal hedging errors $q-Z+(\delta^{H}\cdot S)_{T}$

## Citation

```bibtex
@misc{buehler2018deephedging,
  title={Deep Hedging},
  author={Hans Buehler et al.},
  year={2018},
  note={arXiv:1802.03042}
}
```

- arXiv: 1802.03042

