Bourse.WS.Config (bourse v0.1.0)

Copy Markdown View Source

Per-exchange WebSocket configuration.

Effective config merges v4.1.0 websocket.* spec slices (heartbeat, auth, urls when emitted) with hand-maintained bases in Bourse.WS.SpecConfig for subscription patterns, URL fallbacks, and auth pattern detail.

Seven runtime venues currently have hand bases: binance, binanceusdm, bybit, deribit, derive, hyperliquid, and okx. Spec-resolved heartbeat/auth overrides hand values where unresolved_reason is nil.

Entry shape

%{
  public_url: String.t() | nil,
  public_url_sandbox: String.t() | nil,
  private_url: String.t() | nil,
  private_url_sandbox: String.t() | nil,
  heartbeat: %{type: :ping | :deribit | :custom, interval: pos_integer() | nil, optional(:payload) => term()},
  subscription_pattern: atom(),
  subscription_config: map(),
  auth_pattern: atom() | nil,
  auth_config: map()
}

See Bourse.WS.SpecConfig for hand-base details and known URL limitations.

Summary

Functions

Returns the WS config map for the given exchange id or struct, or nil if unsupported.

Returns true if this exchange has a WS config entry.

Returns all supported exchange ids.

Functions

for_exchange(id)

@spec for_exchange(String.t() | Bourse.Exchange.t()) :: map() | nil

Returns the WS config map for the given exchange id or struct, or nil if unsupported.

When passed a %Bourse.Exchange{}, merges using the lean exchange.spec.

supported?(id)

@spec supported?(String.t()) :: boolean()

Returns true if this exchange has a WS config entry.

supported_exchanges()

@spec supported_exchanges() :: [String.t()]

Returns all supported exchange ids.