The legs array defines the individual option positions that make up your strategy structure.
Each leg represents a rule for selecting, sizing, and managing a specific option contract β for example, βsell a 25Ξ put 30 days from expiry each month.β
While the Global Settings section controls how the overall strategy behaves,
the Legs Array determines what you actually trade.
π§± Overview
Every TOM must contain at least one leg:
"legs": [
{
"id": "Leg #1",
"underlying_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",
"options_family_id": "IND.ES"
}
]
Each leg is evaluated and managed independently, unless you choose to synchronize them withinherit_first_leg_rolls: "yes" in the global settings.
βοΈ Leg Field Reference
| Field | Type | Required | Example | Description |
|---|---|---|---|---|
id | string | β | "Short Put" | A display name for the leg |
underlying_id | string | β | "IND.ES" | Symbol of the underlying asset (index, stock, or future) |
options_family_id | string | β | "IND.ES" | The option family identifier (often matches the underlying) |
type | "c" / "p" / "f"/ "s" | β | "p" | Option type: "c" = call, "p" = put, "f" = future, "s" - stock |
weight_type | enum | β | "notional" | Defines how leg size is calculated |
weight | number | β | -1 | Position size (negative = short, positive = long) |
expiry_dte_min | integer | β | 30 | Minimum days to expiry for entry |
expiry_nearest | string/int | β | "1" | Which qualifying expiry to select |
strike_type | enum | β | "delta" | Method for determining strike |
strike_value | number | β | 0.25 | Value used with strike_type |
period | enum | β | "month" | Which period to trade |
period_contract | enum/int | β | "All" | Which contracts within a period to trade |
π§© Field Details
id
A descriptive label for the leg.
Used for identification in analytics and reports.
Example: "Short Put", "Long Call Hedge", "Wing #2".
underlying_id
Symbol for the underlying asset whose options are being traded.
This must match a valid instrument code in the platform (e.g., IND.ES, COM.TTF).
options_family_id
Defines which option family to use.
Monthly options usually match the underlying_id.
For weekly options for example it can have a suffix defining another family id, for example: IND.ES_W
type
Specifies whether the leg is a call ("c"), put ("p"), future ("f") or stock ("s")
weight_type
Determines how position size is calculated:
| Value | Meaning |
|---|---|
"notional" | The position size is automatically calculated based on your account equity and the current price of the underlying. In other words, TOM figures out how many contracts would represent that fraction of your total equity. |
"premium" | Sizes the trade by the optionβs premium, not the underlyingβs value. |
"lots" | Constant number of lots per trade |
"lots_per_k" | Constant number of lots per 1k$ in equity per trade |
"lots_per_m" | Constant number of lots per 1m$ in equity per trade |
π‘ Use
"notional"for most systematic tests, since it maintains proportional risk through time.
weight
The legβs signed size.
Negative values (
-1,-2) β short exposure (sell to open)Positive values (
1,2) β long exposure (buy to open)
Example:"weight": -1 with "weight_type": "notional" means short exposure equal to 1Γ notional of current equity.
expiry_dte_min
The minimum Days-to-Expiry when selecting contracts.
TOM finds the nearest expiry at or above this threshold.
Example:
If expiry_dte_min = 30 and the available expiries are 15, 45, and 75 days, the engine will consider the 45 and 75-day expiry for the selection.
expiry_nearest
Specifies which qualifying expiry to pick once the DTE filter is applied:
"1"β the nearest eligible expiry (most common)"2"β the second-nearest"3"β the third-nearest, etc.
Example:expiry_dte_min = 30 and expiry_nearest = "2" means the second expiry above 30 DTE.
strike_type and strike_value
These two fields work together to select the option strike.
strike_type | Interpretation of strike_value | Example |
|---|---|---|
"delta" | Target option delta | 0.25 β 25Ξ put |
"mny" | Ratio of strike to underlying price | 0.95 β 5% below the underlying |
"logmny" | Log of ratio of strike to underlying price | 0.05 β 5% above the underlying in log terms |
"percent" | Target premium of options as a % of the underlying price | 2 β strike so premium is closest to 2% of the current underlying price |
Example:
"strike_type": "delta",
"strike_value": 0.25
Selects an option closest to 25Ξ at entry.
period and period_contract
Define when a new structure is entered if no signals are used.
| Field | Example | Meaning |
|---|---|---|
period | "Month" | Period used (Month/Quarter/Crop/Season/Half-Year/Year) If anything but Month is selected them TOM will construct a synthetic option for this period and will trade it. For example entering to a Quarter will trigger 3 simultaneous entires. |
period_contract | "Jan, Mar, Jun, Sep" | Select Periods contracts to be included in the backtest. Any other backtesting contracts will be excluded from the calculations. |
Example:
"period": "month",
"period_contract": "Jan, Mar, Jun, Sep"
β Backtest a strategy only on Jan, Mar, Jun, Sep contracts.
π§ Multi-Leg Structures
When you include multiple legs in the array, TOM treats them as a linked structure β a combined position made of multiple option legs.
Example: Short Put Spread
"legs": [
{
"id": "Short Put",
"underlying_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",
"options_family_id": "IND.ES"
},
{
"id": "Long Put",
"underlying_id": "IND.ES",
"type": "p",
"weight_type": "notional",
"weight": 1,
"expiry_dte_min": 30,
"expiry_nearest": "1",
"strike_type": "delta",
"strike_value": 0.05,
"period": "month",
"period_contract": "All",
"options_family_id": "IND.ES"
}
]
This creates a 25Ξ short put hedged with a 5Ξ long put, forming a vertical spread.
π Rolls and Synchronisation
Each leg rolls independently when its DTE threshold is reached unless:
Global
inherit_first_leg_rolls = "yes"β all legs roll together based on the first legβs schedule.You explicitly define leg-level DTE roll logic.
This ensures consistency for multi-leg strategies like spreads and condors.
Comments
0 comments
Please sign in to leave a comment.