Base-numeraire exposure, settlement coverage, and delta-neutral rebalance math.
Tagged option and inverse-perpetual inputs preserve provider unit semantics. Coverage and risk-target evaluation remain separate calculations and never produce an approval decision. This module does not price options or compute Greeks.
API Functions
| Function | Arity | Description | Param Kinds |
|---|---|---|---|
rebalance_to_neutral | 1 | Compute the hedge leg needed to flatten net delta within a tolerance. | params: value |
net_delta | 1 | Aggregate signed delta exposure across spot, perp, and option positions. | positions: value |
risk_target | 1 | Evaluate signed base-numeraire exposure against a caller-supplied target and tolerance. | params: value |
settlement_coverage | 1 | Calculate covered-call settlement capacity from caller-classified, disjoint base amounts. | params: value |
base_numeraire_exposure | 1 | Calculate signed base exposure from explicitly tagged option or inverse-perpetual facts. | params: value |
Summary
Functions
Return signed base exposure from one explicitly tagged option or inverse-perpetual input.
Sum signed delta exposure across positions.
Return the hedge adjustment to bring net delta to ~0 within tolerance.
Return the signed residual from a target and whether it is within absolute tolerance.
Return settlement capacity after existing disjoint reservations and a proposed obligation.
Types
@type calculation_error() :: exposure_error() | :invalid_coverage_shape | :invalid_risk_target_shape | :negative_coverage_amount
@type coverage_params() :: %{ eligible_base: DeltaCalc.Decimal.input(), existing_short_call_obligations: DeltaCalc.Decimal.input(), pending_sell_reservations: DeltaCalc.Decimal.input(), other_reservations: DeltaCalc.Decimal.input(), proposed_short_call_obligation: DeltaCalc.Decimal.input() }
@type coverage_result() :: %{ eligible_base: Decimal.t(), existing_reservations: %{ short_call_obligations: Decimal.t(), pending_sell_reservations: Decimal.t(), other_reservations: Decimal.t(), total: Decimal.t() }, proposed_short_call_obligation: Decimal.t(), total_obligation: Decimal.t(), remaining_capacity: Decimal.t(), uncovered_amount: Decimal.t(), fully_covered: boolean() }
@type exposure_error() ::
:ambiguous_settlement_input
| :invalid_decimal
| :invalid_delta_shape
| :invalid_mark_shape
| :invalid_quantity_shape
| :mixed_delta_shape
| :mixed_mark_shape
| :mixed_quantity_shape
| :non_positive_mark
| :non_positive_spot
| :unsupported_delta_semantic
| :unsupported_exposure_kind
| :unsupported_exposure_period
| :unsupported_mark_unit
| :unsupported_quantity_unit
| :untagged_delta_semantic
| :untagged_exposure_kind
| :untagged_mark_unit
| :untagged_quantity_unit
@type exposure_params() :: map()
@type position() :: %{ :kind => position_kind(), optional(:size) => DeltaCalc.Decimal.input(), optional(:notional) => DeltaCalc.Decimal.input(), optional(:side) => position_side(), optional(:delta) => DeltaCalc.Decimal.input() }
@type position_kind() :: :spot | :perp | :option
@type position_side() :: :long | :short
@type rebalance_params() :: %{ :positions => [position()], optional(:tolerance) => DeltaCalc.Decimal.input(), optional(:instrument) => :spot | :perp }
@type risk_target_params() :: %{ base_numeraire_exposure: DeltaCalc.Decimal.input(), target_exposure: DeltaCalc.Decimal.input(), tolerance: DeltaCalc.Decimal.input() }
Functions
@spec base_numeraire_exposure(exposure_params()) :: {:ok, Decimal.t()} | {:error, exposure_error()}
Return signed base exposure from one explicitly tagged option or inverse-perpetual input.
Sum signed delta exposure across positions.
Option positions must include exchange-supplied :delta (not computed here).
Spot and perp positions use :delta when present; otherwise derive signed
exposure from :size or :notional and :side (default :long).
@spec rebalance_to_neutral(rebalance_params() | [position()]) :: rebalance_result()
Return the hedge adjustment to bring net delta to ~0 within tolerance.
When already within tolerance, :side is :none and :size is zero.
:signed_hedge is sized for DeltaCalc.Hedging.suggest_hedge_distribution/1.
@spec risk_target(risk_target_params()) :: {:ok, risk_target_result()} | {:error, calculation_error()}
Return the signed residual from a target and whether it is within absolute tolerance.
@spec settlement_coverage(coverage_params()) :: {:ok, coverage_result()} | {:error, calculation_error()}
Return settlement capacity after existing disjoint reservations and a proposed obligation.