Skip to content
TotalFinance

Crypto · @insiderfinance/totalfinance

@insiderfinance/totalfinance/crypto/inverse

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

InverseFuture

#

The coin economics of an inverse-margined futures/perp position.

Signature
import type { InverseFuture } from '@insiderfinance/totalfinance/crypto/inverse';

/** The coin economics of an inverse-margined futures/perp position. */
export interface InverseFuture {
    /** Coin PnL since entry: `s · notionalUsd · (1/entry − 1/mark)`. */
    coinPnl: number;
    /** USD value of that coin PnL at the mark (`coinPnl · markPrice`). */
    usdPnl: number;
    /** `∂coinPnl/∂mark = s · notionalUsd / mark²` — coin per $1 move; NOT constant (inverse convexity). */
    coinDelta: number;
    /** `∂²coinPnl/∂mark² = s · (−2·notionalUsd / mark³)` — a LONG inverse future is SHORT gamma in coin. */
    coinGamma: number;
    /** Coin-equivalent size at the mark (`s · notionalUsd / mark`) — how many coins the position is long. */
    coinExposure: number;
}
Fields, parameters and returned members (5)
Name · typeMeaning · unitRequired · default
coinDeltanumber

∂coinPnl/∂mark = s · notionalUsd / mark² — coin per $1 move; NOT constant (inverse convexity).

unitless by name
RequiredNo @default declared
coinExposurenumber

Coin-equivalent size at the mark (s · notionalUsd / mark) — how many coins the position is long.

unitless by name
RequiredNo @default declared
coinGammanumber

∂²coinPnl/∂mark² = s · (−2·notionalUsd / mark³) — a LONG inverse future is SHORT gamma in coin.

unitless by name
RequiredNo @default declared
coinPnlnumber

Coin PnL since entry: s · notionalUsd · (1/entry − 1/mark).

currency amount (the field or record currency)
RequiredNo @default declared
usdPnlnumber

USD value of that coin PnL at the mark (coinPnl · markPrice).

currency amount (the field or record currency)
RequiredNo @default declared

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

iface

InverseFutureInput

#

Input for inverseFuture.

Signature
import type { InverseFutureInput } from '@insiderfinance/totalfinance/crypto/inverse';

// ── inverseFuture ───────────────────────────────────────────────────────────────
/** Input for {@link inverseFuture}. */
export interface InverseFutureInput {
    /** USD notional (= contracts × contract multiplier, e.g. $10/contract on Deribit). */
    notionalUsd: number;
    /** Entry price (USD per coin). */
    entryPrice: number;
    /** Current mark price (USD per coin). */
    markPrice: number;
    /** Position side. Default 'long'. */
    side?: InverseSide;
}
Fields, parameters and returned members (4)
Name · typeMeaning · unitRequired · default
entryPricenumber

Entry price (USD per coin).

currency amount (the field or record currency)
RequiredNo @default declared
markPricenumber

Current mark price (USD per coin).

currency amount (the field or record currency)
RequiredNo @default declared
notionalUsdnumber

USD notional (= contracts × contract multiplier, e.g. $10/contract on Deribit).

unitless by name
RequiredNo @default declared
side'long' | 'short'

Position side. Default 'long'.

unitless by name
OptionalNo @default declared

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

iface

InverseHedge

#

The inverse future/perp trade that neutralizes a coin delta.

Signature
import type { InverseHedge } from '@insiderfinance/totalfinance/crypto/inverse';

/** The inverse future/perp trade that neutralizes a coin delta. */
export interface InverseHedge {
    /** USD notional of the inverse future to trade. */
    notionalUsd: number;
    /** Which way to trade it. */
    side: InverseSide;
    /** The hedge future's coin delta — equal and opposite to the input `coinDelta` (combined ⇒ 0). */
    hedgeCoinDelta: number;
    /** Residual coin gamma after the delta hedge (`positionGamma + hedgeFutureGamma`) — iff `coinGamma` given. */
    residualCoinGamma?: number;
}
Fields, parameters and returned members (4)
Name · typeMeaning · unitRequired · default
hedgeCoinDeltanumber

The hedge future's coin delta — equal and opposite to the input coinDelta (combined ⇒ 0).

unitless by name
RequiredNo @default declared
notionalUsdnumber

USD notional of the inverse future to trade.

unitless by name
RequiredNo @default declared
residualCoinGammanumber

Residual coin gamma after the delta hedge (positionGamma + hedgeFutureGamma) — iff coinGamma given.

unitless by name
OptionalNo @default declared
side'long' | 'short'

Which way to trade it.

unitless by name
RequiredNo @default declared

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

iface

InverseHedgeInput

#

Input for inverseHedge.

Signature
import type { InverseHedgeInput } from '@insiderfinance/totalfinance/crypto/inverse';

// ── inverseHedge ────────────────────────────────────────────────────────────────
/** Input for {@link inverseHedge}. */
export interface InverseHedgeInput {
    /** The coin delta to neutralize (e.g. `inverseOption.greeks(…).value.coin.delta`). */
    coinDelta: number;
    /** Mark price of the inverse future/perp used to hedge (USD per coin; a perp ≈ spot). */
    markPrice: number;
    /** Coin gamma of the position being hedged — supply to get the residual gamma after the delta hedge. */
    coinGamma?: number;
}
Fields, parameters and returned members (3)
Name · typeMeaning · unitRequired · default
coinDeltanumber

The coin delta to neutralize (e.g. inverseOption.greeks(…).value.coin.delta).

unitless by name
RequiredNo @default declared
coinGammanumber

Coin gamma of the position being hedged — supply to get the residual gamma after the delta hedge.

unitless by name
OptionalNo @default declared
markPricenumber

Mark price of the inverse future/perp used to hedge (USD per coin; a perp ≈ spot).

currency amount (the field or record currency)
RequiredNo @default declared

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

type

InverseSide

#

Position side of an inverse contract.

Signature
import type { InverseSide } from '@insiderfinance/totalfinance/crypto/inverse';

/** Position side of an inverse contract. */
export type InverseSide = (typeof SIDES)[number];

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

fn

inverseFuture

#

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

Signature
import { inverseFuture } from '@insiderfinance/totalfinance/crypto/inverse';

export declare function inverseFuture(input: InverseFutureInput): Computed<InverseFuture>;
Fields, parameters and returned members (9)
Name · typeMeaning · unitRequired · default
(input)InverseFutureInput—unitless by nameRequiredNo @default declared
(input).entryPricenumber

Entry price (USD per coin).

currency amount (the field or record currency)
RequiredNo @default declared
(input).markPricenumber

Current mark price (USD per coin).

currency amount (the field or record currency)
RequiredNo @default declared
(input).notionalUsdnumber

USD notional (= contracts × contract multiplier, e.g. $10/contract on Deribit).

unitless by name
RequiredNo @default declared
(input).side'long' | 'short'

Position side. Default 'long'.

unitless by name
OptionalNo @default declared
return.assumptionsAssumptions<Record<never, never>>

Every applied convention, echoed back.

unitless by name
RequiredNo @default declared
return.diagnosticsDiagnostics

How the value was computed, plus any warnings.

unitless by name
RequiredNo @default declared
return.provenanceimport('@insiderfinance/totalfinance/core').Provenance

Optional data lineage when the inputs came from a provider.

unitless by name
OptionalNo @default declared
return.valueInverseFuture

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
RequiredNo @default declared

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

fn

inverseHedge

#

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

Signature
import { inverseHedge } from '@insiderfinance/totalfinance/crypto/inverse';

export declare function inverseHedge(input: InverseHedgeInput): Computed<InverseHedge>;
Fields, parameters and returned members (8)
Name · typeMeaning · unitRequired · default
(input)InverseHedgeInput—unitless by nameRequiredNo @default declared
(input).coinDeltanumber

The coin delta to neutralize (e.g. inverseOption.greeks(…).value.coin.delta).

unitless by name
RequiredNo @default declared
(input).coinGammanumber

Coin gamma of the position being hedged — supply to get the residual gamma after the delta hedge.

unitless by name
OptionalNo @default declared
(input).markPricenumber

Mark price of the inverse future/perp used to hedge (USD per coin; a perp ≈ spot).

currency amount (the field or record currency)
RequiredNo @default declared
return.assumptionsAssumptions<Record<never, never>>

Every applied convention, echoed back.

unitless by name
RequiredNo @default declared
return.diagnosticsDiagnostics

How the value was computed, plus any warnings.

unitless by name
RequiredNo @default declared
return.provenanceimport('@insiderfinance/totalfinance/core').Provenance

Optional data lineage when the inputs came from a provider.

unitless by name
OptionalNo @default declared
return.valueInverseHedge

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
RequiredNo @default declared

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