DpExchange.Core.Types.ContractStats (DpExchangeCore v0.3.14)

Copy Markdown View Source

Risk statistics for a derivative contract.

Mark and index are not the same price, and neither is the last trade

:mark_price is the venue's own valuation — what it marks positions and computes liquidations against. :index_price is the external reference it is derived from. They diverge, sometimes sharply, and the divergence is the point: a venue marking away from the index is why a position can be liquidated at a price the market never printed.

Neither is a traded price. Types.Quote carries that. Three prices for one instrument, each meaning something different, is exactly the situation in which a single "price" field produces a confident wrong answer.

Open interest in contracts and in notional

:open_interest counts contracts; :open_interest_notional values them. A venue publishes both because neither substitutes for the other across instruments with different contract sizes.

Summary

Functions

Builds a t/0, failing closed if a required field is absent or nil.

Types

t()

@type t() :: %DpExchange.Core.Types.ContractStats{
  index_price: Decimal.t() | nil,
  mark_price: Decimal.t() | nil,
  open_interest: Decimal.t() | nil,
  open_interest_notional: Decimal.t() | nil,
  product_type: String.t() | nil,
  provider: atom(),
  symbol: String.t(),
  venue_time: DateTime.t() | nil
}

Functions

new(attrs)

@spec new(keyword() | map()) :: t()

Builds a t/0, failing closed if a required field is absent or nil.

@enforce_keys guards presence, not nil — see DpExchange.Core.Types.Validate.