The finance developer workbenchSearch the reference Development · 0.1.4 · unpublished

Public API / @insiderfinance/totalfinance

@insiderfinance/totalfinance/risk/scenario

import from '@insiderfinance/totalfinance/risk/scenario'

Every public export in this entry point, including type-only declarations. Search by name or concept.

Jump to an export (21)

PnlAttribution · Position · PositionGreeks · PositionScenarioResult · ResolvedGridShock · Scenario · ScenarioGridInput · ScenarioGridResult · ScenarioResult · Shock · ShockFactor · ShockKind · StressOptions · StressTestInput · StressTestResult · TaylorPnlResult · scenario · scenarioGrid · shock · stressTest · taylorPnl

interface

PnlAttribution

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export interface PnlAttribution {
    total: number;
    delta: number;
    gamma: number;
    vega: number;
    theta: number;
    rho: number;
    /** Second-order spot–vol cross term: `vanna·dS·dσ` (0 when `vanna` is absent). */
    vanna: number;
    /** Second-order vol-convexity term: `½·vomma·dσ²` (0 when `vomma` is absent). */
    vomma: number;
    /** Second-order spot–time cross term: `charm·dS·dt` (0 when `charm` is absent). */
    charm: number;
    /** Second-order vol–time cross term: `veta·dσ·dt` (0 when `veta` is absent). */
    veta: number;
    /** Second-order vol–rate cross term: `vera·dσ·dr` (0 when `vera` is absent). */
    vera: number;
    /** Second-order spot–rate cross term: `deltaRate·dS·dr` (0 when `deltaRate` is absent). */
    deltaRate: number;
    /** Second-order time–rate cross term: `thetaRate·dt·dr` (0 when `thetaRate` is absent). */
    thetaRate: number;
    /** Second-order rate-convexity term: `½·rhoConvexity·dr²` (0 when `rhoConvexity` is absent). */
    rhoConvexity: number;
    /** Second-order time-convexity term: `½·thetaConvexity·dt²` (0 when `thetaConvexity` is absent). */
    thetaConvexity: number;
    /** First-order dividend-carry term: `φ·dq` (0 when `phi` is absent). */
    phi: number;
    /** Residual = repriced − value − (the Greek terms); 0 for a pure Taylor reprice. */
    other: number;
}
Fields, parameters & returned members (17)
Name / typeMeaning & unitOptional / default
charm
number
Second-order spot–time cross term: `charm·dS·dt` (0 when `charm` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
delta
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
deltaRate
number
Second-order spot–rate cross term: `deltaRate·dS·dr` (0 when `deltaRate` is absent).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
gamma
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
other
number
Residual = repriced − value − (the Greek terms); 0 for a pure Taylor reprice.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
phi
number
First-order dividend-carry term: `φ·dq` (0 when `phi` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
rho
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
rhoConvexity
number
Second-order rate-convexity term: `½·rhoConvexity·dr²` (0 when `rhoConvexity` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
theta
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
thetaConvexity
number
Second-order time-convexity term: `½·thetaConvexity·dt²` (0 when `thetaConvexity` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
thetaRate
number
Second-order time–rate cross term: `thetaRate·dt·dr` (0 when `thetaRate` is absent).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
total
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
vanna
number
Second-order spot–vol cross term: `vanna·dS·dσ` (0 when `vanna` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
vega
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
vera
number
Second-order vol–rate cross term: `vera·dσ·dr` (0 when `vera` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
veta
number
Second-order vol–time cross term: `veta·dσ·dt` (0 when `veta` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
vomma
number
Second-order vol-convexity term: `½·vomma·dσ²` (0 when `vomma` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

Position

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export interface Position<T = unknown> {
    id?: string;
    /** Number of units held (signed). Default 1. */
    quantity?: number;
    /**
     * Contract multiplier applied to per-unit value and Greeks (100 for a listed US equity option
     * whose Greeks are per share and whose `quantity` is in contracts). Default 1. Applied by
     * `aggregateGreeks`, `stressTest` and the book tools; disclosed in their assumptions.
     */
    multiplier?: number;
    greeks?: PositionGreeks;
    /**
     * Current mark per unit — the BASE a custom `reprice` differences against (H11). When `reprice`
     * is supplied, either this or `greeks.value` must be present; the base is never assumed 0.
     */
    value?: number;
    data?: T;
}
Fields, parameters & returned members (28)
Name / typeMeaning & unitOptional / default
data
T

unitless by name
Optional
No @default declared; consult the signature and description.
greeks
PositionGreeks

unitless by name
Optional
No @default declared; consult the signature and description.
greeks.charm
number
∂Δ/∂T per year of time-to-expiry — the options package's `charm` (delta drift as expiry recedes). Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.color
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.delta
number
∂V/∂S per $1 of spot.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.deltaRate
number
∂²V/∂S∂r per $ per 1% rate — the spot-rate cross (`∂Δ/∂r`). Optional.
decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
greeks.gamma
number
∂²V/∂S² per $1².
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.lambda
number | null
Accepted from a whole `ExtendedGreeks` (`null` = elasticity undefined); not used by the expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.phi
number
φ = ∂V/∂q per 1% dividend yield — the options package's `phi` (dividend rho). Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.rho
number
∂V/∂r per 1% rate (0.01), as the options package reports it.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.rhoConvexity
number
∂²V/∂r² per (1%)² — rho convexity. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.speed
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.spot
number
Reference spot, required to resolve percent spot shocks into price moves.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.theta
number
∂V/∂t per CALENDAR DAY (negative for a long option), as the options package reports it.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.thetaConvexity
number
∂²V/∂t² per calendar day² — theta convexity (theta's own bleed). Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.thetaRate
number
∂²V/∂t∂r per calendar day per 1% rate — the time-rate cross (`∂Θ/∂r`). Optional.
decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
greeks.ultima
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.value
number
Current mark value of the position (per unit).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
greeks.vanna
number
∂²V/∂S∂σ per 1.00 σ per $ — the options package's `vanna`. Optional — omitted ⇒ its term is 0.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.vega
number
∂V/∂σ per 1 volatility point (0.01), as the options package reports it.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.vera
number
∂²V/∂σ∂r per 1.00 σ per 1.00 rate — the options package's `vera`. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.veta
number
∂vega/∂T per year of time-to-expiry, vega per 1.00 σ — the options package's `veta`. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.vomma
number
∂²V/∂σ² per 1.00 σ² — the options package's `vomma`. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.zomma
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
id
string

unitless by name
Optional
No @default declared; consult the signature and description.
multiplier
number
Contract multiplier applied to per-unit value and Greeks (100 for a listed US equity option whose Greeks are per share and whose `quantity` is in contracts). Default 1. Applied by `aggregateGreeks`, `stressTest` and the book tools; disclosed in their assumptions.
unitless by name
Optional
No @default declared; consult the signature and description.
quantity
number
Number of units held (signed). Default 1.
unitless by name
Optional
No @default declared; consult the signature and description.
value
number
Current mark per unit — the BASE a custom `reprice` differences against (H11). When `reprice` is supplied, either this or `greeks.value` must be present; the base is never assumed 0.
unitless by name
Optional
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

PositionGreeks

A position's Greeks in TotalFinance's ONE unit system — the units `@insiderfinance/totalfinance/options` and `@insiderfinance/totalfinance/strategy` report (`DEFAULT_GREEK_UNITS`), so a `blackScholesGreeks(...)` / `Position.value().greeks` object spreads straight in: `{ value, spot, ...greeks }`. Per unit of the position (per share of one contract when `Position.multiplier` scales it): - `delta` per $1 of spot, `gamma` per $1²; - `theta` per CALENDAR DAY; `vega` per 1 volatility POINT (0.01); `rho` per 1% rate (0.01); `phi` per 1% dividend yield; - the second-order Greeks in the options package's own units: `vanna` ∂Δ/∂σ and `vomma` ∂²V/∂σ² per 1.00 σ, `charm` = ∂Δ/∂T and `veta` = ∂vega/∂T per YEAR of time-to-expiry (vega per 1.00 σ), `vera` per 1.00 σ per 1.00 rate; - the rate cross terms the options package does not emit follow the first-order conventions: `deltaRate` per 1% rate, `thetaRate` per day per 1% rate, `rhoConvexity` per (1%)², `thetaConvexity` per day². The Taylor engine converts to the raw per-year / per-1.00 form internally, in one place. Third-order Greeks (`speed`, `color`, `zomma`, `ultima`) and `lambda` are accepted so a whole `ExtendedGreeks` can be passed, and are not used by the second-order expansion.

/**
 * A position's Greeks in TotalFinance's ONE unit system — the units `@insiderfinance/totalfinance/options` and
 * `@insiderfinance/totalfinance/strategy` report (`DEFAULT_GREEK_UNITS`), so a `blackScholesGreeks(...)` /
 * `Position.value().greeks` object spreads straight in: `{ value, spot, ...greeks }`.
 *
 * Per unit of the position (per share of one contract when `Position.multiplier` scales it):
 *   - `delta` per $1 of spot, `gamma` per $1²;
 *   - `theta` per CALENDAR DAY; `vega` per 1 volatility POINT (0.01); `rho` per 1% rate (0.01);
 *     `phi` per 1% dividend yield;
 *   - the second-order Greeks in the options package's own units: `vanna` ∂Δ/∂σ and `vomma` ∂²V/∂σ²
 *     per 1.00 σ, `charm` = ∂Δ/∂T and `veta` = ∂vega/∂T per YEAR of time-to-expiry (vega per 1.00 σ),
 *     `vera` per 1.00 σ per 1.00 rate;
 *   - the rate cross terms the options package does not emit follow the first-order conventions:
 *     `deltaRate` per 1% rate, `thetaRate` per day per 1% rate, `rhoConvexity` per (1%)²,
 *     `thetaConvexity` per day².
 * The Taylor engine converts to the raw per-year / per-1.00 form internally, in one place. Third-order
 * Greeks (`speed`, `color`, `zomma`, `ultima`) and `lambda` are accepted so a whole `ExtendedGreeks`
 * can be passed, and are not used by the second-order expansion.
 */
export interface PositionGreeks {
    /** Current mark value of the position (per unit). */
    value: number;
    /** Reference spot, required to resolve percent spot shocks into price moves. */
    spot?: number;
    /** ∂V/∂S per $1 of spot. */
    delta?: number;
    /** ∂²V/∂S² per $1². */
    gamma?: number;
    /** ∂V/∂σ per 1 volatility point (0.01), as the options package reports it. */
    vega?: number;
    /** ∂V/∂t per CALENDAR DAY (negative for a long option), as the options package reports it. */
    theta?: number;
    /** ∂V/∂r per 1% rate (0.01), as the options package reports it. */
    rho?: number;
    /** ∂²V/∂S∂σ per 1.00 σ per $ — the options package's `vanna`. Optional — omitted ⇒ its term is 0. */
    vanna?: number;
    /** ∂²V/∂σ² per 1.00 σ² — the options package's `vomma`. Optional. */
    vomma?: number;
    /** ∂Δ/∂T per year of time-to-expiry — the options package's `charm` (delta drift as expiry recedes). Optional. */
    charm?: number;
    /** ∂vega/∂T per year of time-to-expiry, vega per 1.00 σ — the options package's `veta`. Optional. */
    veta?: number;
    /** ∂²V/∂σ∂r per 1.00 σ per 1.00 rate — the options package's `vera`. Optional. */
    vera?: number;
    /** ∂²V/∂S∂r per $ per 1% rate — the spot-rate cross (`∂Δ/∂r`). Optional. */
    deltaRate?: number;
    /** ∂²V/∂t∂r per calendar day per 1% rate — the time-rate cross (`∂Θ/∂r`). Optional. */
    thetaRate?: number;
    /** ∂²V/∂r² per (1%)² — rho convexity. Optional. */
    rhoConvexity?: number;
    /** ∂²V/∂t² per calendar day² — theta convexity (theta's own bleed). Optional. */
    thetaConvexity?: number;
    /** φ = ∂V/∂q per 1% dividend yield — the options package's `phi` (dividend rho). Optional. */
    phi?: number;
    /** Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion. */
    speed?: number;
    /** Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion. */
    color?: number;
    /** Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion. */
    zomma?: number;
    /** Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion. */
    ultima?: number;
    /** Accepted from a whole `ExtendedGreeks` (`null` = elasticity undefined); not used by the expansion. */
    lambda?: number | null;
}
Fields, parameters & returned members (22)
Name / typeMeaning & unitOptional / default
charm
number
∂Δ/∂T per year of time-to-expiry — the options package's `charm` (delta drift as expiry recedes). Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
color
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
delta
number
∂V/∂S per $1 of spot.
unitless by name
Optional
No @default declared; consult the signature and description.
deltaRate
number
∂²V/∂S∂r per $ per 1% rate — the spot-rate cross (`∂Δ/∂r`). Optional.
decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
gamma
number
∂²V/∂S² per $1².
unitless by name
Optional
No @default declared; consult the signature and description.
lambda
number | null
Accepted from a whole `ExtendedGreeks` (`null` = elasticity undefined); not used by the expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
phi
number
φ = ∂V/∂q per 1% dividend yield — the options package's `phi` (dividend rho). Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
rho
number
∂V/∂r per 1% rate (0.01), as the options package reports it.
unitless by name
Optional
No @default declared; consult the signature and description.
rhoConvexity
number
∂²V/∂r² per (1%)² — rho convexity. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
speed
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
spot
number
Reference spot, required to resolve percent spot shocks into price moves.
unitless by name
Optional
No @default declared; consult the signature and description.
theta
number
∂V/∂t per CALENDAR DAY (negative for a long option), as the options package reports it.
unitless by name
Optional
No @default declared; consult the signature and description.
thetaConvexity
number
∂²V/∂t² per calendar day² — theta convexity (theta's own bleed). Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
thetaRate
number
∂²V/∂t∂r per calendar day per 1% rate — the time-rate cross (`∂Θ/∂r`). Optional.
decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
ultima
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
value
number
Current mark value of the position (per unit).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
vanna
number
∂²V/∂S∂σ per 1.00 σ per $ — the options package's `vanna`. Optional — omitted ⇒ its term is 0.
unitless by name
Optional
No @default declared; consult the signature and description.
vega
number
∂V/∂σ per 1 volatility point (0.01), as the options package reports it.
unitless by name
Optional
No @default declared; consult the signature and description.
vera
number
∂²V/∂σ∂r per 1.00 σ per 1.00 rate — the options package's `vera`. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
veta
number
∂vega/∂T per year of time-to-expiry, vega per 1.00 σ — the options package's `veta`. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
vomma
number
∂²V/∂σ² per 1.00 σ² — the options package's `vomma`. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
zomma
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

PositionScenarioResult

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export interface PositionScenarioResult {
    id: string;
    quantity: number;
    pnl: number;
    attribution: PnlAttribution;
    /** How this position was revalued under the scenario (H11 disclosure). */
    valuationMethod: 'greeks-taylor' | 'reprice';
}
Fields, parameters & returned members (22)
Name / typeMeaning & unitOptional / default
attribution
PnlAttribution

unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.charm
number
Second-order spot–time cross term: `charm·dS·dt` (0 when `charm` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.delta
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.deltaRate
number
Second-order spot–rate cross term: `deltaRate·dS·dr` (0 when `deltaRate` is absent).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
attribution.gamma
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.other
number
Residual = repriced − value − (the Greek terms); 0 for a pure Taylor reprice.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.phi
number
First-order dividend-carry term: `φ·dq` (0 when `phi` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.rho
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.rhoConvexity
number
Second-order rate-convexity term: `½·rhoConvexity·dr²` (0 when `rhoConvexity` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.theta
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.thetaConvexity
number
Second-order time-convexity term: `½·thetaConvexity·dt²` (0 when `thetaConvexity` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.thetaRate
number
Second-order time–rate cross term: `thetaRate·dt·dr` (0 when `thetaRate` is absent).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
attribution.total
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.vanna
number
Second-order spot–vol cross term: `vanna·dS·dσ` (0 when `vanna` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.vega
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.vera
number
Second-order vol–rate cross term: `vera·dσ·dr` (0 when `vera` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.veta
number
Second-order vol–time cross term: `veta·dσ·dt` (0 when `veta` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.vomma
number
Second-order vol-convexity term: `½·vomma·dσ²` (0 when `vomma` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
id
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
pnl
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
quantity
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
valuationMethod
'greeks-taylor' | 'reprice'
How this position was revalued under the scenario (H11 disclosure).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

ResolvedGridShock

One resolved axis entry of a {@link ScenarioGridResult} (H12).

/** One resolved axis entry of a {@link ScenarioGridResult} (H12). */
export interface ResolvedGridShock {
    factor: 'spot' | 'volatility';
    kind: ShockKind;
    value: number;
    /** The resolved ABSOLUTE move applied (percent spot shocks scaled by `greeks.spot`). */
    resolvedMove: number;
}
Fields, parameters & returned members (4)
Name / typeMeaning & unitOptional / default
factor
'spot' | 'volatility'

unitless by name
Required / declared member
No @default declared; consult the signature and description.
kind
ShockKind

unitless by name
Required / declared member
No @default declared; consult the signature and description.
resolvedMove
number
The resolved ABSOLUTE move applied (percent spot shocks scaled by `greeks.spot`).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
value
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

Scenario

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export interface Scenario {
    name: string;
    shocks: Shock[];
}
Fields, parameters & returned members (2)
Name / typeMeaning & unitOptional / default
name
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
shocks
Shock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

ScenarioGridInput

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export interface ScenarioGridInput {
    greeks: PositionGreeks;
    spotShocks: readonly Shock[];
    volatilityShocks: readonly Shock[];
}
Fields, parameters & returned members (25)
Name / typeMeaning & unitOptional / default
greeks
PositionGreeks

unitless by name
Required / declared member
No @default declared; consult the signature and description.
greeks.charm
number
∂Δ/∂T per year of time-to-expiry — the options package's `charm` (delta drift as expiry recedes). Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.color
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.delta
number
∂V/∂S per $1 of spot.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.deltaRate
number
∂²V/∂S∂r per $ per 1% rate — the spot-rate cross (`∂Δ/∂r`). Optional.
decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
greeks.gamma
number
∂²V/∂S² per $1².
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.lambda
number | null
Accepted from a whole `ExtendedGreeks` (`null` = elasticity undefined); not used by the expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.phi
number
φ = ∂V/∂q per 1% dividend yield — the options package's `phi` (dividend rho). Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.rho
number
∂V/∂r per 1% rate (0.01), as the options package reports it.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.rhoConvexity
number
∂²V/∂r² per (1%)² — rho convexity. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.speed
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.spot
number
Reference spot, required to resolve percent spot shocks into price moves.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.theta
number
∂V/∂t per CALENDAR DAY (negative for a long option), as the options package reports it.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.thetaConvexity
number
∂²V/∂t² per calendar day² — theta convexity (theta's own bleed). Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.thetaRate
number
∂²V/∂t∂r per calendar day per 1% rate — the time-rate cross (`∂Θ/∂r`). Optional.
decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
greeks.ultima
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.value
number
Current mark value of the position (per unit).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
greeks.vanna
number
∂²V/∂S∂σ per 1.00 σ per $ — the options package's `vanna`. Optional — omitted ⇒ its term is 0.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.vega
number
∂V/∂σ per 1 volatility point (0.01), as the options package reports it.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.vera
number
∂²V/∂σ∂r per 1.00 σ per 1.00 rate — the options package's `vera`. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.veta
number
∂vega/∂T per year of time-to-expiry, vega per 1.00 σ — the options package's `veta`. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.vomma
number
∂²V/∂σ² per 1.00 σ² — the options package's `vomma`. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
greeks.zomma
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
spotShocks
readonly Shock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
volatilityShocks
readonly Shock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

ScenarioGridResult

The H12 report: both axes with resolved shock semantics + the P&L cells + the Law 2 envelope.

/** The H12 report: both axes with resolved shock semantics + the P&L cells + the Law 2 envelope. */
export interface ScenarioGridResult {
    assumptions: {
        conventionsVersion: string;
        greekUnits: typeof GREEK_UNITS;
    };
    diagnostics: {
        warnings: QuantWarning[];
    };
    spotAxis: ResolvedGridShock[];
    volatilityAxis: ResolvedGridShock[];
    /** `pnl[i][j]` = P&L per unit at `spotAxis[i]` × `volatilityAxis[j]`. */
    pnl: number[][];
}
Fields, parameters & returned members (12)
Name / typeMeaning & unitOptional / default
assumptions
{ conventionsVersion: string; greekUnits: typeof GREEK_UNITS; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.conventionsVersion
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.greekUnits
{ readonly phi: 'per1Percent'; readonly rho: import('@insiderfinance/totalfinance/core').RhoUnit; readonly theta: import('@insiderfinance/totalfinance/core').ThetaUnit; readonly vega: import('@insiderfinance/totalfinance/core').VegaUnit; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.greekUnits.phi
'per1Percent'

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.greekUnits.rho
import('@insiderfinance/totalfinance/core').RhoUnit

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.greekUnits.theta
import('@insiderfinance/totalfinance/core').ThetaUnit

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.greekUnits.vega
import('@insiderfinance/totalfinance/core').VegaUnit

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics
{ warnings: QuantWarning[]; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.warnings
QuantWarning[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
pnl
number[][]
`pnl[i][j]` = P&L per unit at `spotAxis[i]` × `volatilityAxis[j]`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
spotAxis
ResolvedGridShock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
volatilityAxis
ResolvedGridShock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

ScenarioResult

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export interface ScenarioResult {
    scenario: string;
    /** Book P&L summed over positions. */
    pnl: number;
    byPosition: PositionScenarioResult[];
    /** Book-level P&L-explain (sum of position explains). */
    attribution: PnlAttribution;
}
Fields, parameters & returned members (21)
Name / typeMeaning & unitOptional / default
attribution
PnlAttribution
Book-level P&L-explain (sum of position explains).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.charm
number
Second-order spot–time cross term: `charm·dS·dt` (0 when `charm` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.delta
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.deltaRate
number
Second-order spot–rate cross term: `deltaRate·dS·dr` (0 when `deltaRate` is absent).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
attribution.gamma
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.other
number
Residual = repriced − value − (the Greek terms); 0 for a pure Taylor reprice.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.phi
number
First-order dividend-carry term: `φ·dq` (0 when `phi` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.rho
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.rhoConvexity
number
Second-order rate-convexity term: `½·rhoConvexity·dr²` (0 when `rhoConvexity` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.theta
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.thetaConvexity
number
Second-order time-convexity term: `½·thetaConvexity·dt²` (0 when `thetaConvexity` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.thetaRate
number
Second-order time–rate cross term: `thetaRate·dt·dr` (0 when `thetaRate` is absent).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
attribution.total
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.vanna
number
Second-order spot–vol cross term: `vanna·dS·dσ` (0 when `vanna` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.vega
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.vera
number
Second-order vol–rate cross term: `vera·dσ·dr` (0 when `vera` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.veta
number
Second-order vol–time cross term: `veta·dσ·dt` (0 when `veta` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
attribution.vomma
number
Second-order vol-convexity term: `½·vomma·dσ²` (0 when `vomma` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
byPosition
PositionScenarioResult[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
pnl
number
Book P&L summed over positions.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
scenario
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

Shock

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export interface Shock {
    factor: ShockFactor;
    kind: ShockKind;
    value: number;
}
Fields, parameters & returned members (3)
Name / typeMeaning & unitOptional / default
factor
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
kind
ShockKind

unitless by name
Required / declared member
No @default declared; consult the signature and description.
value
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

type

ShockFactor

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export type ShockFactor = 'spot' | 'volatility' | 'riskFreeRate' | 'time' | 'dividend' | string;
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

type

ShockKind

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export type ShockKind = 'percent' | 'absolute';
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

StressOptions

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export interface StressOptions<T> {
    /** Custom revaluation: return the position's **new value per unit** under the scenario. Falls back
     *  to the Greeks-Taylor expansion when omitted. */
    reprice?: (position: Position<T>, scenario: Scenario) => number;
}
Fields, parameters & returned members (11)
Name / typeMeaning & unitOptional / default
reprice
(position: Position<T>, scenario: Scenario) => number
Custom revaluation: return the position's **new value per unit** under the scenario. Falls back to the Greeks-Taylor expansion when omitted.
unitless by name
Optional
No @default declared; consult the signature and description.
reprice(position)
Position<T>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
reprice(position).data
T

unitless by name
Optional
No @default declared; consult the signature and description.
reprice(position).greeks
PositionGreeks

unitless by name
Optional
No @default declared; consult the signature and description.
reprice(position).id
string

unitless by name
Optional
No @default declared; consult the signature and description.
reprice(position).multiplier
number
Contract multiplier applied to per-unit value and Greeks (100 for a listed US equity option whose Greeks are per share and whose `quantity` is in contracts). Default 1. Applied by `aggregateGreeks`, `stressTest` and the book tools; disclosed in their assumptions.
unitless by name
Optional
No @default declared; consult the signature and description.
reprice(position).quantity
number
Number of units held (signed). Default 1.
unitless by name
Optional
No @default declared; consult the signature and description.
reprice(position).value
number
Current mark per unit — the BASE a custom `reprice` differences against (H11). When `reprice` is supplied, either this or `greeks.value` must be present; the base is never assumed 0.
unitless by name
Optional
No @default declared; consult the signature and description.
reprice(scenario)
Scenario

unitless by name
Required / declared member
No @default declared; consult the signature and description.
reprice(scenario).name
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
reprice(scenario).shocks
Shock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

StressTestInput

Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.

export interface StressTestInput<T> {
    positions: readonly Position<T>[];
    scenarios: readonly Scenario[];
    options?: StressOptions<T>;
}
Fields, parameters & returned members (14)
Name / typeMeaning & unitOptional / default
options
StressOptions<T>

unitless by name
Optional
No @default declared; consult the signature and description.
options.reprice
(position: Position<T>, scenario: Scenario) => number
Custom revaluation: return the position's **new value per unit** under the scenario. Falls back to the Greeks-Taylor expansion when omitted.
unitless by name
Optional
No @default declared; consult the signature and description.
options.reprice(position)
Position<T>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
options.reprice(position).data
T

unitless by name
Optional
No @default declared; consult the signature and description.
options.reprice(position).greeks
PositionGreeks

unitless by name
Optional
No @default declared; consult the signature and description.
options.reprice(position).id
string

unitless by name
Optional
No @default declared; consult the signature and description.
options.reprice(position).multiplier
number
Contract multiplier applied to per-unit value and Greeks (100 for a listed US equity option whose Greeks are per share and whose `quantity` is in contracts). Default 1. Applied by `aggregateGreeks`, `stressTest` and the book tools; disclosed in their assumptions.
unitless by name
Optional
No @default declared; consult the signature and description.
options.reprice(position).quantity
number
Number of units held (signed). Default 1.
unitless by name
Optional
No @default declared; consult the signature and description.
options.reprice(position).value
number
Current mark per unit — the BASE a custom `reprice` differences against (H11). When `reprice` is supplied, either this or `greeks.value` must be present; the base is never assumed 0.
unitless by name
Optional
No @default declared; consult the signature and description.
options.reprice(scenario)
Scenario

unitless by name
Required / declared member
No @default declared; consult the signature and description.
options.reprice(scenario).name
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
options.reprice(scenario).shocks
Shock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
positions
readonly Position<T>[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
scenarios
readonly Scenario[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

StressTestResult

The H11 report: scenarios + the Law 2 envelope with the book-level valuation summary.

/** The H11 report: scenarios + the Law 2 envelope with the book-level valuation summary. */
export interface StressTestResult {
    assumptions: {
        conventionsVersion: string;
        scenarios: number;
        positions: number;
        /** Book-level valuation summary: 'greeks-taylor' | 'reprice' | 'mixed'. */
        valuation: string;
    };
    diagnostics: {
        warnings: QuantWarning[];
    };
    scenarios: ScenarioResult[];
}
Fields, parameters & returned members (8)
Name / typeMeaning & unitOptional / default
assumptions
{ conventionsVersion: string; positions: number; scenarios: number; valuation: string; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.conventionsVersion
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.positions
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.scenarios
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.valuation
string
Book-level valuation summary: 'greeks-taylor' | 'reprice' | 'mixed'.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics
{ warnings: QuantWarning[]; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.warnings
QuantWarning[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
scenarios
ScenarioResult[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

interface

TaylorPnlResult

{@link taylorPnl}'s report: the attribution inline plus the applied conventions (Law 2).

/** {@link taylorPnl}'s report: the attribution inline plus the applied conventions (Law 2). */
export interface TaylorPnlResult extends PnlAttribution {
    /** Applied conventions, echoed (Law 2 report grammar). */
    assumptions: {
        conventionsVersion: string;
        [k: string]: unknown;
    };
    /** Structured warnings; always present (possibly empty). */
    diagnostics: {
        warnings: QuantWarning[];
    };
}
Fields, parameters & returned members (21)
Name / typeMeaning & unitOptional / default
assumptions
{ [k: string]: unknown; conventionsVersion: string; }
Applied conventions, echoed (Law 2 report grammar).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.conventionsVersion
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
charm
number
Second-order spot–time cross term: `charm·dS·dt` (0 when `charm` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
delta
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
deltaRate
number
Second-order spot–rate cross term: `deltaRate·dS·dr` (0 when `deltaRate` is absent).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
diagnostics
{ warnings: QuantWarning[]; }
Structured warnings; always present (possibly empty).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.warnings
QuantWarning[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
gamma
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
other
number
Residual = repriced − value − (the Greek terms); 0 for a pure Taylor reprice.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
phi
number
First-order dividend-carry term: `φ·dq` (0 when `phi` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
rho
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
rhoConvexity
number
Second-order rate-convexity term: `½·rhoConvexity·dr²` (0 when `rhoConvexity` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
theta
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
thetaConvexity
number
Second-order time-convexity term: `½·thetaConvexity·dt²` (0 when `thetaConvexity` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
thetaRate
number
Second-order time–rate cross term: `thetaRate·dt·dr` (0 when `thetaRate` is absent).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
total
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
vanna
number
Second-order spot–vol cross term: `vanna·dS·dσ` (0 when `vanna` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
vega
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
vera
number
Second-order vol–rate cross term: `vera·dσ·dr` (0 when `vera` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
veta
number
Second-order vol–time cross term: `veta·dσ·dt` (0 when `veta` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
vomma
number
Second-order vol-convexity term: `½·vomma·dσ²` (0 when `vomma` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

function

scenario

Build a named scenario from shocks. Each shock is validated at build time (use the `shock.*` constructors — they produce exactly this shape), so a malformed shock fails here with a typed error instead of deep inside the Taylor engine.

export declare function scenario(name: string, ...shocks: Shock[]): Scenario;
Fields, parameters & returned members (4)
Name / typeMeaning & unitOptional / default
(name)
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(shocks)
Shock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.name
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.shocks
Shock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

function

scenarioGrid

2-D scenario grid (H12 report): P&L (per unit) of one position's Greeks across a Cartesian product of spot and vol shocks. A serialized result is self-interpreting — both axes carry their resolved shock semantics beside the cells, so a detached matrix never travels alone.

export declare function scenarioGrid(input: ScenarioGridInput): ScenarioGridResult;
Fields, parameters & returned members (16)
Name / typeMeaning & unitOptional / default
(input)
ScenarioGridInput

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(input).greeks
PositionGreeks

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(input).spotShocks
readonly Shock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(input).volatilityShocks
readonly Shock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions
{ conventionsVersion: string; greekUnits: typeof GREEK_UNITS; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions.conventionsVersion
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions.greekUnits
{ readonly phi: 'per1Percent'; readonly rho: import('@insiderfinance/totalfinance/core').RhoUnit; readonly theta: import('@insiderfinance/totalfinance/core').ThetaUnit; readonly vega: import('@insiderfinance/totalfinance/core').VegaUnit; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions.greekUnits.phi
'per1Percent'

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions.greekUnits.rho
import('@insiderfinance/totalfinance/core').RhoUnit

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions.greekUnits.theta
import('@insiderfinance/totalfinance/core').ThetaUnit

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions.greekUnits.vega
import('@insiderfinance/totalfinance/core').VegaUnit

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.diagnostics
{ warnings: QuantWarning[]; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.diagnostics.warnings
QuantWarning[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.pnl
number[][]
`pnl[i][j]` = P&L per unit at `spotAxis[i]` × `volatilityAxis[j]`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.spotAxis
ResolvedGridShock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.volatilityAxis
ResolvedGridShock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

value

shock

Typed shock constructors. Strings carry units; raw numbers are absolute.

export declare const shock: { dividend(change: string | number): Shock; factor(name: string, change: string | number): Shock; riskFreeRate(change: string | number): Shock; spot(change: string | number): Shock; time(years: number): Shock; volatility(change: string | number): Shock; };
Fields, parameters & returned members (31)
Name / typeMeaning & unitOptional / default
dividend
(change: string | number) => Shock
Dividend-yield move: `'+50bp'` ⇒ +0.005, or a raw `0.005`. Drives the first-order carry term `ε·dq`. Percent (`'%'`) dividend moves are rejected by the Taylor engine — it has no reference dividend level to scale against.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
dividend().return.factor
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
dividend().return.kind
ShockKind

unitless by name
Required / declared member
No @default declared; consult the signature and description.
dividend().return.value
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
dividend(change)
string | number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
factor
(name: string, change: string | number) => Shock
A custom named factor shock. Percent (`'%'`) moves resolve only for `'spot'` in the Taylor engine; a custom `reprice` fn receives the raw scenario and may interpret `%` itself.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
factor().return.factor
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
factor().return.kind
ShockKind

unitless by name
Required / declared member
No @default declared; consult the signature and description.
factor().return.value
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
factor(change)
string | number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
factor(name)
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
riskFreeRate
(change: string | number) => Shock
Rate move: `'+50bp'` ⇒ +0.005, or a raw `0.005`. Percent (`'%'`) rate moves are rejected by the Taylor engine — it has no reference rate to scale against.
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
riskFreeRate().return.factor
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
riskFreeRate().return.kind
ShockKind

unitless by name
Required / declared member
No @default declared; consult the signature and description.
riskFreeRate().return.value
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
riskFreeRate(change)
string | number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
spot
(change: string | number) => Shock
Spot move: `'-5%'` (relative) or `-5` (absolute price).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
spot().return.factor
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
spot().return.kind
ShockKind

unitless by name
Required / declared member
No @default declared; consult the signature and description.
spot().return.value
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
spot(change)
string | number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
time
(years: number) => Shock
Time decay over `years` (e.g. `1/365` for one day).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
time().return.factor
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
time().return.kind
ShockKind

unitless by name
Required / declared member
No @default declared; consult the signature and description.
time().return.value
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
time(years)
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
volatility
(change: string | number) => Shock
Volatility move in absolute vol points (`'+10pts'` ⇒ +0.10) or a raw decimal (`0.10`). Percent (`'%'`) vol moves are rejected by the Taylor engine — it has no reference vol to scale against.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
volatility().return.factor
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
volatility().return.kind
ShockKind

unitless by name
Required / declared member
No @default declared; consult the signature and description.
volatility().return.value
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
volatility(change)
string | number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

function

stressTest

Stress a positions book across scenarios (H11 report): per-scenario and per-position P&L.

export declare function stressTest<T = unknown>(input: StressTestInput<T>): StressTestResult;
Fields, parameters & returned members (12)
Name / typeMeaning & unitOptional / default
(input)
StressTestInput<T>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(input).options
StressOptions<T>

unitless by name
Optional
No @default declared; consult the signature and description.
(input).positions
readonly Position<T>[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(input).scenarios
readonly Scenario[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions
{ conventionsVersion: string; positions: number; scenarios: number; valuation: string; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions.conventionsVersion
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions.positions
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions.scenarios
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions.valuation
string
Book-level valuation summary: 'greeks-taylor' | 'reprice' | 'mixed'.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.diagnostics
{ warnings: QuantWarning[]; }

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.diagnostics.warnings
QuantWarning[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.scenarios
ScenarioResult[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.

function

taylorPnl

Greeks-Taylor P&L of a single position's Greeks under a scenario (per unit).

export declare function taylorPnl(greeks: PositionGreeks, scenario: Scenario): TaylorPnlResult;
Fields, parameters & returned members (47)
Name / typeMeaning & unitOptional / default
(greeks)
PositionGreeks

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(greeks).charm
number
∂Δ/∂T per year of time-to-expiry — the options package's `charm` (delta drift as expiry recedes). Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).color
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).delta
number
∂V/∂S per $1 of spot.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).deltaRate
number
∂²V/∂S∂r per $ per 1% rate — the spot-rate cross (`∂Δ/∂r`). Optional.
decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
(greeks).gamma
number
∂²V/∂S² per $1².
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).lambda
number | null
Accepted from a whole `ExtendedGreeks` (`null` = elasticity undefined); not used by the expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).phi
number
φ = ∂V/∂q per 1% dividend yield — the options package's `phi` (dividend rho). Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).rho
number
∂V/∂r per 1% rate (0.01), as the options package reports it.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).rhoConvexity
number
∂²V/∂r² per (1%)² — rho convexity. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).speed
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).spot
number
Reference spot, required to resolve percent spot shocks into price moves.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).theta
number
∂V/∂t per CALENDAR DAY (negative for a long option), as the options package reports it.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).thetaConvexity
number
∂²V/∂t² per calendar day² — theta convexity (theta's own bleed). Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).thetaRate
number
∂²V/∂t∂r per calendar day per 1% rate — the time-rate cross (`∂Θ/∂r`). Optional.
decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
(greeks).ultima
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).value
number
Current mark value of the position (per unit).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
(greeks).vanna
number
∂²V/∂S∂σ per 1.00 σ per $ — the options package's `vanna`. Optional — omitted ⇒ its term is 0.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).vega
number
∂V/∂σ per 1 volatility point (0.01), as the options package reports it.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).vera
number
∂²V/∂σ∂r per 1.00 σ per 1.00 rate — the options package's `vera`. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).veta
number
∂vega/∂T per year of time-to-expiry, vega per 1.00 σ — the options package's `veta`. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).vomma
number
∂²V/∂σ² per 1.00 σ² — the options package's `vomma`. Optional.
unitless by name
Optional
No @default declared; consult the signature and description.
(greeks).zomma
number
Accepted from a whole `ExtendedGreeks`; not used by the second-order expansion.
unitless by name
Optional
No @default declared; consult the signature and description.
(scenario)
Scenario

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(scenario).name
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(scenario).shocks
Shock[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions
{ [k: string]: unknown; conventionsVersion: string; }
Applied conventions, echoed (Law 2 report grammar).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions.conventionsVersion
string

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.charm
number
Second-order spot–time cross term: `charm·dS·dt` (0 when `charm` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.delta
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.deltaRate
number
Second-order spot–rate cross term: `deltaRate·dS·dr` (0 when `deltaRate` is absent).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
return.diagnostics
{ warnings: QuantWarning[]; }
Structured warnings; always present (possibly empty).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.diagnostics.warnings
QuantWarning[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.gamma
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.other
number
Residual = repriced − value − (the Greek terms); 0 for a pure Taylor reprice.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.phi
number
First-order dividend-carry term: `φ·dq` (0 when `phi` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.rho
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.rhoConvexity
number
Second-order rate-convexity term: `½·rhoConvexity·dr²` (0 when `rhoConvexity` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.theta
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.thetaConvexity
number
Second-order time-convexity term: `½·thetaConvexity·dt²` (0 when `thetaConvexity` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.thetaRate
number
Second-order time–rate cross term: `thetaRate·dt·dr` (0 when `thetaRate` is absent).
decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
return.total
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.vanna
number
Second-order spot–vol cross term: `vanna·dS·dσ` (0 when `vanna` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.vega
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.vera
number
Second-order vol–rate cross term: `vera·dσ·dr` (0 when `vera` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.veta
number
Second-order vol–time cross term: `veta·dσ·dt` (0 when `veta` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.vomma
number
Second-order vol-convexity term: `½·vomma·dσ²` (0 when `vomma` is absent).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)

Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.