The finance developer workbenchSearch the reference Development · 0.1.4 · unpublished

Public API / @insiderfinance/totalfinance

@insiderfinance/totalfinance/structure

import from '@insiderfinance/totalfinance/structure'

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

Jump to an export (92)

AggressorSide · AtSpotExposure · CallPutPremium · ClassifiedTrade · ContractExposure · ContractExposureRow · DefaultScenarioMetric · DeltaAdjustedPremium · DirectionalFlowTrade · ExpiryRow · ExposureAggregate · ExposureConfig · ExposureConvention · ExposureInput · ExposureMarket · ExposureMetric · ExposureProfile · ExposureShortcutInput · ExposureTotals · FlowAnalysis · FlowClassificationProvenance · FlowClassificationSource · FlowGroup · FlowGroupKey · FlowOptions · GammaUnit · GexSplit · GuaranteedExposureMetrics · GuaranteedSuppliedExposureMetrics · Levels · NetDrift · OpenCloseEstimate · OptionFlowDriftAssumptions · OptionFlowDriftBucket · OptionFlowDriftConfig · OptionFlowDriftHeuristic · OptionFlowDriftInput · OptionFlowDriftPrice · OptionFlowDriftPrint · OptionFlowDriftResult · OptionFlowDriftSession · OptionFlowDriftTotals · OptionFlowDriftTrade · OptionFlowDriftValue · OptionFlowPriceOverlay · OptionFlowVolumeConfirmation · PossibleExposureMetrics · PossibleSuppliedExposureMetrics · RankByKey · RankOptions · ScenarioCell · ScenarioMap · ScenarioMapOptions · Spread · StrikeRow · SuppliedExposureAssumptions · SuppliedExposureAssumptionsFor · SuppliedExposureBreakdownsFor · SuppliedExposureConfig · SuppliedExposureContribution · SuppliedExposureContributionFor · SuppliedExposureExclusion · SuppliedExposureGreeks · SuppliedExposureInput · SuppliedExposureMarket · SuppliedExposureMetric · SuppliedExposurePositionConvention · SuppliedExposureQuote · SuppliedExposureReport · SuppliedExposureRequest · SuppliedExposureRequestConfig · SuppliedExposureRequestGreeks · SuppliedExposureRequestQuote · SuppliedExposureTotals · SuppliedExposureTotalsFor · Sweep · Unusualness · charmExposure · colorExposure · deltaAdjustedPremium · deltaExposure · exposure · exposureFromGreeks · flow · gammaExposure · optionFlowDrift · speedExposure · thetaExposure · unusualness · vannaExposure · vegaExposure · vommaExposure

type

AggressorSide

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

export type AggressorSide = 'buy' | 'sell' | 'unknown';
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

AtSpotExposure

What `atSpot` re-evaluates for a profile: its selected `gex` and/or `dex`.

/** What `atSpot` re-evaluates for a profile: its selected `gex` and/or `dex`. */
export type AtSpotExposure<G extends ExposureMetric = ExposureMetric, P extends ExposureMetric = G> = Pick<{
    gex: number;
    dex: number;
}, Extract<G, 'gex' | 'dex'>> & Partial<Pick<{
    gex: number;
    dex: number;
}, Extract<Exclude<P, G>, 'gex' | 'dex'>>>;
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

CallPutPremium

Call-vs-put premium/volume summary with put/call ratios (spec §11.6).

/** Call-vs-put premium/volume summary with put/call ratios (spec §11.6). */
export interface CallPutPremium {
    callPremium: number;
    putPremium: number;
    callVolume: number;
    putVolume: number;
    /** Put ÷ call traded volume (contracts); `null` when there is no call volume. */
    putCallVolumeRatio: number | null;
    /** Put ÷ call premium ($); `null` when there is no call premium. */
    putCallPremiumRatio: number | null;
    /** Net directional premium across all trades (buy − sell). */
    netPremium: number;
}
Fields, parameters & returned members (7)
Name / typeMeaning & unitOptional / default
callPremium
number

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
callVolume
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
netPremium
number
Net directional premium across all trades (buy − sell).
currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
putCallPremiumRatio
number | null
Put ÷ call premium ($); `null` when there is no call premium.
decimal fraction / multiple
Required / declared member
No @default declared; consult the signature and description.
putCallVolumeRatio
number | null
Put ÷ call traded volume (contracts); `null` when there is no call volume.
decimal fraction / multiple
Required / declared member
No @default declared; consult the signature and description.
putPremium
number

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
putVolume
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

ClassifiedTrade

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

export interface ClassifiedTrade {
    trade: OptionTrade;
    underlying: string;
    type: OptionType;
    strike: number;
    expiry: string;
    /** Supplied or quote-estimated aggressor side, according to classificationProvenance. */
    side: AggressorSide;
    classificationProvenance: FlowClassificationProvenance;
    premium: number;
    size: number;
    isBlock: boolean;
    /** True when the trade prints on its own expiration day (0DTE). */
    isZeroDaysToExpiry: boolean;
    /** Opening estimate: `open` when size exceeds prior open interest (definitely new contracts). */
    openClose: OpenCloseEstimate;
    /** Sweep cluster id (undefined when not part of a sweep). */
    sweepId?: number;
    /** Spread group id (undefined when not part of a detected multi-leg spread). */
    spreadId?: number;
}
Fields, parameters & returned members (68)
Name / typeMeaning & unitOptional / default
classificationProvenance
FlowClassificationProvenance

unitless by name
Required / declared member
No @default declared; consult the signature and description.
classificationProvenance.policy
FlowClassificationSource

unitless by name
Required / declared member
No @default declared; consult the signature and description.
classificationProvenance.providedSide
AggressorSide | null
`null` means absent; `'unknown'` means the provider explicitly declined to classify.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
classificationProvenance.reason
'provided' | 'provided-missing' | 'quotes-missing' | 'quotes-locked-or-crossed' | 'quote-midpoint' | 'quote-rule'

unitless by name
Required / declared member
No @default declared; consult the signature and description.
classificationProvenance.source
'unavailable' | 'quotes' | 'provided'

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

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

unitless by name
Required / declared member
No @default declared; consult the signature and description.
isZeroDaysToExpiry
boolean
True when the trade prints on its own expiration day (0DTE).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
openClose
OpenCloseEstimate
Opening estimate: `open` when size exceeds prior open interest (definitely new contracts).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
premium
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
side
AggressorSide
Supplied or quote-estimated aggressor side, according to classificationProvenance.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
size
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
spreadId
number
Spread group id (undefined when not part of a detected multi-leg spread).
unitless by name
Optional
No @default declared; consult the signature and description.
strike
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
sweepId
number
Sweep cluster id (undefined when not part of a sweep).
unitless by name
Optional
No @default declared; consult the signature and description.
trade
OptionTrade

unitless by name
Required / declared member
No @default declared; consult the signature and description.
trade.aggressorSide
'buy' | 'sell' | 'unknown'

unitless by name
Optional
No @default declared; consult the signature and description.
trade.ask
number

unitless by name
Optional
No @default declared; consult the signature and description.
trade.askSize
number

count (integer)
Optional
No @default declared; consult the signature and description.
trade.bid
number

unitless by name
Optional
No @default declared; consult the signature and description.
trade.bidSize
number

count (integer)
Optional
No @default declared; consult the signature and description.
trade.conditions
string[]

unitless by name
Optional
No @default declared; consult the signature and description.
trade.contract
import('@insiderfinance/totalfinance/core').OptionContract

unitless by name
Required / declared member
No @default declared; consult the signature and description.
trade.contract.adjusted
boolean

unitless by name
Optional
No @default declared; consult the signature and description.
trade.contract.currency
string

unitless by name
Optional
No @default declared; consult the signature and description.
trade.contract.deliverable
import('@insiderfinance/totalfinance/core').Deliverable

unitless by name
Optional
No @default declared; consult the signature and description.
trade.contract.deliverable.cash
number

unitless by name
Optional
No @default declared; consult the signature and description.
trade.contract.deliverable.notes
string

unitless by name
Optional
No @default declared; consult the signature and description.
trade.contract.deliverable.shares
{ symbol: string; quantity: number; }[]

unitless by name
Optional
No @default declared; consult the signature and description.
trade.contract.exerciseTime
import('@insiderfinance/totalfinance/core').ExerciseTime
AM- or PM-settled — settlement/display metadata. It does NOT move `expiresAt`: the expiry instant always comes from the `expiry` label and `expiryConvention`. Express an AM-settled index expiry as a zoned datetime (`'2026-09-18T09:30:00-04:00'`) when its instant matters.
unitless by name
Optional
No @default declared; consult the signature and description.
trade.contract.expiresAt
number
The exact expiration INSTANT the label resolved to (epoch ms), stamped by the builders at construction: a bare date resolves via the named `expiryConvention`; a zoned datetime is the caller's explicit instant. REQUIRED (E2, one expiry law): engines price against this resolution and cross-validate it against the label — an unresolved literal is not a contract; build one with the option builders.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
trade.contract.expiry
string
The expiry LABEL as supplied: `YYYY-MM-DD` (a calendar date) or a zoned ISO datetime.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
trade.contract.expiryConvention
'us-equity-close' | 'explicit-instant'
HOW `expiry` resolved to `expiresAt` — named, never silent (spec P1.6/P3.4).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
trade.contract.multiplier
number

unitless by name
Optional
No @default declared; consult the signature and description.
trade.contract.occSymbol
string

unitless by name
Optional
No @default declared; consult the signature and description.
trade.contract.root
string

unitless by name
Optional
No @default declared; consult the signature and description.
trade.contract.settlement
import('@insiderfinance/totalfinance/core').Settlement

unitless by name
Optional
No @default declared; consult the signature and description.
trade.contract.strike
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
trade.contract.style
import('@insiderfinance/totalfinance/core').OptionStyle
REQUIRED at build — never defaulted: US equity options are American, many index options European.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
trade.contract.type
OptionType

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

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

unitless by name
Optional
No @default declared; consult the signature and description.
trade.greeks
import('@insiderfinance/totalfinance/core').OptionQuoteGreeks
Per-share Greeks in display units, when the source (or `chainGreeks`) supplied them.
unitless by name
Optional
No @default declared; consult the signature and description.
trade.greeks.delta
number

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

unitless by name
Optional
No @default declared; consult the signature and description.
trade.greeks.provenance
import('@insiderfinance/totalfinance/core').OptionQuoteGreeksProvenance

unitless by name
Optional
No @default declared; consult the signature and description.
trade.greeks.provenance.model
string
The pricing model behind them when known, e.g. `'black-scholes-merton'`.
unitless by name
Optional
No @default declared; consult the signature and description.
trade.greeks.provenance.source
string
The provider or model that produced them, e.g. `'vendor-feed-v2'` or `'chainGreeks'`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
trade.greeks.provenance.timestampMs
number
When the Greeks were observed or computed (epoch ms).
milliseconds
Optional
No @default declared; consult the signature and description.
trade.greeks.rho
number

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

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

unitless by name
Optional
No @default declared; consult the signature and description.
trade.impliedVolatility
number

unitless by name
Optional
No @default declared; consult the signature and description.
trade.last
number

unitless by name
Optional
No @default declared; consult the signature and description.
trade.mark
number

unitless by name
Optional
No @default declared; consult the signature and description.
trade.mid
number

unitless by name
Optional
No @default declared; consult the signature and description.
trade.notional
number

unitless by name
Optional
No @default declared; consult the signature and description.
trade.openInterest
number

unitless by name
Optional
No @default declared; consult the signature and description.
trade.openingLikely
boolean

unitless by name
Optional
No @default declared; consult the signature and description.
trade.premium
number

unitless by name
Optional
No @default declared; consult the signature and description.
trade.price
number

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

unitless by name
Optional
No @default declared; consult the signature and description.
trade.size
number

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

milliseconds
Required / declared member
No @default declared; consult the signature and description.
trade.underlyingPrice
number

currency amount (the field or record currency)
Optional
No @default declared; consult the signature and description.
trade.volume
number

unitless by name
Optional
No @default declared; consult the signature and description.
type
OptionType

unitless by name
Required / declared member
No @default declared; consult the signature and description.
underlying
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

ContractExposure

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

export interface ContractExposure {
    expiry: string;
    strike: number;
    type: OptionType;
    timeToExpiryYears: number;
    impliedVolatility: number;
    openInterest: number;
    multiplier: number;
    /** Applied position sign (+1/−1) from the convention. */
    sign: number;
    gamma: number;
    delta: number;
    gex: number;
    dex: number;
    vega: number;
    vanna: number;
    charm: number;
    theta: number;
    vomma: number;
    speed: number;
    color: number;
}
Fields, parameters & returned members (19)
Name / typeMeaning & unitOptional / default
charm
number

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

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.
dex
number

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

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.
gex
number

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

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

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

unitless by name
Required / declared member
No @default declared; consult the signature and description.
sign
number
Applied position sign (+1/−1) from the convention.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
speed
number

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

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.
timeToExpiryYears
number

years (decimal)
Required / declared member
No @default declared; consult the signature and description.
type
OptionType

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

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.
vomma
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

ContractExposureRow

A per-contract row of a profile (see {@link ExposureAggregate}): the contract's identity and inputs, its computed metrics, the raw `gamma` only when `gex` was computed and the raw `delta` only when `dex` was. With the defaults this is {@link ContractExposure}.

/**
 * A per-contract row of a profile (see {@link ExposureAggregate}): the contract's identity and inputs,
 * its computed metrics, the raw `gamma` only when `gex` was computed and the raw `delta` only when
 * `dex` was. With the defaults this is {@link ContractExposure}.
 */
export type ContractExposureRow<G extends ExposureMetric = ExposureMetric, P extends ExposureMetric = G> = Omit<ContractExposure, ExposureMetric | 'gamma' | 'delta'> & ExposureAggregate<G, P> & ('gex' extends G ? {
    gamma: number;
} : 'gex' extends P ? {
    gamma?: number;
} : unknown) & ('dex' extends G ? {
    delta: number;
} : 'dex' extends P ? {
    delta?: number;
} : unknown);
Fields, parameters & returned members (8)
Name / typeMeaning & unitOptional / default
expiry
string

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

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

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

unitless by name
Required / declared member
No @default declared; consult the signature and description.
sign
number
Applied position sign (+1/−1) from the convention.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
strike
number

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

years (decimal)
Required / declared member
No @default declared; consult the signature and description.
type
OptionType

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

DefaultScenarioMetric

The metrics a `scenarioMap` computes when none are requested.

/** The metrics a `scenarioMap` computes when none are requested. */
export type DefaultScenarioMetric = 'gex' | 'dex' | 'vanna' | 'charm';
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

DeltaAdjustedPremium

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

export interface DeltaAdjustedPremium {
    /** Σ |delta|·premium over prints whose directional lean is bullish (bought calls / sold puts). */
    bullishPremium: number;
    /** Σ |delta|·premium over bearish prints (bought puts / sold calls). */
    bearishPremium: number;
    /** `bullishPremium − bearishPremium` — net directional delta-adjusted premium (> 0 = net bullish). */
    netDirectional: number;
    /** Σ |delta|·premium regardless of direction — the total delta-weighted premium. */
    totalDeltaAdjusted: number;
}
Fields, parameters & returned members (4)
Name / typeMeaning & unitOptional / default
bearishPremium
number
Σ |delta|·premium over bearish prints (bought puts / sold calls).
currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
bullishPremium
number
Σ |delta|·premium over prints whose directional lean is bullish (bought calls / sold puts).
currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
netDirectional
number
`bullishPremium − bearishPremium` — net directional delta-adjusted premium (> 0 = net bullish).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
totalDeltaAdjusted
number
Σ |delta|·premium regardless of direction — the total delta-weighted premium.
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

DirectionalFlowTrade

One directional flow print. `delta` is the option's signed delta at the print — caller-supplied from their own greeks (this package never fabricates greeks), keeping the compute pure.

// ───────────────────────── directional flow intelligence (spec §11.6) ─────────────────────────
/**
 * One directional flow print. `delta` is the option's signed delta at the print — caller-supplied
 * from their own greeks (this package never fabricates greeks), keeping the compute pure.
 */
export interface DirectionalFlowTrade {
    type: OptionType;
    /** Estimated aggressor side (e.g. from {@link FlowAnalysis}). */
    side: 'buy' | 'sell';
    /** Trade premium in dollars (`price · size · multiplier`). */
    premium: number;
    /** Signed option delta at the print (calls > 0, puts < 0). */
    delta: number;
}
Fields, parameters & returned members (4)
Name / typeMeaning & unitOptional / default
delta
number
Signed option delta at the print (calls > 0, puts < 0).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
premium
number
Trade premium in dollars (`price · size · multiplier`).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
side
'buy' | 'sell'
Estimated aggressor side (e.g. from {@link FlowAnalysis}).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
type
OptionType

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

ExpiryRow

A by-expiry row narrowed to the requested metrics (see {@link StrikeRow}).

/** A by-expiry row narrowed to the requested metrics (see {@link StrikeRow}). */
export type ExpiryRow<M extends ExposureMetric = ExposureMetric> = {
    expiry: string;
} & Pick<ExposureTotals, M>;
Fields, parameters & returned members (1)
Name / typeMeaning & unitOptional / default
expiry
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.

type

ExposureAggregate

The totals of a profile that computed the guaranteed metrics `G` and possibly `P`: guaranteed metrics are required, possible ones optional, everything else absent. With the defaults this is {@link ExposureTotals}.

/**
 * The totals of a profile that computed the guaranteed metrics `G` and possibly `P`: guaranteed
 * metrics are required, possible ones optional, everything else absent. With the defaults this is
 * {@link ExposureTotals}.
 */
export type ExposureAggregate<G extends ExposureMetric = ExposureMetric, P extends ExposureMetric = G> = Pick<ExposureTotals, G> & Partial<Pick<ExposureTotals, Exclude<P, G>>>;
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

ExposureConfig

Non-market exposure configuration: the sign convention and computation knobs (WS3.2).

/** Non-market exposure configuration: the sign convention and computation knobs (WS3.2). */
export interface ExposureConfig {
    /** REQUIRED sign convention; echoed in `assumptions.convention` with its caveat in diagnostics. */
    convention: ExposureConvention;
    priceSource?: PriceSource;
    /** `per1PercentMove` (default, the spec GEX formula) or `perPoint`. */
    gammaUnit?: GammaUnit;
    /** Skip contracts with time-to-expiry below this many years (default 0). */
    minTimeToExpiry?: number;
    /** Contract multiplier when a quote omits one (default 100). */
    defaultMultiplier?: number;
}
Fields, parameters & returned members (7)
Name / typeMeaning & unitOptional / default
convention
ExposureConvention
REQUIRED sign convention; echoed in `assumptions.convention` with its caveat in diagnostics.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
convention.calls
1 | -1

unitless by name
Required / declared member
No @default declared; consult the signature and description.
convention.puts
1 | -1

unitless by name
Required / declared member
No @default declared; consult the signature and description.
defaultMultiplier
number
Contract multiplier when a quote omits one (default 100).
decimal fraction / multiple
Optional
No @default declared; consult the signature and description.
gammaUnit
GammaUnit
`per1PercentMove` (default, the spec GEX formula) or `perPoint`.
unitless by name
Optional
No @default declared; consult the signature and description.
minTimeToExpiry
number
Skip contracts with time-to-expiry below this many years (default 0).
unitless by name
Optional
No @default declared; consult the signature and description.
priceSource
PriceSource

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.

type

ExposureConvention

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

export type ExposureConvention = 'callsPositivePutsNegative' | 'dealerShortGamma' | 'tradeSignedAggressor' | {
    calls: 1 | -1;
    puts: 1 | -1;
};
Fields, parameters & returned members (2)
Name / typeMeaning & unitOptional / default
calls
1 | -1

unitless by name
Required / declared member
No @default declared; consult the signature and description.
puts
1 | -1

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

ExposureInput

Input for {@link exposure}: the chain, market and convention, plus an optional metric selection.

/** Input for {@link exposure}: the chain, market and convention, plus an optional metric selection. */
export interface ExposureInput<S extends readonly ExposureMetric[] | undefined = undefined> extends ExposureShortcutInput {
    /**
     * The exposures to compute, e.g. `['gex']` or `['gex', 'dex', 'vanna']`. Omit it for the full
     * profile (every metric, exactly as before). A selection — explicit, nonempty, each name once —
     * computes only those metrics and the Black–Scholes outputs they need, and is echoed in
     * `assumptions.metrics`; uncomputed metrics are absent from the result, never zero.
     */
    metrics?: S;
}
Fields, parameters & returned members (15)
Name / typeMeaning & unitOptional / default
config
ExposureConfig

unitless by name
Required / declared member
No @default declared; consult the signature and description.
config.convention
ExposureConvention
REQUIRED sign convention; echoed in `assumptions.convention` with its caveat in diagnostics.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
config.convention.calls
1 | -1

unitless by name
Required / declared member
No @default declared; consult the signature and description.
config.convention.puts
1 | -1

unitless by name
Required / declared member
No @default declared; consult the signature and description.
config.defaultMultiplier
number
Contract multiplier when a quote omits one (default 100).
decimal fraction / multiple
Optional
No @default declared; consult the signature and description.
config.gammaUnit
GammaUnit
`per1PercentMove` (default, the spec GEX formula) or `perPoint`.
unitless by name
Optional
No @default declared; consult the signature and description.
config.minTimeToExpiry
number
Skip contracts with time-to-expiry below this many years (default 0).
unitless by name
Optional
No @default declared; consult the signature and description.
config.priceSource
PriceSource

unitless by name
Optional
No @default declared; consult the signature and description.
market
ExposureMarket

unitless by name
Required / declared member
No @default declared; consult the signature and description.
market.asOf
string | number
Snapshot time: epoch ms, `'YYYY-MM-DD'`, or a zoned ISO datetime (core `resolveAsOf` grammar).
an instant: epoch milliseconds or a YYYY-MM-DD / zoned ISO string (the resolveAsOf convention)
Required / declared member
No @default declared; consult the signature and description.
market.dividendYield
number
Continuous dividend yield; defaults to 0 when omitted.
decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
market.riskFreeRate
number

decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
market.spot
number
Spot price. Falls back to each quote's `underlyingPrice` when omitted.
unitless by name
Optional
No @default declared; consult the signature and description.
metrics
S
The exposures to compute, e.g. `['gex']` or `['gex', 'dex', 'vanna']`. Omit it for the full profile (every metric, exactly as before). A selection — explicit, nonempty, each name once — computes only those metrics and the Black–Scholes outputs they need, and is echoed in `assumptions.metrics`; uncomputed metrics are absent from the result, never zero.
unitless by name
Optional
No @default declared; consult the signature and description.
quotes
OptionQuote[]

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

ExposureMarket

Market snapshot for `exposure()` — the workspace-canonical {@link MarketInputs}, except `spot` is optional here because it falls back to each quote's `underlyingPrice` when omitted (WS3.2), and `asOf` also accepts the ONE canonical "when" grammar (core `resolveAsOf`): epoch ms, `YYYY-MM-DD` (UTC midnight), or a ZONED ISO datetime — a bare zone-less datetime throws the teaching error.

/**
 * Market snapshot for `exposure()` — the workspace-canonical {@link MarketInputs}, except `spot` is
 * optional here because it falls back to each quote's `underlyingPrice` when omitted (WS3.2), and
 * `asOf` also accepts the ONE canonical "when" grammar (core `resolveAsOf`): epoch ms, `YYYY-MM-DD`
 * (UTC midnight), or a ZONED ISO datetime — a bare zone-less datetime throws the teaching error.
 */
export type ExposureMarket = Omit<MarketInputs, 'spot' | 'asOf'> & {
    /** Spot price. Falls back to each quote's `underlyingPrice` when omitted. */
    spot?: number;
    /** Snapshot time: epoch ms, `'YYYY-MM-DD'`, or a zoned ISO datetime (core `resolveAsOf` grammar). */
    asOf: EpochMs | string;
};
Fields, parameters & returned members (4)
Name / typeMeaning & unitOptional / default
asOf
string | number
Snapshot time: epoch ms, `'YYYY-MM-DD'`, or a zoned ISO datetime (core `resolveAsOf` grammar).
an instant: epoch milliseconds or a YYYY-MM-DD / zoned ISO string (the resolveAsOf convention)
Required / declared member
No @default declared; consult the signature and description.
dividendYield
number
Continuous dividend yield; defaults to 0 when omitted.
decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
riskFreeRate
number

decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
spot
number
Spot price. Falls back to each quote's `underlyingPrice` when omitted.
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.

type

ExposureMetric

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

export type ExposureMetric = 'gex' | 'dex' | 'vega' | 'vanna' | 'charm' | 'theta' | 'vomma' | 'speed' | 'color';
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.

class

ExposureProfile

A computed exposure profile with levels, by-strike/by-expiry views, and scenario maps. R2 envelope: the sign convention and every resolved knob live in `assumptions`; model limitations ride `diagnostics.warnings` as `model.limitation` entries — nothing is hoisted top-level. SELECTIVE (selective Greeks and exposure spec, decision 11). A profile built with `exposure({ …, metrics })` — or a shortcut such as {@link gammaExposure} — computed ONLY the selected metrics and the Black–Scholes outputs they need. Its rows and `aggregate` carry exactly those metrics; an uncomputed metric is ABSENT, never zero. `G` is the set the type guarantees (a literal selection) and `P` the set that may be present (a dynamic selection); both default to every metric — the full profile `exposure()` has always returned.

export declare class ExposureProfile<G extends ExposureMetric = ExposureMetric, P extends ExposureMetric = G> {
  constructor(request: ExposureInput<undefined>);
  readonly aggregate: ExposureAggregate<G, P>;
  readonly assumptions: Assumptions<{ timeDecayDirection: 'perCalendarDayElapsed'; scanVolatilityPolicy: 'stickyStrike'; convention: { name: string; calls: number; puts: number; }; gammaUnit: GammaUnit; priceSource: PriceSource; minTimeToExpiry: number; defaultMultiplier: number; metrics?: readonly ExposureMetric[]; }>;
  atSpot(spot: number): AtSpotExposure<G, P>;
  byExpiry<M extends ExposureMetric = G>(metrics?: readonly M[]): ExpiryRow<M>[];
  byStrike<M extends ExposureMetric = G>(metrics?: readonly M[]): StrikeRow<M>[];
  readonly contracts: readonly Readonly<ContractExposureRow<G, P>>[];
  readonly diagnostics: Diagnostics;
  levels(options?: { pinRiskBand?: number; }): Levels;
  netDrift(): NetDrift;
  scenarioMap<M extends ExposureMetric = DefaultScenarioMetric>(options?: ScenarioMapOptions<M>): ScenarioMap<M>;
  readonly spot: number;
}
Fields, parameters & returned members (114)
Name / typeMeaning & unitOptional / default
(request)
ExposureInput<undefined>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(request).config
ExposureConfig

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(request).market
ExposureMarket

unitless by name
Required / declared member
No @default declared; consult the signature and description.
(request).metrics
undefined
The exposures to compute, e.g. `['gex']` or `['gex', 'dex', 'vanna']`. Omit it for the full profile (every metric, exactly as before). A selection — explicit, nonempty, each name once — computes only those metrics and the Black–Scholes outputs they need, and is echoed in `assumptions.metrics`; uncomputed metrics are absent from the result, never zero.
unitless by name
Optional
No @default declared; consult the signature and description.
(request).quotes
OptionQuote[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
aggregate
ExposureAggregate<G, P>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions
Assumptions<{ timeDecayDirection: 'perCalendarDayElapsed'; scanVolatilityPolicy: 'stickyStrike'; convention: { name: string; calls: number; puts: number; }; gammaUnit: GammaUnit; priceSource: PriceSource; minTimeToExpiry: number; defaultMultiplier: number; metrics?: readonly ExposureMetric[]; }>

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

an instant: epoch milliseconds or a YYYY-MM-DD / zoned ISO string (the resolveAsOf convention)
Optional
No @default declared; consult the signature and description.
assumptions.calendar
string

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.calendarVersion
string

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.compounding
import('@insiderfinance/totalfinance/core').InterestCompounding

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.compounding.periodsPerYear
number

per year (count)
Required / declared member
No @default declared; consult the signature and description.
assumptions.compounding.type
'periodic'

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.convention
{ name: string; calls: number; puts: number; }
The resolved sign convention (echoed; its caveat rides `diagnostics.warnings`).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.convention.calls
number

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

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

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.dayCount
import('@insiderfinance/totalfinance/core').DayCount

count (integer)
Optional
No @default declared; consult the signature and description.
assumptions.defaultMultiplier
number
Contract multiplier applied when a quote omits one.
decimal fraction / multiple
Required / declared member
No @default declared; consult the signature and description.
assumptions.dividendModel
import('@insiderfinance/totalfinance/core').DividendModel

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.engine
string

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.expiryConvention
'us-equity-close' | 'explicit-instant'
How the contract's expiry label was resolved to an instant: `'us-equity-close'` when a date-only `YYYY-MM-DD` expiry resolved to the US equity/options close — 16:00 America/New_York, or 13:00 on an early-close day; `'explicit-instant'` when the caller supplied a zoned datetime. Named so the convention is never silent (alignment spec P1.6); instrument builders own the full story in Phase 3.
unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.gammaUnit
GammaUnit
GEX unit: `per1PercentMove` (spec formula) or `perPoint`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.metrics
readonly ExposureMetric[]
The metrics this profile computed, as requested. Present only when `metrics` was passed; a profile without it is the full profile (every metric).
unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.minTimeToExpiry
number
Contracts with time-to-expiry (years) at/below this were skipped.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.model
string

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.priceSource
PriceSource
Quote price used for the IV fallback when a quote has no usable `impliedVolatility`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.scanVolatilityPolicy
'stickyStrike'
Spot-shift scans (zeroGamma, scenarioMap) hold each contract's IV fixed (sticky-strike).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.seed
number
The randomness seed this result was computed under — REQUIRED echo for a `randomness: 'seeded'` Pricer (Gate C, 2026-08-23): a stochastic result that does not name its seed cannot be replayed from the result alone. Deterministic paths never set it.
unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.timeDecayDirection
'perCalendarDayElapsed'
Charm/color are reported per calendar day ELAPSED (`−∂/∂T`), matching the passage of time.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.timeToExpiryConvention
never

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.timeToExpiryYears
number

years (decimal)
Optional
No @default declared; consult the signature and description.
assumptions.units
import('@insiderfinance/totalfinance/core').GreekUnits

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

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

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

unitless by name
Required / declared member
No @default declared; consult the signature and description.
atSpot
(spot: number) => AtSpotExposure<G, P>
Per-tick fast path: re-evaluate NET dollar-gamma (`gex`) and NET dollar-delta (`dex`) exposure at a new `spot`, holding each contract's IV, time-to-expiry, and open interest FIXED (sticky-strike, echoed in `assumptions.scanVolatilityPolicy`) — only spot moves and gamma/delta are re-evaluated. This is the intraday dashboard path (one cheap greek pass per tick); a full {@link exposure} re-run — which re-derives IV, the extended greeks, and levels — is the per-refresh path. At the profile's original spot this reproduces `aggregate.gex`/`aggregate.dex` exactly (same operations, same order). A selective profile re-evaluates only what it selected: a {@link gammaExposure} profile returns `{ gex }` and computes gamma alone. A profile that selected neither `gex` nor `dex` refuses.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
atSpot(spot)
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
byExpiry
<M extends ExposureMetric = G>(metrics?: readonly M[]) => ExpiryRow<M>[]
Chart-ready by-expiry profile (one row per expiry), narrowed to `metrics` — by default this profile's own metrics. A metric this profile did not compute is refused.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
byExpiry(metrics)
readonly M[] | undefined

unitless by name
Optional
No @default declared; consult the signature and description.
byStrike
<M extends ExposureMetric = G>(metrics?: readonly M[]) => StrikeRow<M>[]
Chart-ready by-strike profile (one row per strike, totals summed), narrowed to `metrics` — by default this profile's own metrics (every metric for a full profile). When `'gex'` is requested each row ALSO carries the call/put split — `callGex`/`putGex`/`callOpenInterest`/`putOpenInterest` (the {@link GexSplit} columns) — for the canonical dashboard chart (call bars up, put bars down). `callGex + putGex` equals the row's net `gex` and `callOpenInterest + putOpenInterest` the strike's total OI (WS4.5). A metric this profile did not compute is refused, not reported as zero.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
byStrike(metrics)
readonly M[] | undefined

unitless by name
Optional
No @default declared; consult the signature and description.
contracts
readonly Readonly<ContractExposureRow<G, P>>[]
Frozen result rows — a profile is a snapshot; mutate a copy, never the result.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics
Diagnostics

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.autoReason
string
When a meta-engine (e.g. `engines.auto()`) selected a delegate, this is a one-sentence, human-readable explanation of WHY that delegate was chosen (`engine` then names the delegate). Absent when no auto-selection took place.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.converged
boolean
Whether an iterative procedure converged. `false` means the value is not trustworthy.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.decomposition
Record<string, number>
Named intermediate quantities the value decomposes into — a par spread's protection leg and risky annuity, a forward variance's near/far legs. The H-series explain paths disclose their arithmetic here so a caller can audit the ratio, not just receive it (3B.3).
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.engine
string
Pricing/solver engine name, e.g. `black-scholes-merton`.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.finiteDifferenceBumps
Record<string, number>
Finite-difference engines: the ACTUAL bump sizes used for FD Greeks (spec P2.3) — adaptive near the vol/time boundaries, so the caller can see exactly what was differenced. Keys: `spotStep`, `volatilityStep`, `timeStepYears`, `rateStep`, and — extended Greeks only — `dividendYieldStep`. Each is the actual step differenced, in the unit of the coordinate it bumps. (This doc named the retired `hS`/`hSig`/`hT`/`hR`/`hQ` keys for one release after the emit sites had moved to the semantic names, so a caller following it read `undefined`.)
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.iterations
number
Iteration count for iterative methods.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.method
string
Numerical method, e.g. `closed-form`, `brent`, `finite-difference`.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.selection
import('@insiderfinance/totalfinance/core/pricing').SelectionReport
The structured engine-selection report (Gate C, `@insiderfinance/totalfinance/core/pricing`): who was selected, why, and — for automatic selection — every candidate considered with its verdict. This is the machine-readable superset of `engine` + `autoReason` (which remain for compatibility); `selected.name` always agrees with `engine` when both are present.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.selection.candidates
readonly import('@insiderfinance/totalfinance/core/pricing').SelectionCandidate[]
Candidates an automatic selection considered; absent for explicit mode.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.selection.mode
'explicit' | 'automatic'

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.reason
string
Why the selected engine answers this request.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.selected
{ name: string; version?: string; }

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

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.selected.version
string

unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.timingMs
number
Wall-clock timing in milliseconds, when measured.
milliseconds
Optional
No @default declared; consult the signature and description.
diagnostics.warmup
number
Series facades: number of leading output slots that are warmup sentinels (null/NaN) while the computation seeds. Equals the input length when the indicator never emitted.
unitless by name
Optional
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.
levels
(options?: { pinRiskBand?: number; }) => Levels
Dealer-positioning levels (walls, zero-gamma, max pain, pin risk). On a selective profile this computes what it reads — per-contract gex, gamma, vanna and charm at the profile's spot, plus a gamma-only zero-gamma sweep — and returns exactly what a full profile returns.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.callWall
number | null
Strike with the largest summed |call GEX| across ALL expiries (resistance). Magnitude, not signed: the wall is where the most call gamma sits, which is the same strike whichever way the convention signs it.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.charmWall
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.gammaFlips
number[]
All interpolated gamma-flip levels in [0.8·spot, 1.2·spot], sorted ascending (may be empty).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.gammaRegime
'positive' | 'negative' | null
Direction at the current spot: `positive` (mean-reverting) or `negative` (trending), or null.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.largestCallOpenInterest
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.largestPutOpenInterest
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.maxGammaStrike
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.maxPain
number | null
Strike minimizing total in-the-money option value to holders (max writer profit), computed for the NEAREST expiry only — max pain is expiry-specific and cannot be aggregated across expirations.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.minGammaStrike
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.monthlyOpexWall
number | null
Largest net-|GEX| strike (calls + puts summed per strike) in the nearest monthly OPEX (3rd-Friday).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.pinRisk
{ strike: number; atRisk: boolean; } | null
Nearest high-gamma strike to spot, with `atRisk` true when spot is within `pinRiskBand`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.pinRisk.atRisk
boolean

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

unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.putWall
number | null
Strike with the largest summed |put GEX| across ALL expiries, under the convention (support).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.vannaWall
number | null

unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.weeklyOpexWall
number | null
Largest net-|GEX| strike (calls + puts summed per strike) in the nearest Friday (weekly) expiry.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.zeroDaysToExpiryWall
number | null
Largest net-|GEX| strike (calls + puts summed per strike) among 0DTE contracts — expiring on the snapshot's own **America/New_York** trading date (not its UTC date: after 20:00 ET the UTC date is already tomorrow, which flagged the NEXT session's expiry as 0DTE).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels().return.zeroGamma
number | null
Spot level where net GEX flips sign, chosen as the interpolated gamma-flip NEAREST spot when the profile has more than one flip in [0.8·spot, 1.2·spot]. Null when no flip exists in range.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
levels(options)
{ pinRiskBand?: number; }

unitless by name
Optional
No @default declared; consult the signature and description.
levels(options).pinRiskBand
number

unitless by name
Optional
No @default declared; consult the signature and description.
netDrift
() => NetDrift
Net dealer-hedging drift estimate (spec §11.5): the gamma regime (pinning vs trending), the zero-gamma attractor, and the aggregate charm/vanna hedging flows that push spot over time and as vol moves. An ESTIMATE from the positioning model — not a price forecast. An empty or identically-zero book has no gamma structure: `zeroGamma`/`distanceToZeroGamma`/`gammaRegime`/ `bias` are all `null` (never fabricated), and the charm/vanna flows echo the (zero) aggregate. On a selective profile the charm and vanna aggregates are computed here if they were not selected.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
netDrift().return.bias
'trend' | 'pin' | null
`pin` (gamma pulls spot toward zero-gamma) / `trend` (pushes away) / null.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
netDrift().return.charmFlowPerDay
number
Aggregate charm exposure: signed dealer delta to re-hedge as ONE calendar day ELAPSES (drift into expiry). Positive ⇒ dealers accumulate long delta day-over-day. Uses the elapsed-time sign (`−∂DEX/∂T` per day), so it reads the same direction as the passage of time.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
netDrift().return.distanceToZeroGamma
number | null
Signed distance from spot to zero-gamma as a fraction of spot (positive ⇒ flip is above spot).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
netDrift().return.gammaRegime
'positive' | 'negative' | null
`positive` (mean-reverting/pinning) or `negative` (trending), or null.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
netDrift().return.vannaFlowPerVolatilityPoint
number
Aggregate vanna exposure: signed dealer delta to re-hedge per +1 VOL POINT (a +0.01 move in implied volatility), matching the per-1%-move convention `gex` uses. The unit is in the name because the value is 100x smaller than a per-unit-volatility reading of the same greek.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
netDrift().return.zeroGamma
number | null
The zero-gamma level (gamma flip) — the attractor in positive gamma, repeller in negative.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.aggregate
ExposureAggregate<G, P>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.assumptions
Assumptions<{ timeDecayDirection: 'perCalendarDayElapsed'; scanVolatilityPolicy: 'stickyStrike'; convention: { name: string; calls: number; puts: number; }; gammaUnit: GammaUnit; priceSource: PriceSource; minTimeToExpiry: number; defaultMultiplier: number; metrics?: readonly ExposureMetric[]; }>

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.atSpot
(spot: number) => AtSpotExposure<G, P>
Per-tick fast path: re-evaluate NET dollar-gamma (`gex`) and NET dollar-delta (`dex`) exposure at a new `spot`, holding each contract's IV, time-to-expiry, and open interest FIXED (sticky-strike, echoed in `assumptions.scanVolatilityPolicy`) — only spot moves and gamma/delta are re-evaluated. This is the intraday dashboard path (one cheap greek pass per tick); a full {@link exposure} re-run — which re-derives IV, the extended greeks, and levels — is the per-refresh path. At the profile's original spot this reproduces `aggregate.gex`/`aggregate.dex` exactly (same operations, same order). A selective profile re-evaluates only what it selected: a {@link gammaExposure} profile returns `{ gex }` and computes gamma alone. A profile that selected neither `gex` nor `dex` refuses.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.byExpiry
<M extends ExposureMetric = G>(metrics?: readonly M[]) => ExpiryRow<M>[]
Chart-ready by-expiry profile (one row per expiry), narrowed to `metrics` — by default this profile's own metrics. A metric this profile did not compute is refused.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.byStrike
<M extends ExposureMetric = G>(metrics?: readonly M[]) => StrikeRow<M>[]
Chart-ready by-strike profile (one row per strike, totals summed), narrowed to `metrics` — by default this profile's own metrics (every metric for a full profile). When `'gex'` is requested each row ALSO carries the call/put split — `callGex`/`putGex`/`callOpenInterest`/`putOpenInterest` (the {@link GexSplit} columns) — for the canonical dashboard chart (call bars up, put bars down). `callGex + putGex` equals the row's net `gex` and `callOpenInterest + putOpenInterest` the strike's total OI (WS4.5). A metric this profile did not compute is refused, not reported as zero.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.contracts
readonly Readonly<ContractExposureRow<G, P>>[]
Frozen result rows — a profile is a snapshot; mutate a copy, never the result.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.diagnostics
Diagnostics

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.levels
(options?: { pinRiskBand?: number; }) => Levels
Dealer-positioning levels (walls, zero-gamma, max pain, pin risk). On a selective profile this computes what it reads — per-contract gex, gamma, vanna and charm at the profile's spot, plus a gamma-only zero-gamma sweep — and returns exactly what a full profile returns.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.netDrift
() => NetDrift
Net dealer-hedging drift estimate (spec §11.5): the gamma regime (pinning vs trending), the zero-gamma attractor, and the aggregate charm/vanna hedging flows that push spot over time and as vol moves. An ESTIMATE from the positioning model — not a price forecast. An empty or identically-zero book has no gamma structure: `zeroGamma`/`distanceToZeroGamma`/`gammaRegime`/ `bias` are all `null` (never fabricated), and the charm/vanna flows echo the (zero) aggregate. On a selective profile the charm and vanna aggregates are computed here if they were not selected.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.scenarioMap
<M extends ExposureMetric = DefaultScenarioMetric>(options?: ScenarioMapOptions<M>) => ScenarioMap<M>
Recompute aggregate metrics across a spot × volatilityShock × time grid. With no `metrics` the default set is `['gex','dex','vanna','charm']` — and the return type narrows to exactly those, so it never over-claims the metrics not actually computed (WS2.4). Each cell evaluates only the Black–Scholes outputs its metrics need, in one shared pass (`['gex']` evaluates gamma alone). A scenario is an explicitly requested analysis, so it may use any metric, whatever this profile selected.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.spot
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
scenarioMap
<M extends ExposureMetric = DefaultScenarioMetric>(options?: ScenarioMapOptions<M>) => ScenarioMap<M>
Recompute aggregate metrics across a spot × volatilityShock × time grid. With no `metrics` the default set is `['gex','dex','vanna','charm']` — and the return type narrows to exactly those, so it never over-claims the metrics not actually computed (WS2.4). Each cell evaluates only the Black–Scholes outputs its metrics need, in one shared pass (`['gex']` evaluates gamma alone). A scenario is an explicitly requested analysis, so it may use any metric, whatever this profile selected.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
scenarioMap().return.cells
ScenarioCell<M>[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
scenarioMap().return.evaluations
number
Total greek recomputations performed (for the acceleration-need benchmark).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
scenarioMap().return.metrics
M[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
scenarioMap(options)
ScenarioMapOptions<M>

unitless by name
Optional
No @default declared; consult the signature and description.
scenarioMap(options).metrics
readonly M[]
Which metrics to compute. Default `['gex','dex','vanna','charm']`.
unitless by name
Optional
No @default declared; consult the signature and description.
scenarioMap(options).spot
number[] | { from: number; to: number; steps: number; }
Spot grid: explicit prices, or `{ from, to, steps }`. Defaults to ±10% around spot, 41 steps.
unitless by name
Optional
No @default declared; consult the signature and description.
scenarioMap(options).spot.from
number

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

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

unitless by name
Required / declared member
No @default declared; consult the signature and description.
scenarioMap(options).timeAdvance
number[]
Years to advance time (reducing each T), e.g. `[0, 1/365]`. Default `[0]`.
unitless by name
Optional
No @default declared; consult the signature and description.
scenarioMap(options).volatilityShock
number[]
Additive vol shocks (decimal), e.g. `[-0.05, 0, 0.05]`. Default `[0]`.
unitless by name
Optional
No @default declared; consult the signature and description.
spot
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

ExposureShortcutInput

The chain, market and sign convention every exposure takes — the input of the single-metric shortcuts.

/** The chain, market and sign convention every exposure takes — the input of the single-metric shortcuts. */
export interface ExposureShortcutInput {
    quotes: OptionQuote[];
    market: ExposureMarket;
    config: ExposureConfig;
}
Fields, parameters & returned members (14)
Name / typeMeaning & unitOptional / default
config
ExposureConfig

unitless by name
Required / declared member
No @default declared; consult the signature and description.
config.convention
ExposureConvention
REQUIRED sign convention; echoed in `assumptions.convention` with its caveat in diagnostics.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
config.convention.calls
1 | -1

unitless by name
Required / declared member
No @default declared; consult the signature and description.
config.convention.puts
1 | -1

unitless by name
Required / declared member
No @default declared; consult the signature and description.
config.defaultMultiplier
number
Contract multiplier when a quote omits one (default 100).
decimal fraction / multiple
Optional
No @default declared; consult the signature and description.
config.gammaUnit
GammaUnit
`per1PercentMove` (default, the spec GEX formula) or `perPoint`.
unitless by name
Optional
No @default declared; consult the signature and description.
config.minTimeToExpiry
number
Skip contracts with time-to-expiry below this many years (default 0).
unitless by name
Optional
No @default declared; consult the signature and description.
config.priceSource
PriceSource

unitless by name
Optional
No @default declared; consult the signature and description.
market
ExposureMarket

unitless by name
Required / declared member
No @default declared; consult the signature and description.
market.asOf
string | number
Snapshot time: epoch ms, `'YYYY-MM-DD'`, or a zoned ISO datetime (core `resolveAsOf` grammar).
an instant: epoch milliseconds or a YYYY-MM-DD / zoned ISO string (the resolveAsOf convention)
Required / declared member
No @default declared; consult the signature and description.
market.dividendYield
number
Continuous dividend yield; defaults to 0 when omitted.
decimal rate (0.05 = 5%)
Optional
No @default declared; consult the signature and description.
market.riskFreeRate
number

decimal rate (0.05 = 5%)
Required / declared member
No @default declared; consult the signature and description.
market.spot
number
Spot price. Falls back to each quote's `underlyingPrice` when omitted.
unitless by name
Optional
No @default declared; consult the signature and description.
quotes
OptionQuote[]

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

ExposureTotals

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

export interface ExposureTotals {
    /** Dollar gamma exposure (`Γ·OI·mult·spot²·0.01` per-1%-move, signed by convention). */
    gex: number;
    /** Dollar delta exposure (`Δ·OI·mult·spot`). */
    dex: number;
    /** Vega exposure (`vega/1%·OI·mult`). */
    vega: number;
    /** Vanna exposure: dollar-delta change per +1% vol. */
    vanna: number;
    /**
     * Charm exposure: signed dollar-delta change as ONE calendar day ELAPSES (positive ⇒ dealer delta
     * increases day-over-day). Reported as `−∂DEX/∂T` per day, so its sign matches the passage of time.
     */
    charm: number;
    /** Theta exposure: dollar option-price decay per calendar day. */
    theta: number;
    /** Vomma (volga) exposure: change in vega exposure per +1% vol. */
    vomma: number;
    /**
     * Speed exposure: the CHANGE IN `gex` for a **+1% spot move**, in the same unit as `gex`
     * (`gammaUnit`). It is the full derivative of the GEX definition, not the bare third-order greek:
     * per-1%-move, `Δgex = (speed·S + 2·Γ)·OI·mult·sign·S²·1e-4`; per-point, `(speed·S + Γ)·OI·mult·sign·S·0.01`.
     * So `aggregate.speed ≈ atSpot(spot·1.01).gex − atSpot(spot).gex` (a first-order estimate of it).
     */
    speed: number;
    /**
     * Color exposure: signed change in GEX as ONE calendar day ELAPSES (`−∂GEX/∂T` per day), in the
     * same unit as `gex` (`gammaUnit`), so a positive value means dealer gamma exposure grows as time
     * passes. Per 1% move it is `−color·OI·mult·sign·S²·0.01/365`; per point, `−color·OI·mult·sign·S/365`.
     */
    color: number;
}
Fields, parameters & returned members (9)
Name / typeMeaning & unitOptional / default
charm
number
Charm exposure: signed dollar-delta change as ONE calendar day ELAPSES (positive ⇒ dealer delta increases day-over-day). Reported as `−∂DEX/∂T` per day, so its sign matches the passage of time.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
color
number
Color exposure: signed change in GEX as ONE calendar day ELAPSES (`−∂GEX/∂T` per day), in the same unit as `gex` (`gammaUnit`), so a positive value means dealer gamma exposure grows as time passes. Per 1% move it is `−color·OI·mult·sign·S²·0.01/365`; per point, `−color·OI·mult·sign·S/365`.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
dex
number
Dollar delta exposure (`Δ·OI·mult·spot`).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
gex
number
Dollar gamma exposure (`Γ·OI·mult·spot²·0.01` per-1%-move, signed by convention).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
speed
number
Speed exposure: the CHANGE IN `gex` for a **+1% spot move**, in the same unit as `gex` (`gammaUnit`). It is the full derivative of the GEX definition, not the bare third-order greek: per-1%-move, `Δgex = (speed·S + 2·Γ)·OI·mult·sign·S²·1e-4`; per-point, `(speed·S + Γ)·OI·mult·sign·S·0.01`. So `aggregate.speed ≈ atSpot(spot·1.01).gex − atSpot(spot).gex` (a first-order estimate of it).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
theta
number
Theta exposure: dollar option-price decay per calendar day.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
vanna
number
Vanna exposure: dollar-delta change per +1% vol.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
vega
number
Vega exposure (`vega/1%·OI·mult`).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
vomma
number
Vomma (volga) exposure: change in vega exposure per +1% vol.
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.

class

FlowAnalysis

Result of analyzing a stream of option trades. R2 envelope: the rules/windows ride `assumptions` and the heuristic caveats ride `diagnostics.warnings` as `model.limitation` entries — nothing is hoisted top-level.

export declare class FlowAnalysis {
  constructor(rawTrades: OptionTrade[], options?: FlowOptions);
  readonly assumptions: Assumptions<{ nbboRule: 'quote-rule-midpoint-unknown'; classificationSource: FlowClassificationSource; sweepWindowMs: number; spreadWindowMs: number; sweepMinPrints: number; blockMinSize: number; blockMinPremium: number; multiplier: number; venueVerifiedSweeps: boolean; }>;
  blocks: ClassifiedTrade[];
  callPutPremium(): CallPutPremium;
  readonly diagnostics: Diagnostics;
  groupBy(keys: Array<keyof FlowGroupKey>): FlowGroup[];
  rank(groups: FlowGroup[], options?: RankOptions): FlowGroup[];
  readonly spreads: readonly Readonly<Spread>[];
  readonly sweeps: readonly Readonly<Sweep>[];
  readonly trades: readonly Readonly<ClassifiedTrade>[];
  zeroDaysToExpiry: ClassifiedTrade[];
}
Fields, parameters & returned members (88)
Name / typeMeaning & unitOptional / default
(options)
FlowOptions

unitless by name
Optional
No @default declared; consult the signature and description.
(options).blockMinPremium
number
...or at/above this premium (price·size·multiplier). Default 100_000.
currency amount (the field or record currency)
Optional
No @default declared; consult the signature and description.
(options).blockMinSize
number
A single print is a block at/above this size (contracts). Default 100.
count (integer)
Optional
No @default declared; consult the signature and description.
(options).classificationSource
FlowClassificationSource
Classification authority/fallback rule. Default `'provided-or-quotes'` (legacy behavior).
unitless by name
Optional
No @default declared; consult the signature and description.
(options).multiplier
number
Contract multiplier when a trade omits one. Default 100.
unitless by name
Optional
No @default declared; consult the signature and description.
(options).spreadWindowMs
number
Prints on one underlying within this window (ms) across ≥2 contracts form a spread. Default 100.
milliseconds
Optional
No @default declared; consult the signature and description.
(options).sweepMinPrints
number
Minimum prints to call a cluster a sweep. Default 3.
unitless by name
Optional
No @default declared; consult the signature and description.
(options).sweepWindowMs
number
Prints on one contract within this window (ms), same side, count as one sweep. Default 500.
milliseconds
Optional
No @default declared; consult the signature and description.
(rawTrades)
OptionTrade[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions
Assumptions<{ nbboRule: 'quote-rule-midpoint-unknown'; classificationSource: FlowClassificationSource; sweepWindowMs: number; spreadWindowMs: number; sweepMinPrints: number; blockMinSize: number; blockMinPremium: number; multiplier: number; venueVerifiedSweeps: boolean; }>
The rules/windows the analysis ran under — echoed so a serialized report is self-interpreting.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.asOf
number

an instant: epoch milliseconds or a YYYY-MM-DD / zoned ISO string (the resolveAsOf convention)
Optional
No @default declared; consult the signature and description.
assumptions.blockMinPremium
number

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
assumptions.blockMinSize
number

count (integer)
Required / declared member
No @default declared; consult the signature and description.
assumptions.calendar
string

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.calendarVersion
string

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.classificationSource
FlowClassificationSource

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

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.compounding.periodsPerYear
number

per year (count)
Required / declared member
No @default declared; consult the signature and description.
assumptions.compounding.type
'periodic'

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.dayCount
import('@insiderfinance/totalfinance/core').DayCount

count (integer)
Optional
No @default declared; consult the signature and description.
assumptions.dividendModel
import('@insiderfinance/totalfinance/core').DividendModel

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.engine
string

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.expiryConvention
'us-equity-close' | 'explicit-instant'
How the contract's expiry label was resolved to an instant: `'us-equity-close'` when a date-only `YYYY-MM-DD` expiry resolved to the US equity/options close — 16:00 America/New_York, or 13:00 on an early-close day; `'explicit-instant'` when the caller supplied a zoned datetime. Named so the convention is never silent (alignment spec P1.6); instrument builders own the full story in Phase 3.
unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.model
string

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.multiplier
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.nbboRule
'quote-rule-midpoint-unknown'
The aggressor rule actually applied: the NBBO **quote rule** (at/above ask ⇒ buy, at/below bid ⇒ sell, strictly inside ⇒ compare to the midpoint, AT the midpoint ⇒ `unknown`). It is NOT Lee–Ready, which resolves midpoint prints with a **tick test** against the previous trade — this package never sees a trade's predecessor price, so it declines instead of guessing.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.seed
number
The randomness seed this result was computed under — REQUIRED echo for a `randomness: 'seeded'` Pricer (Gate C, 2026-08-23): a stochastic result that does not name its seed cannot be replayed from the result alone. Deterministic paths never set it.
unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.spreadWindowMs
number

milliseconds
Required / declared member
No @default declared; consult the signature and description.
assumptions.sweepMinPrints
number

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

milliseconds
Required / declared member
No @default declared; consult the signature and description.
assumptions.timeToExpiryConvention
never

unitless by name
Optional
No @default declared; consult the signature and description.
assumptions.timeToExpiryYears
number

years (decimal)
Optional
No @default declared; consult the signature and description.
assumptions.units
import('@insiderfinance/totalfinance/core').GreekUnits

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

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

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

unitless by name
Required / declared member
No @default declared; consult the signature and description.
assumptions.venueVerifiedSweeps
boolean
Whether any print carried an `exchange`, enabling venue-verified sweep detection (WS2.13).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
blocks
ClassifiedTrade[]
Blocks: single prints large by size or premium.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
callPutPremium
() => CallPutPremium
Call-vs-put premium and volume across all trades, with put/call ratios and net premium.
currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
callPutPremium().return.callPremium
number

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
callPutPremium().return.callVolume
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
callPutPremium().return.netPremium
number
Net directional premium across all trades (buy − sell).
currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
callPutPremium().return.putCallPremiumRatio
number | null
Put ÷ call premium ($); `null` when there is no call premium.
decimal fraction / multiple
Required / declared member
No @default declared; consult the signature and description.
callPutPremium().return.putCallVolumeRatio
number | null
Put ÷ call traded volume (contracts); `null` when there is no call volume.
decimal fraction / multiple
Required / declared member
No @default declared; consult the signature and description.
callPutPremium().return.putPremium
number

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
callPutPremium().return.putVolume
number

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics
Diagnostics
Structured warnings: `model.limitation` caveats plus any data-quality flags.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.autoReason
string
When a meta-engine (e.g. `engines.auto()`) selected a delegate, this is a one-sentence, human-readable explanation of WHY that delegate was chosen (`engine` then names the delegate). Absent when no auto-selection took place.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.converged
boolean
Whether an iterative procedure converged. `false` means the value is not trustworthy.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.decomposition
Record<string, number>
Named intermediate quantities the value decomposes into — a par spread's protection leg and risky annuity, a forward variance's near/far legs. The H-series explain paths disclose their arithmetic here so a caller can audit the ratio, not just receive it (3B.3).
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.engine
string
Pricing/solver engine name, e.g. `black-scholes-merton`.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.finiteDifferenceBumps
Record<string, number>
Finite-difference engines: the ACTUAL bump sizes used for FD Greeks (spec P2.3) — adaptive near the vol/time boundaries, so the caller can see exactly what was differenced. Keys: `spotStep`, `volatilityStep`, `timeStepYears`, `rateStep`, and — extended Greeks only — `dividendYieldStep`. Each is the actual step differenced, in the unit of the coordinate it bumps. (This doc named the retired `hS`/`hSig`/`hT`/`hR`/`hQ` keys for one release after the emit sites had moved to the semantic names, so a caller following it read `undefined`.)
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.iterations
number
Iteration count for iterative methods.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.method
string
Numerical method, e.g. `closed-form`, `brent`, `finite-difference`.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.selection
import('@insiderfinance/totalfinance/core/pricing').SelectionReport
The structured engine-selection report (Gate C, `@insiderfinance/totalfinance/core/pricing`): who was selected, why, and — for automatic selection — every candidate considered with its verdict. This is the machine-readable superset of `engine` + `autoReason` (which remain for compatibility); `selected.name` always agrees with `engine` when both are present.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.selection.candidates
readonly import('@insiderfinance/totalfinance/core/pricing').SelectionCandidate[]
Candidates an automatic selection considered; absent for explicit mode.
unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.selection.mode
'explicit' | 'automatic'

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.reason
string
Why the selected engine answers this request.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.selected
{ name: string; version?: string; }

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

unitless by name
Required / declared member
No @default declared; consult the signature and description.
diagnostics.selection.selected.version
string

unitless by name
Optional
No @default declared; consult the signature and description.
diagnostics.timingMs
number
Wall-clock timing in milliseconds, when measured.
milliseconds
Optional
No @default declared; consult the signature and description.
diagnostics.warmup
number
Series facades: number of leading output slots that are warmup sentinels (null/NaN) while the computation seeds. Equals the input length when the indicator never emitted.
unitless by name
Optional
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.
groupBy
(keys: Array<keyof FlowGroupKey>) => FlowGroup[]
Aggregate trades into groups keyed by any subset of underlying/expiry/strike/type.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
groupBy(keys)
(keyof FlowGroupKey)[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
rank
(groups: FlowGroup[], options?: RankOptions) => FlowGroup[]
Filter and sort groups (default: by premium, descending).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
rank(groups)
FlowGroup[]

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

unitless by name
Optional
No @default declared; consult the signature and description.
rank(options).by
RankByKey
Ranking metric (default `'premium'`).
unitless by name
Optional
No @default declared; consult the signature and description.
rank(options).limit
number
Maximum returned groups; a non-negative safe integer. Omit for every group.
unitless by name
Optional
No @default declared; consult the signature and description.
rank(options).minPremium
number
Exclude groups below this aggregate premium.
currency amount (the field or record currency)
Optional
No @default declared; consult the signature and description.
rank(options).minVolumeOpenInterestRatio
number
Exclude groups below this volume/open-interest ratio.
decimal fraction / multiple
Optional
No @default declared; consult the signature and description.
return.assumptions
Assumptions<{ nbboRule: 'quote-rule-midpoint-unknown'; classificationSource: FlowClassificationSource; sweepWindowMs: number; spreadWindowMs: number; sweepMinPrints: number; blockMinSize: number; blockMinPremium: number; multiplier: number; venueVerifiedSweeps: boolean; }>
The rules/windows the analysis ran under — echoed so a serialized report is self-interpreting.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.blocks
ClassifiedTrade[]
Blocks: single prints large by size or premium.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.callPutPremium
() => CallPutPremium
Call-vs-put premium and volume across all trades, with put/call ratios and net premium.
currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
return.diagnostics
Diagnostics
Structured warnings: `model.limitation` caveats plus any data-quality flags.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.groupBy
(keys: Array<keyof FlowGroupKey>) => FlowGroup[]
Aggregate trades into groups keyed by any subset of underlying/expiry/strike/type.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.rank
(groups: FlowGroup[], options?: RankOptions) => FlowGroup[]
Filter and sort groups (default: by premium, descending).
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.spreads
readonly Readonly<Spread>[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.sweeps
readonly Readonly<Sweep>[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.trades
readonly Readonly<ClassifiedTrade>[]
Frozen result arrays — an analysis is a snapshot; mutate a copy, never the result.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
return.zeroDaysToExpiry
ClassifiedTrade[]
0DTE trades: prints on a contract expiring the same calendar day.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
spreads
readonly Readonly<Spread>[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
sweeps
readonly Readonly<Sweep>[]

unitless by name
Required / declared member
No @default declared; consult the signature and description.
trades
readonly Readonly<ClassifiedTrade>[]
Frozen result arrays — an analysis is a snapshot; mutate a copy, never the result.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
zeroDaysToExpiry
ClassifiedTrade[]
0DTE trades: prints on a contract expiring the same calendar day.
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

FlowClassificationProvenance

Lineage of the classification, not a claim that a provider label is exchange-confirmed.

/** Lineage of the classification, not a claim that a provider label is exchange-confirmed. */
export interface FlowClassificationProvenance {
    policy: FlowClassificationSource;
    source: 'provided' | 'quotes' | 'unavailable';
    /** `null` means absent; `'unknown'` means the provider explicitly declined to classify. */
    providedSide: AggressorSide | null;
    reason: 'provided' | 'provided-missing' | 'quotes-missing' | 'quotes-locked-or-crossed' | 'quote-midpoint' | 'quote-rule';
}
Fields, parameters & returned members (4)
Name / typeMeaning & unitOptional / default
policy
FlowClassificationSource

unitless by name
Required / declared member
No @default declared; consult the signature and description.
providedSide
AggressorSide | null
`null` means absent; `'unknown'` means the provider explicitly declined to classify.
unitless by name
Required / declared member
No @default declared; consult the signature and description.
reason
'provided' | 'provided-missing' | 'quotes-missing' | 'quotes-locked-or-crossed' | 'quote-midpoint' | 'quote-rule'

unitless by name
Required / declared member
No @default declared; consult the signature and description.
source
'unavailable' | 'quotes' | 'provided'

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

FlowClassificationSource

`provided-or-quotes` is the backwards-compatible rule: supplied buy/sell wins, but unknown or absent classification falls through to quotes. `provided-first` preserves supplied unknowns and uses quotes only when classification is absent. `provided-only` never infers from quotes; `quotes-only` ignores supplied classifications (but still validates their enum).

/**
 * `provided-or-quotes` is the backwards-compatible rule: supplied buy/sell wins, but unknown or
 * absent classification falls through to quotes. `provided-first` preserves supplied unknowns
 * and uses quotes only when classification is absent. `provided-only` never infers from quotes;
 * `quotes-only` ignores supplied classifications (but still validates their enum).
 */
export type FlowClassificationSource = 'provided-or-quotes' | 'provided-first' | 'provided-only' | 'quotes-only';
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

FlowGroup

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

export interface FlowGroup extends FlowGroupKey {
    trades: number;
    size: number;
    premium: number;
    buyPremium: number;
    sellPremium: number;
    /** Net premium (buy − sell). */
    netPremium: number;
    /**
     * Volume/open-interest ratio when grouped to a single contract with known OI, else `null`
     * (chart-facing rows use JSON-safe `null`, never `undefined` or `NaN` — WS2.12).
     */
    volumeOpenInterestRatio: number | null;
}
Fields, parameters & returned members (11)
Name / typeMeaning & unitOptional / default
buyPremium
number

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
expiry
string

unitless by name
Optional
No @default declared; consult the signature and description.
netPremium
number
Net premium (buy − sell).
currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
premium
number

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

currency amount (the field or record currency)
Required / declared member
No @default declared; consult the signature and description.
size
number

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

unitless by name
Optional
No @default declared; consult the signature and description.
trades
number

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

unitless by name
Optional
No @default declared; consult the signature and description.
underlying
string

unitless by name
Optional
No @default declared; consult the signature and description.
volumeOpenInterestRatio
number | null
Volume/open-interest ratio when grouped to a single contract with known OI, else `null` (chart-facing rows use JSON-safe `null`, never `undefined` or `NaN` — WS2.12).
decimal fraction / multiple
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

FlowGroupKey

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

export interface FlowGroupKey {
    underlying?: string;
    expiry?: string;
    strike?: number;
    type?: OptionType;
}
Fields, parameters & returned members (4)
Name / typeMeaning & unitOptional / default
expiry
string

unitless by name
Optional
No @default declared; consult the signature and description.
strike
number

unitless by name
Optional
No @default declared; consult the signature and description.
type
OptionType

unitless by name
Optional
No @default declared; consult the signature and description.
underlying
string

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

FlowOptions

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

export interface FlowOptions {
    /** Classification authority/fallback rule. Default `'provided-or-quotes'` (legacy behavior). */
    classificationSource?: FlowClassificationSource;
    /** A single print is a block at/above this size (contracts). Default 100. */
    blockMinSize?: number;
    /** ...or at/above this premium (price·size·multiplier). Default 100_000. */
    blockMinPremium?: number;
    /** Prints on one contract within this window (ms), same side, count as one sweep. Default 500. */
    sweepWindowMs?: number;
    /** Minimum prints to call a cluster a sweep. Default 3. */
    sweepMinPrints?: number;
    /** Prints on one underlying within this window (ms) across ≥2 contracts form a spread. Default 100. */
    spreadWindowMs?: number;
    /** Contract multiplier when a trade omits one. Default 100. */
    multiplier?: number;
}
Fields, parameters & returned members (7)
Name / typeMeaning & unitOptional / default
blockMinPremium
number
...or at/above this premium (price·size·multiplier). Default 100_000.
currency amount (the field or record currency)
Optional
No @default declared; consult the signature and description.
blockMinSize
number
A single print is a block at/above this size (contracts). Default 100.
count (integer)
Optional
No @default declared; consult the signature and description.
classificationSource
FlowClassificationSource
Classification authority/fallback rule. Default `'provided-or-quotes'` (legacy behavior).
unitless by name
Optional
No @default declared; consult the signature and description.
multiplier
number
Contract multiplier when a trade omits one. Default 100.
unitless by name
Optional
No @default declared; consult the signature and description.
spreadWindowMs
number
Prints on one underlying within this window (ms) across ≥2 contracts form a spread. Default 100.
milliseconds
Optional
No @default declared; consult the signature and description.
sweepMinPrints
number
Minimum prints to call a cluster a sweep. Default 3.
unitless by name
Optional
No @default declared; consult the signature and description.
sweepWindowMs
number
Prints on one contract within this window (ms), same side, count as one sweep. Default 500.
milliseconds
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.