Pure exposure math for portfolio-risk snapshots.
Option position quantities are converted to canonical underlying units before Greeks are applied. Aggregation keys include the underlying, both currencies, and the complete semantic unit convention, so incompatible risks cannot be added accidentally.
Summary
Functions
Aggregates contributions only inside exact semantic buckets.
Builds signed asset and debt lots from a balance.
Blocks every supported option-Greek bucket for a lot after a read failure.
Converts a non-option lot into a signed delta contribution.
Applies per-instrument Greeks to an option lot.
Builds signed pending-exposure lots from one open order and its market.
Builds a signed current-exposure lot from one position and its market.
Types
@type lot() :: %{ :venue => String.t(), :account => term(), :symbol => String.t(), :underlying => String.t(), :settlement_currency => String.t() | nil, :quantity => number(), :quantity_unit => String.t(), :source => atom(), :pending => boolean(), :observed_at => integer(), :market => Bourse.Market.t() | nil, optional(:contract_multiplier) => number() | nil, optional(:source_timestamp) => integer() | nil }
Functions
Aggregates contributions only inside exact semantic buckets.
A bucket with any blocker exposes only partial_value; its coherent value
is nil.
@spec balance_lots(provenance(), Bourse.Balance.t()) :: [lot()]
Builds signed asset and debt lots from a balance.
Blocks every supported option-Greek bucket for a lot after a read failure.
Converts a non-option lot into a signed delta contribution.
@spec option_contribution(lot(), Bourse.InstrumentGreeks.t()) :: {map() | nil, [map()]}
Applies per-instrument Greeks to an option lot.
Missing supported Greeks become blocked buckets; unsupported Greeks are omitted because the venue declares that no such bucket exists.
@spec order_lots(provenance(), Bourse.Order.t(), Bourse.Market.t()) :: {:ok, [lot()]} | {:error, atom()}
Builds signed pending-exposure lots from one open order and its market.
@spec position_lot(provenance(), Bourse.Position.t(), Bourse.Market.t()) :: {:ok, lot()} | {:error, atom()}
Builds a signed current-exposure lot from one position and its market.