The hedge section defines how your strategy automatically offsets risk exposure — typically delta — during a backtest.
While most TOM strategies focus on option legs, hedging introduces a second layer of control: systematic adjustment of directional risk using the underlyings.
🧭 What the Hedge Section Does
Hedging enables TOM to open and close positions (underlying futures or stocks) dynamically, thereby maintaining a target delta or other exposure metric.
This can simulate the actions of a trader or algorithm that continuously manages risk rather than holding naked option exposure.
If hedge is omitted or set to "no", no hedge logic is applied, and your structures run unhedged.
⚙️ Example
Here’s a minimal TOM hedge block:
"hedge": {
"type": "delta",
"freq": "weekly",
"expiry_dte_min": 1,
"expiry_nearest": "1",
"source": "underlying"
}
This configuration creates a delta-based hedge that rebalances weekly, using the underlying as the hedging instrument.
🧩 Hedge Parameters
| Field | Type | Example | Description |
|---|---|---|---|
type | string | "delta" | Type of hedge calculation or exposure to neutralize. |
freq | string | "daily", "weekly", "monthly" | How often to check and adjust the hedge |
expiry_dte_min | number | 1 | Minimum DTE of hedge instrument (if future used) |
expiry_nearest | number | 1 | Which expiry to select if using futures for hedge |
source | string | "underlying", "front" | Instrument used for hedge (e.g., underlying future or front future) |
type
Defines what risk dimension the hedge targets.
Currently supported values:
| Value | Meaning |
|---|---|
"delta" | Neutralize delta exposure |
"vega" | Adjust exposure to implied volatility (in development) |
"gamma" | Balance convexity risk (in development) |
freq
Determines how often the hedge is recalculated and executed.
| Value | Description |
|---|---|
"daily" | Rebalance at every session close |
"weekly" | Rebalance once per week |
"monthly" | Rebalance once per month |
expiry_dte_min and expiry_nearest
Used only if the hedge instrument is a future, not an underlying.
They follow the same logic as leg selection:
expiry_dte_min: minimum DTE for selecting the hedge futureexpiry_nearest: which qualifying expiry to use ("1"= nearest)
source
Specifies what instrument the hedge is executed on.
| Value | Meaning |
|---|---|
"underlying" | Uses the underlying future of every option (if underlying is a future) |
"front" | Uses a front future for hedge |
🧠 How Hedge Logic Works
Compute exposure:
After each recalculation period (freq), the engine evaluates the total delta (or other target) of the active legs.Determine hedge need:
If the portfolio delta exceeds the neutral threshold, TOM opens or adjusts a hedge position in the specifiedsource.Rebalance:
On the next hedge event, TOM closes or modifies hedge exposure to realign with the target.Expiration management:
If the hedge uses an option instrument, the engine automatically rolls it according toexpiry_dte_minandexpiry_nearest.
🧾 Full Example: Hedged Structure
{
"strategy_id": "Delta-Hedged Short Put",
"signals": "no",
"initial_equity": 100000,
"equity_type": "compounding",
"from_date": "2015-01-01",
"to_date": "2025-01-01",
"option_expiry_type": "Standard + Serial",
"hedge": {
"type": "delta",
"freq": "weekly",
"expiry_dte_min": 1,
"expiry_nearest": "1",
"source": "underlying"
},
"legs": [
{
"id": "Short Put",
"underlying_id": "IND.ES",
"options_family_id": "IND.ES",
"type": "p",
"weight_type": "notional",
"weight": -1,
"expiry_dte_min": 30,
"expiry_nearest": "1",
"strike_type": "delta",
"strike_value": 0.25,
"period": "month",
"period_contract": "All"
}
]
}
Comments
0 comments
Please sign in to leave a comment.