Skip to main content

Options Valuation Model

New in v3

Options valuation functions let you project greeks and PnL at future time anchors or specific DTEs. The options valuation model is a Black-Scholes-Merton (BSM) model which uses implied volatilities from the legs to be used to extract Greeks and PnL at future dates.

The solver uses the option valuation model to scan through a range of underlying prices to find minima, maxima, or roots (zero crossings) of selected metrics.

The selected metric to return can be a value (profit or greek) or the underlying price (strike) at the given criteria.

These functionality allows you to pinpoint places on the Risk Graph and extract values for use in your strategy logic.

Practical example

Consider you would like to extract the Maximal Profit and the break-even points of a calendar structure. You can find these marked on the picture.

Risk Graph

The following code can be used to extract the values of interest:

  "Entry": {
...
"VarDefines": {
"breakeven_lower": "options.model_solver(position, leg_short_call_dte, underlying_price * 0.5, underlying_price * 2, pnl, zero, return_price)",
"breakeven_upper": "options.model_solver(position, leg_short_call_dte, underlying_price * 2, underlying_price * 0.5, pnl, zero, return_price)",
"max_win": "options.model_solver(position, leg_short_call_dte, underlying_price * 2, underlying_price * 0.5, pnl, maximize, return_value)",
"max_loss": "options.model_solver(position, leg_short_call_dte, underlying_price * 2, underlying_price * 0.5, pnl, minimize, return_value)"
}
}

After running the strategy, we can confirm the variables captured in the variable we defined

VariablesTable

The above demonstration is shown in the [FEAT-OptionValuation] built-in template.

tip

It's faster to use options.model as it evaluates a single point. Use options.model_solver only when you need to find minima, maxima, or roots over a price range.

Module prototypes

Functions

SignatureDescription
options.model(target, dteDaysOrAnchor, underlyingPrice, metric[, model_params]) -> numberEvaluate position/leg at a time anchor or DTE using a scenario underlying price and return the selected metric
options.model_solver(target, dteOrKey, start, end, metric, goal, result[, solver_params]) -> numberScan a price range to minimize/maximize/zero a metric and return value or price per result

Targets

NameDescription
positionEvaluate all open and pending legs of the position
leg_<name>Evaluate a specific leg by name (e.g., leg_short_call)

Time Anchors

NameDescription
at_expEvaluate at the leg’s/position’s expiration(s)
first_expEarliest expiration among the selected legs
last_expLatest expiration among the selected legs
nowCurrent backtest time (DTE=0)

Metrics

NameDescription
pnlProjected profit and loss
deltaSensitivity to underlying price
gammaRate of change of delta
thetaTime decay
vegaSensitivity to volatility
wvegaWeighted vega using option DTE
rhoSensitivity to interest rates

Goals

NameDescription
minimizeFind the minimum of the metric over the price range
maximizeFind the maximum of the metric over the price range
zero/rootFind the price where the metric crosses zero (root)

Result

NameDescription
return_valueReturn the metric value at the solution
return_priceReturn the underlying price at the solution (alias: strike)
strikeAlias for return_price

Parameters at a Glance

  • target: position or leg_<name>
  • dteDaysOrAnchor / dteOrKey: non‑negative DTE days or a time anchor (at_exp, first_exp, last_exp, now)
  • metric: one of pnl, delta, gamma, theta, vega, wvega, rho
  • goal: one of minimize, maximize, zero/root (for solver)
  • result: return_value or return_price/strike (for solver)
  • model_params / solver_params: optional tuning parameters (leave empty for defaults)

Usage Notes

  • Use options.model for point evaluations at a given time and scenario price. Runs faster than options.model_solver
  • Use options.model_solver to scan a price range and extract a price or value at the optimum/zero. Takes multiple iterations over the options.model call. Use it only when required.
  • Swapping the start and end parameters in options.model_solver will reverse the scan direction.
  • For visual exploration of projected risk and greeks, see Position Monitor.