Bourse.Ticker (bourse v0.1.0)

Copy Markdown View Source

Unified market ticker data.

Contains the latest price, volume, and spread information for a trading pair.

Fields

  • symbol - Unified symbol (e.g., "BTC/USDT")
  • timestamp - Exchange timestamp in milliseconds
  • datetime - ISO 8601 datetime string
  • high, low - 24h high/low prices
  • bid, bid_volume - Best bid price and volume
  • ask, ask_volume - Best ask price and volume
  • vwap - Volume-weighted average price (or nil when the venue does not supply volume units that form a price — see caveats below)
  • open, close, last - 24h open, close, and last trade prices
  • previous_close - Previous 24h close
  • change, percentage - 24h absolute change and percentage
  • average - Average of open and close
  • base_volume, quote_volume - 24h volume in base/quote currency
  • index_price, mark_price - Derivatives index/mark prices
  • info - Raw exchange response

vwap caveat (carve C36)

vwap is a price. It is only populated when the venue's volume operands are quote-notional over base-quantity (or the venue publishes a weighted average price directly). Blind quoteVolume / baseVolume is not always a price: on OKX SWAP/FUTURES, vol24h is contracts and volCcy24h is base currency, so that ratio collapses to contract size (ctVal, e.g. 0.01 on BTC-USDT-SWAP) rather than a ~mark price. We diverge from Bourse's always-divide carve there and leave vwap nil; consumers needing contract volume should read base_volume / quote_volume / raw info. See docs/authored-specs.md carve C36.

Summary

Functions

JSON Schema for the Ticker unified type.

Types

t()

@type t() :: %Bourse.Ticker{
  ask: number() | nil,
  ask_volume: number() | nil,
  average: number() | nil,
  base_volume: number() | nil,
  bid: number() | nil,
  bid_volume: number() | nil,
  change: number() | nil,
  close: number() | nil,
  datetime: String.t() | nil,
  high: number() | nil,
  index_price: number() | nil,
  info: map() | nil,
  last: number() | nil,
  low: number() | nil,
  mark_price: number() | nil,
  open: number() | nil,
  percentage: number() | nil,
  previous_close: number() | nil,
  quote_volume: number() | nil,
  symbol: String.t() | nil,
  timestamp: integer() | nil,
  vwap: number() | nil
}

Functions

schema()

@spec schema() :: map()

JSON Schema for the Ticker unified type.