`blackScholes.evaluate` — a selected calculation with its `.explain` companion. An empty
selection is refused at run time (`input.out_of_range`).
/**
* `blackScholes.evaluate` — a selected calculation with its `.explain` companion. An empty
* selection is refused at run time (`input.out_of_range`).
*/
export interface BlackScholesEvaluateFacade {
<const O extends BlackScholesOutputSelection>(input: BlackScholesEvaluateInput<O>): BlackScholesEvaluation<O>;
explain<const O extends BlackScholesOutputSelection>(input: BlackScholesEvaluateInput<O>): Computed<BlackScholesEvaluation<O>>;
}
Fields, parameters & returned members (23)
Name / type
Meaning & unit
Optional / default
(input) BlackScholesEvaluateInput<O>
unitless by name
Required / declared member No @default declared; consult the signature and description.
Optional data lineage when the inputs came from a provider. unitless by name
Optional No @default declared; consult the signature and description.
explain().return.value BlackScholesEvaluation<O>
The computed value. Never `NaN` or `±Infinity`: a value the model cannot produce is `null`
beside a diagnostic that says why (Law 7 — a warning never licenses a non-finite number). unitless by name
Required / declared member No @default declared; consult the signature and description.
explain(input) BlackScholesEvaluateInput<O>
unitless by name
Required / declared member No @default declared; consult the signature and description.
Required / declared member No @default declared; consult the signature and description.
explain(input).volatility number
Volatility (decimal, e.g. `0.22`). 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
BlackScholesEvaluateInput
Input for {@link blackScholes}.evaluate: the typed Black–Scholes input plus the outputs to compute.
`outputs` is required, nonempty, dense and duplicate-free.
/**
* Input for {@link blackScholes}.evaluate: the typed Black–Scholes input plus the outputs to compute.
* `outputs` is required, nonempty, dense and duplicate-free.
*/
export interface BlackScholesEvaluateInput<O extends BlackScholesOutputSelection = BlackScholesOutputSelection> extends BlackScholesTypedInput {
/** The outputs to compute, e.g. `['price', 'delta', 'gamma']`. Only these appear in the result. */
outputs: O;
}
Required / declared member No @default declared; consult the signature and description.
spot number
Spot price of the underlying. unitless by name
Required / declared member No @default declared; consult the signature and description.
strike number
Strike price. unitless by name
Required / declared member No @default declared; consult the signature and description.
timeToExpiryYears number
Time to expiry in years. years (decimal)
Required / declared member No @default declared; consult the signature and description.
type import('@insiderfinance/totalfinance/core').OptionType
unitless by name
Required / declared member No @default declared; consult the signature and description.
volatility number
Volatility (decimal, e.g. `0.22`). 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
BlackScholesEvaluation
The result of a selected evaluation. The outputs the selection is certain to contain are required
numbers; any other output it might contain is optional ({@link GuaranteedSelection}). So a
literal `['price', 'gamma']` gives exactly those two required, while a dynamic selection
(`BlackScholesOutput[]`), a conditional (`c ? ['gamma'] : ['delta']`) or a union-valued element
gives optional properties: the type never claims a value exists that was not requested.
/**
* The result of a selected evaluation. The outputs the selection is certain to contain are required
* numbers; any other output it might contain is optional ({@link GuaranteedSelection}). So a
* literal `['price', 'gamma']` gives exactly those two required, while a dynamic selection
* (`BlackScholesOutput[]`), a conditional (`c ? ['gamma'] : ['delta']`) or a union-valued element
* gives optional properties: the type never claims a value exists that was not requested.
*/
export type BlackScholesEvaluation<O extends BlackScholesOutputSelection> = {
[K in GuaranteedSelection<O>]: number;
} & {
[K in Exclude<O[number], GuaranteedSelection<O>>]?: number;
};
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
BlackScholesImpliedVolatilityKernelInput
Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.
Required / declared member No @default declared; consult the signature and description.
lowerVolatilityBound number
Lower σ bracket (default `1e-7`). unitless by name
Optional No @default declared; consult the signature and description.
price number
unitless by name
Required / declared member 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
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.
upperVolatilityBound number
Upper σ bracket before expansion (default `5`). 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
BlackScholesImpliedVolatilityOptions
Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.
Lower σ bracket (default `1e-7`). unitless by name
Optional No @default declared; consult the signature and description.
upperVolatilityBound number
Upper σ bracket before expansion (default `5`). 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
BlackScholesImpliedVolatilityResult
Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.
export interface BlackScholesImpliedVolatilityResult {
value: number;
converged: boolean;
iterations: number;
error?: number;
reason?: ImpliedVolatilityReason;
/** Explanatory detail when a usable numeric pricing bracket cannot be established. */
message?: string;
}
Fields, parameters & returned members (6)
Name / type
Meaning & unit
Optional / default
converged boolean
unitless by name
Required / declared member No @default declared; consult the signature and description.
error number
unitless by name
Optional No @default declared; consult the signature and description.
iterations number
unitless by name
Required / declared member No @default declared; consult the signature and description.
message string
Explanatory detail when a usable numeric pricing bracket cannot be established. unitless by name
Optional No @default declared; consult the signature and description.
reason ImpliedVolatilityReason
unitless by name
Optional No @default declared; consult the signature and description.
value number
unitless by name
Required / declared member No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)
Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.
interface
BlackScholesKernelInput
Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.
Required / declared member 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
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.
volatility 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
BlackScholesOutput
A Black–Scholes output a selective call can request. First-order Greeks use the library's display
units (theta per calendar day, vega and rho per 1%); higher-order Greeks use the raw units
documented on `blackScholesExtendedGreeks`.
/**
* A Black–Scholes output a selective call can request. First-order Greeks use the library's display
* units (theta per calendar day, vega and rho per 1%); higher-order Greeks use the raw units
* documented on `blackScholesExtendedGreeks`.
*/
export type BlackScholesOutput = (typeof BLACK_SCHOLES_OUTPUTS)[number];
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
BlackScholesOutputSelection
A selection of outputs, as an array or (inferred from a literal) a tuple.
/** A selection of outputs, as an array or (inferred from a literal) a tuple. */
export type BlackScholesOutputSelection = readonly BlackScholesOutput[];
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
BlackScholesPriceBoundsInput
Public declaration. Read the signature and parameter/member contracts below; no additional behavior is inferred.
Required / declared member 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
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.
value
blackScholes
The Black–Scholes facade namespace. Flat object arguments in, plain values out; `.explain()` on
each function returns the assumptions/diagnostics envelope.
stable-by-law (pre-1.0; not a 1.0 stability guarantee)
Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.
function
blackScholesExtendedGreeks
Higher-order Greeks under BSM (spec §9.4), analytic and exact. First-order fields (`delta`…`rho`)
carry the same default units as {@link blackScholesGreeks}; the second/third-order fields are in raw units:
- `vanna` = ∂Δ/∂σ = ∂²V/∂S∂σ (per 1.00 σ, per $),
- `vomma` = ∂(vega)/∂σ = ∂²V/∂σ² (per 1.00 σ²; vega here is per 1.00 σ),
- `charm` = ∂Δ/∂T (delta drift per added year of time-to-expiry),
- `speed` = ∂Γ/∂S = ∂³V/∂S³,
- `color` = ∂Γ/∂T (gamma drift per added year of time-to-expiry),
- `phi` = ε = ∂V/∂q (dividend rho, per 1% dividend yield — scaled like rho),
- `zomma` = ∂Γ/∂σ = ∂³V/∂S²∂σ,
- `veta` = ∂vega/∂T (per year of time-to-expiry; the ∂/∂T sibling of vega),
- `vera` = ∂rho/∂σ = ∂²V/∂r∂σ,
- `ultima`= ∂vomma/∂σ = ∂³V/∂σ³,
- `lambda`= Δ·S/V (elasticity / effective leverage, dimensionless).
All are validated against finite differences of the first-order Greeks / the price.
export declare function blackScholesExtendedGreeks(input: BlackScholesKernelInput): ExtendedGreeks;
Fields, parameters & returned members (24)
Name / type
Meaning & unit
Optional / default
(input) BlackScholesKernelInput
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).dividendYield number
decimal rate (0.05 = 5%)
Required / declared member No @default declared; consult the signature and description.
(input).riskFreeRate number
decimal rate (0.05 = 5%)
Required / declared member No @default declared; consult the signature and description.
(input).spot number
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).strike number
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).timeToExpiryYears number
years (decimal)
Required / declared member No @default declared; consult the signature and description.
(input).type OptionType
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).volatility number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.charm number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.color number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.delta number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.gamma number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.lambda number | null
Elasticity / effective leverage `Λ = Δ·S / V` (dimensionless). `null` when the price
underflows to zero (deep-OTM): elasticity is undefined at V = 0 and is disclosed as null with
a `greeks.lambda_undefined` warning on explained paths — never NaN/Infinity (Law 7). unitless by name
Required / declared member No @default declared; consult the signature and description.
return.phi number
Dividend rho (epsilon) `ε = ∂V/∂q`, per 1% dividend yield (scaled like `rho`). unitless by name
Required / declared member No @default declared; consult the signature and description.
return.rho number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.speed number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.theta number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.ultima number
`∂vomma/∂σ = ∂³V/∂σ³` (raw). unitless by name
Required / declared member No @default declared; consult the signature and description.
return.vanna number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.vega number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.vera number
`∂rho/∂σ = ∂²V/∂r∂σ` (raw, per 1.00 σ; rho here is per 1.00 rate). unitless by name
Required / declared member No @default declared; consult the signature and description.
return.veta number
`∂vega/∂T` (raw, per year of time-to-expiry; vega here is per 1.00 σ) — the ∂/∂T sibling of vega. unitless by name
Required / declared member No @default declared; consult the signature and description.
return.vomma number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.zomma number
`∂Γ/∂σ = ∂³V/∂S²∂σ` (raw, per 1.00 σ). unitless by name
Required / declared member No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)
Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.
function
blackScholesGreeks
First-order Greeks in TotalFinance default units (theta/day, vega/1%, rho/1%).
export declare function blackScholesGreeks(input: BlackScholesKernelInput): Greeks;
Fields, parameters & returned members (13)
Name / type
Meaning & unit
Optional / default
(input) BlackScholesKernelInput
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).dividendYield number
decimal rate (0.05 = 5%)
Required / declared member No @default declared; consult the signature and description.
(input).riskFreeRate number
decimal rate (0.05 = 5%)
Required / declared member No @default declared; consult the signature and description.
(input).spot number
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).strike number
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).timeToExpiryYears number
years (decimal)
Required / declared member No @default declared; consult the signature and description.
(input).type OptionType
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).volatility number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.delta number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.gamma number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.rho number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.theta number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.vega number
unitless by name
Required / declared member No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)
Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.
function
blackScholesImpliedVolatility
Solve implied volatility from a price using Brent with no-arbitrage bound checks.
Returns `converged: false` with a machine-readable `reason` on failure — never a fabricated value
(design law #4). Three ways there is no answer, reported apart: the price violates the intrinsic
floor (`below_intrinsic`), it sits at or above the upper no-arbitrage bound, which is a SUPREMUM
attained only as σ→∞ (`above_max_bound`), or it is below the model price at the lowest σ in the
bracket (`price_below_resolvable`).
export declare function blackScholesImpliedVolatility(input: BlackScholesImpliedVolatilityKernelInput): BlackScholesImpliedVolatilityResult;
Fields, parameters & returned members (16)
Name / type
Meaning & unit
Optional / default
(input) BlackScholesImpliedVolatilityKernelInput
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).dividendYield number
decimal rate (0.05 = 5%)
Required / declared member No @default declared; consult the signature and description.
(input).lowerVolatilityBound number
Lower σ bracket (default `1e-7`). unitless by name
Optional No @default declared; consult the signature and description.
(input).price number
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).riskFreeRate number
decimal rate (0.05 = 5%)
Required / declared member No @default declared; consult the signature and description.
(input).spot number
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).strike number
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).timeToExpiryYears number
years (decimal)
Required / declared member No @default declared; consult the signature and description.
(input).type OptionType
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).upperVolatilityBound number
Upper σ bracket before expansion (default `5`). unitless by name
Optional No @default declared; consult the signature and description.
return.converged boolean
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.error number
unitless by name
Optional No @default declared; consult the signature and description.
return.iterations number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.message string
Explanatory detail when a usable numeric pricing bracket cannot be established. unitless by name
Optional No @default declared; consult the signature and description.
return.reason ImpliedVolatilityReason
unitless by name
Optional No @default declared; consult the signature and description.
return.value number
unitless by name
Required / declared member No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)
Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.
function
blackScholesPrice
Black–Scholes–Merton price for a European call/put with continuous dividend yield `q`.
This is the seed defect Phase 3B was opened on. It validated the object and the `type` enum, then
destructured six numeric fields and checked none of them: omitting `volatility` made `sigma`
`undefined`, `d1` `NaN`, and the returned PRICE `NaN` — handed back as a success, through a
declaration that said the field was required. A pricing function that answers `NaN` is worse than
one that throws, because every layer above it treats the answer as a number.
export declare function blackScholesPrice(input: BlackScholesKernelInput): number;
Fields, parameters & returned members (8)
Name / type
Meaning & unit
Optional / default
(input) BlackScholesKernelInput
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).dividendYield number
decimal rate (0.05 = 5%)
Required / declared member No @default declared; consult the signature and description.
(input).riskFreeRate number
decimal rate (0.05 = 5%)
Required / declared member No @default declared; consult the signature and description.
(input).spot number
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).strike number
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).timeToExpiryYears number
years (decimal)
Required / declared member No @default declared; consult the signature and description.
(input).type OptionType
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).volatility number
unitless by name
Required / declared member No @default declared; consult the signature and description.
Stability, warnings & conventions
stable-by-law (pre-1.0; not a 1.0 stability guarantee)
Declared field units are shown above. “Unitless by name” means the name alone does not establish a unit, not that a financial quantity has none. Check source descriptions, conventions, and the returned diagnostics. Errors and warnings are part of the result contract.
function
blackScholesPriceBounds
No-arbitrage price bounds for a vanilla under BSM (forward intrinsic ≤ price ≤ discounted spot/strike).
Required / declared member No @default declared; consult the signature and description.
(input).dividendYield number
decimal rate (0.05 = 5%)
Required / declared member No @default declared; consult the signature and description.
(input).riskFreeRate number
decimal rate (0.05 = 5%)
Required / declared member No @default declared; consult the signature and description.
(input).spot number
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).strike number
unitless by name
Required / declared member No @default declared; consult the signature and description.
(input).timeToExpiryYears number
years (decimal)
Required / declared member No @default declared; consult the signature and description.
(input).type OptionType
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.lower number
unitless by name
Required / declared member No @default declared; consult the signature and description.
return.upper 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.