Skip to content
TotalFinance

Options · @insiderfinance/totalfinance

@insiderfinance/totalfinance/options/local-volatility

import { … } from '@insiderfinance/totalfinance/options/local-volatility'
stable-by-law (pre-1.0; not a 1.0 stability guarantee)iface 9type 2fn 4const 1JSON ↗

Functions · 4

Values & facades · 1

Interfaces · 9

Types · 2

iface

DupireLocalVolatilityInput

#

One cohesive request for construction of a Dupire local-volatility function.

Signature
import type { DupireLocalVolatilityInput } from '@insiderfinance/totalfinance/options/local-volatility';

/** One cohesive request for construction of a Dupire local-volatility function. */
export interface DupireLocalVolatilityInput {
    impliedVolatility: ImpliedVolatilityFunction;
    market: LocalVolatilityMarket;
    options?: DupireOptions;
}
Fields, parameters and returned members (11)
Name · typeMeaning · unitRequired · default
impliedVolatilityImpliedVolatilityFunction—unitless by nameRequiredNo @default declared
impliedVolatility(strike)number—unitless by nameRequiredNo @default declared
impliedVolatility(timeToExpiryYears)number—unitless by nameRequiredNo @default declared
marketLocalVolatilityMarket—unitless by nameRequiredNo @default declared
market.dividendYieldnumber—decimal rate (0.05 = 5%)OptionalNo @default declared
market.riskFreeRatenumber—decimal rate (0.05 = 5%)RequiredNo @default declared
market.spotnumber—unitless by nameRequiredNo @default declared
optionsDupireOptions—unitless by nameOptionalNo @default declared
options.floorVolatilitynumber

Floor for local vol (default 1e-3) — also the clamp when a local arbitrage drives σ_loc² ≤ 0.

unitless by name
OptionalNo @default declared
options.logMoneynessStepnumber

Log-moneyness finite-difference step (default 0.01).

unitless by name
OptionalNo @default declared
options.timeStepYearsnumber

Time finite-difference step in years (default 1/365).

years (decimal)
OptionalNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

DupireOptions

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { DupireOptions } from '@insiderfinance/totalfinance/options/local-volatility';

export interface DupireOptions {
    /** Log-moneyness finite-difference step (default 0.01). */
    logMoneynessStep?: number;
    /** Time finite-difference step in years (default 1/365). */
    timeStepYears?: number;
    /** Floor for local vol (default 1e-3) — also the clamp when a local arbitrage drives σ_loc² ≤ 0. */
    floorVolatility?: number;
}
Fields, parameters and returned members (3)
Name · typeMeaning · unitRequired · default
floorVolatilitynumber

Floor for local vol (default 1e-3) — also the clamp when a local arbitrage drives σ_loc² ≤ 0.

unitless by name
OptionalNo @default declared
logMoneynessStepnumber

Log-moneyness finite-difference step (default 0.01).

unitless by name
OptionalNo @default declared
timeStepYearsnumber

Time finite-difference step in years (default 1/365).

years (decimal)
OptionalNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

type

ImpliedVolatilityFunction

#

A market implied-volatility surface as a function of strike and time-to-expiry (years).

Signature
import type { ImpliedVolatilityFunction } from '@insiderfinance/totalfinance/options/local-volatility';

/** A market implied-volatility surface as a function of strike and time-to-expiry (years). */
export type ImpliedVolatilityFunction = (strike: number, timeToExpiryYears: number) => number;
Fields, parameters and returned members (2)
Name · typeMeaning · unitRequired · default
(strike)number—unitless by nameRequiredNo @default declared
(timeToExpiryYears)number—unitless by nameRequiredNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

type

LocalVolatilityFunction

#

Local volatility as a function of underlying level and time (years).

Signature
import type { LocalVolatilityFunction } from '@insiderfinance/totalfinance/options/local-volatility';

/** Local volatility as a function of underlying level and time (years). */
export type LocalVolatilityFunction = (level: number, timeToExpiryYears: number) => number;
Fields, parameters and returned members (2)
Name · typeMeaning · unitRequired · default
(level)number—unitless by nameRequiredNo @default declared
(timeToExpiryYears)number—unitless by nameRequiredNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

LocalVolatilityGridSpecification

#

Grid specification for localVolatilityGrid: strictly-ascending level and time knots.

Signature
import type { LocalVolatilityGridSpecification } from '@insiderfinance/totalfinance/options/local-volatility';

/** Grid specification for {@link localVolatilityGrid}: strictly-ascending level and time knots. */
export interface LocalVolatilityGridSpecification {
    /** Underlying levels, ascending (e.g. 0.4·S₀ … 2.5·S₀). */
    levels: number[];
    /** Times in years, ascending (e.g. up to the longest expiry priced). */
    times: number[];
}
Fields, parameters and returned members (2)
Name · typeMeaning · unitRequired · default
levelsnumber[]

Underlying levels, ascending (e.g. 0.4·S₀ … 2.5·S₀).

unitless by name
RequiredNo @default declared
timesnumber[]

Times in years, ascending (e.g. up to the longest expiry priced).

unitless by name
RequiredNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

LocalVolatilityInput

#

Market inputs for a local-volatility MC price.

Signature
import type { LocalVolatilityInput } from '@insiderfinance/totalfinance/options/local-volatility';

/** Market inputs for a local-volatility MC price. */
export interface LocalVolatilityInput {
    spot: number;
    strike: number;
    timeToExpiryYears: number;
    riskFreeRate: number;
    dividendYield?: number;
}
Fields, parameters and returned members (5)
Name · typeMeaning · unitRequired · default
dividendYieldnumber—decimal rate (0.05 = 5%)OptionalNo @default declared
riskFreeRatenumber—decimal rate (0.05 = 5%)RequiredNo @default declared
spotnumber—unitless by nameRequiredNo @default declared
strikenumber—unitless by nameRequiredNo @default declared
timeToExpiryYearsnumber—years (decimal)RequiredNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

LocalVolatilityMarket

#

Market context the Dupire transform needs to convert strikes to moneyness.

Signature
import type { LocalVolatilityMarket } from '@insiderfinance/totalfinance/options/local-volatility';

/** Market context the Dupire transform needs to convert strikes to moneyness. */
export interface LocalVolatilityMarket {
    spot: number;
    riskFreeRate: number;
    dividendYield?: number;
}
Fields, parameters and returned members (3)
Name · typeMeaning · unitRequired · default
dividendYieldnumber—decimal rate (0.05 = 5%)OptionalNo @default declared
riskFreeRatenumber—decimal rate (0.05 = 5%)RequiredNo @default declared
spotnumber—unitless by nameRequiredNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

LocalVolatilityMonteCarloEstimateInput

#

Complete, assumption-light inputs for one raw local-volatility Monte-Carlo estimate.

Signature
import type { LocalVolatilityMonteCarloEstimateInput } from '@insiderfinance/totalfinance/options/local-volatility';

/** Complete, assumption-light inputs for one raw local-volatility Monte-Carlo estimate. */
export interface LocalVolatilityMonteCarloEstimateInput {
    type: OptionType;
    spot: number;
    strike: number;
    timeToExpiryYears: number;
    riskFreeRate: number;
    dividendYield: number;
    localVolatility: LocalVolatilityFunction;
    options: LocalVolatilityMonteCarloOptions;
}
Fields, parameters and returned members (18)

Loading 18 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

LocalVolatilityMonteCarloOptions

#

Public declaration. Read the signature and member contracts below; no additional behaviour is inferred.

Signature
import type { LocalVolatilityMonteCarloOptions } from '@insiderfinance/totalfinance/options/local-volatility';

export interface LocalVolatilityMonteCarloOptions extends MonteCarloSamplingOptions {
    /** Time steps per path (default 100). */
    steps?: number;
}
Fields, parameters and returned members (8)
Name · typeMeaning · unitRequired · default
antitheticboolean

Antithetic variates (pseudo only; ignored for QMC). Default true.

unitless by name
OptionalNo @default declared
brownianBridgeboolean

Brownian-bridge path ordering (QMC only; concentrates variance in the leading dimensions).

unitless by name
OptionalNo @default declared
confidencenumber

Confidence level for the interval (default 0.95).

unitless by name
OptionalNo @default declared
methodimport('@insiderfinance/totalfinance/options').MonteCarloMethod

Sampling method (default 'pseudo').

unitless by name
OptionalNo @default declared
pathsnumber

Number of paths (antithetic pairs when antithetic). Default 50_000.

unitless by name
OptionalNo @default declared
randomNumberGeneratorimport('@insiderfinance/totalfinance/options').MonteCarloRandomNumberGenerator

PRNG for method: 'pseudo' (default 'mulberry32').

unitless by name
OptionalNo @default declared
seednumber

Seed — required and echoed for reproducibility.

unitless by name
RequiredNo @default declared
stepsnumber

Time steps per path (default 100).

unitless by name
OptionalNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

LocalVolatilityMonteCarloResult

#

A local-volatility MC result enriched with the Monte-Carlo error statistics.

Signature
import type { LocalVolatilityMonteCarloResult } from '@insiderfinance/totalfinance/options/local-volatility';

/** A local-volatility MC result enriched with the Monte-Carlo error statistics. */
export interface LocalVolatilityMonteCarloResult extends PriceResult {
    monteCarlo: MonteCarloStatistics;
}
Fields, parameters and returned members (74)

Loading 74 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

iface

LocalVolatilityPriceMonteCarloRequest

#

One cohesive request for the validated local-volatility Monte-Carlo pricer.

Signature
import type { LocalVolatilityPriceMonteCarloRequest } from '@insiderfinance/totalfinance/options/local-volatility';

/** One cohesive request for the validated local-volatility Monte-Carlo pricer. */
export interface LocalVolatilityPriceMonteCarloRequest {
    type: OptionType;
    input: LocalVolatilityInput;
    localVolatility: LocalVolatilityFunction;
    options: LocalVolatilityMonteCarloOptions;
}
Fields, parameters and returned members (19)

Loading 19 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

fn

dupireLocalVolatility

#

Build the Dupire local-volatility function σ_loc(level, t) from an implied-vol surface. The returned function is pure and can be evaluated anywhere on the (level, t) plane; out-of-range or locally arbitrageable points are floored at floorVolatility rather than returning NaN.

Expert kernel form (model-subpath surface) — the curated root surface is localVolatility.fromImplied.

Signature
import { dupireLocalVolatility } from '@insiderfinance/totalfinance/options/local-volatility';

export declare function dupireLocalVolatility(input: DupireLocalVolatilityInput): LocalVolatilityFunction;
Fields, parameters and returned members (4)
Name · typeMeaning · unitRequired · default
(input)DupireLocalVolatilityInput—unitless by nameRequiredNo @default declared
(input).impliedVolatilityImpliedVolatilityFunction—unitless by nameRequiredNo @default declared
(input).marketLocalVolatilityMarket—unitless by nameRequiredNo @default declared
(input).optionsDupireOptions—unitless by nameOptionalNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

const

localVolatility

#

The local-volatility namespace — the grouped, discoverable surface over the flat local-volatility functions. localVolatility.fromImplied / localVolatility.grid / localVolatility.monteCarloPrice / localVolatility.monteCarloEstimate are the same functions; prefer the namespace over the deprecated flat exports.

Signature
import { localVolatility } from '@insiderfinance/totalfinance/options/local-volatility';

export declare const localVolatility: { readonly fromImplied: (input: DupireLocalVolatilityInput) => LocalVolatilityFunction; readonly grid: (localVolatility: LocalVolatilityFunction, specification: LocalVolatilityGridSpecification) => LocalVolatilityFunction; readonly monteCarloEstimate: (input: LocalVolatilityMonteCarloEstimateInput) => MonteCarloEstimate; readonly monteCarloPrice: (request: LocalVolatilityPriceMonteCarloRequest) => LocalVolatilityMonteCarloResult; };
Fields, parameters and returned members (57)

Loading 57 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

fn

localVolatilityGrid

#

Precompute a local-volatility function onto a (level × time) grid and return a fast bilinear-interpolating LocalVolatilityFunction. The exact dupireLocalVolatility does ~4 surface evaluations per call — far too slow to run inside a Monte-Carlo step loop — so cache it once on a grid and interpolate. Off-grid queries clamp to the nearest edge (a documented, no-NaN extrapolation).

Expert kernel form (model-subpath surface) — the curated root surface is localVolatility.grid.

Signature
import { localVolatilityGrid } from '@insiderfinance/totalfinance/options/local-volatility';

export declare function localVolatilityGrid(localVolatility: LocalVolatilityFunction, specification: LocalVolatilityGridSpecification): LocalVolatilityFunction;
Fields, parameters and returned members (4)
Name · typeMeaning · unitRequired · default
(localVolatility)LocalVolatilityFunction—unitless by nameRequiredNo @default declared
(specification)LocalVolatilityGridSpecification—unitless by nameRequiredNo @default declared
(specification).levelsnumber[]

Underlying levels, ascending (e.g. 0.4·S₀ … 2.5·S₀).

unitless by name
RequiredNo @default declared
(specification).timesnumber[]

Times in years, ascending (e.g. up to the longest expiry priced).

unitless by name
RequiredNo @default declared

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

fn

localVolatilityMonteCarloEstimate

#

Low-level kernel: local-volatility Monte-Carlo estimate of the discounted European payoff.

Expert kernel form (model-subpath surface) — the curated root surface is localVolatility.monteCarloEstimate.

Signature
import { localVolatilityMonteCarloEstimate } from '@insiderfinance/totalfinance/options/local-volatility';

export declare function localVolatilityMonteCarloEstimate(input: LocalVolatilityMonteCarloEstimateInput): MonteCarloEstimate;
Fields, parameters and returned members (18)

Loading 18 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.

fn

localVolatilityMonteCarloPrice

#

Price a European option under a local-volatility diffusion by Monte-Carlo. Pass a LocalVolatilityFunction (typically from dupireLocalVolatility); the result carries MC error statistics on result.mc.

Expert kernel form (model-subpath surface) — the curated root surface is localVolatility.monteCarloPrice.

Signature
import { localVolatilityMonteCarloPrice } from '@insiderfinance/totalfinance/options/local-volatility';

export declare function localVolatilityMonteCarloPrice(request: LocalVolatilityPriceMonteCarloRequest): LocalVolatilityMonteCarloResult;
Fields, parameters and returned members (27)

Loading 27 members…

Stability: stable-by-law (pre-1.0; not a 1.0 stability guarantee). Units come from declared names; “unitless by name” means the name alone does not establish a unit. See conventions and errors and warnings.