Long-option risk framing and margin-bridge funding stress for option buyers.
Long options have defined max loss equal to premium paid. Combined with perp-funded margin bridges, cash-flow risk from negative funding dominates — price risk is hedged.
API Functions
| Function | Arity | Description | Param Kinds |
|---|---|---|---|
monitor_margin_bridge_health | 2 | Monitor margin-bridge health using margin ratio, runway, and status bands. | params: value, opts: value |
stress_test_extended_negative | 2 | Stress-test multiple negative funding rates over an extended horizon. | params: value, opts: value |
calculate_negative_funding_impact | 1 | Estimate daily funding drain and cash-flow risk under negative rates. | params: value |
calculate_total_exposure | 1 | Sum gross exposure across spot, perp, options, and margin debt legs. | legs: value |
max_loss | 1 | Return defined max loss for long options (premium paid only). | option_premiums: value |
Summary
Functions
Compute negative-funding cash-flow impact for a delta-neutral margin bridge.
Return per-leg notionals and total_exposure as the sum of absolute leg values.
Frame long-option risk as premium-only max loss.
Evaluate margin-bridge health during the payback period.
Run extended negative-funding scenarios (default 90 days) across multiple rates.
Types
@type decimal_input() :: DeltaCalc.Decimal.input()
@type exposure_inputs() :: %{ spot_notional: decimal_input(), perp_notional: decimal_input(), options_notional: decimal_input(), margin_debt: decimal_input() }
@type extended_stress_inputs() :: %{ :funding_rates => [decimal_input()], :position_size => decimal_input(), optional(:scenario) => atom() }
@type extended_stress_result() :: %{ scenario: atom(), scenarios: [stress_scenario()], kill_switch_day_min: pos_integer() | nil, kill_switch_day_max: pos_integer() | nil }
@type health_status() :: :healthy | :warning | :critical
@type margin_health() :: %{ margin_ratio: Decimal.t(), runway_days: Decimal.t() | nil, health_status: health_status() }
@type margin_health_inputs() :: %{ initial_margin: decimal_input(), option_premium: decimal_input(), capital: decimal_input(), available_margin: decimal_input(), daily_burn: decimal_input() }
@type max_loss_result() :: %{ max_loss: Decimal.t(), risk_model: :premium_only, limited_downside: true }
@type negative_funding_inputs() :: %{ :negative_rate => decimal_input(), :position_size => decimal_input(), optional(:market_context) => atom(), optional(:capital_protected) => boolean(), optional(:periods_per_day) => pos_integer() }
Functions
@spec calculate_negative_funding_impact(negative_funding_inputs()) :: negative_funding_impact()
Compute negative-funding cash-flow impact for a delta-neutral margin bridge.
:negative_rate is a decimal fraction per funding period (e.g. -0.0003 for
-0.03%), matching Funding/Hedging/MarginBridge — not a percent number.
:capital_protected defaults to true (price risk hedged). :market_context adjusts
qualitative setup/opportunity fields (:post_crash, :bear_market, etc.).
@spec calculate_total_exposure(exposure_inputs()) :: exposure_result()
Return per-leg notionals and total_exposure as the sum of absolute leg values.
@spec max_loss(decimal_input() | [decimal_input()]) :: max_loss_result()
Frame long-option risk as premium-only max loss.
Accepts one premium or a list; returns the summed premium as max_loss.
@spec monitor_margin_bridge_health( margin_health_inputs(), keyword() ) :: margin_health()
Evaluate margin-bridge health during the payback period.
Delegates ratio and runway math to DeltaCalc.MarginBridge. Three status bands default to
phase7 thresholds: healthy at or below 25%, warning above 25% through 35%, critical above
the :reduce threshold (default 35%).
@spec stress_test_extended_negative( extended_stress_inputs(), keyword() ) :: extended_stress_result()
Run extended negative-funding scenarios (default 90 days) across multiple rates.
Each rate in :funding_rates is a decimal fraction per period (e.g. -0.0002 for
-0.02%), matching Funding/Hedging/MarginBridge. margin_impact is the funding
drain as a ratio of free capital headroom below the kill-switch threshold
(e.g. 0.07 for 7% of headroom).