DpExchange.Gemini.WsChannels (DpExchangeGemini v0.1.34)

Copy Markdown View Source

The venue's WebSocket channels, their addresses, and which need a credential.

From the vendor's AsyncAPI document (/specs/asyncapi/websocket.yaml), read 2026-09-01. That document — not the rendered Stream Matrix — is the surface: ten of these channels never appear in the matrix, including the whole requestForQuote family, connection, both …Snapshot channels and the four …Fast depth variants.

Addresses are built, not guessed

A per-symbol channel is "{symbol}@name" and a per-account one is a bare name like orders@account. Two of them are neither: depthFast is "{symbol}@depth@100ms" and the snapshot channels are balances@account@1s and positions@account@1sthe interval is part of the address, not a parameter. A package assembling "{symbol}@depthFast" from the channel's own name would subscribe to nothing and see silence rather than an error.

Public and private are not interchangeable

orders, balances, positions, settlements and the two private requestForQuote channels need an authenticated connection. Subscribing to one without a credential fails at the venue, so requires_credential?/1 lets a caller be told here instead.

Summary

Functions

The subscription address for channel, with {symbol} filled in where the channel takes one.

Channels that carry a symbol in their address.

Whether channel needs an authenticated connection.

Functions

address(channel, symbol \\ nil)

@spec address(atom(), String.t() | nil) :: {:ok, String.t()} | {:error, term()}

The subscription address for channel, with {symbol} filled in where the channel takes one.

A per-symbol channel with no symbol is an error, and a per-account channel given one is too: orders@account with a symbol appended is not a channel the venue has, and subscribing to it produces silence rather than a refusal.

per_symbol()

@spec per_symbol() :: [atom()]

Channels that carry a symbol in their address.

Socket.subscribe/3 and unsubscribe/3 check membership here before ever reaching address/2: a non-empty symbol list against a channel absent from this list is refused with {:error, {:channel_takes_no_symbol, channel}} rather than silently subscribing to nothing, which is what streams/2's own error-filtering used to let through.

requires_credential?(channel)

@spec requires_credential?(atom()) :: boolean() | {:error, term()}

Whether channel needs an authenticated connection.

Subscribing to a private channel without a credential fails at the venue; answering here lets a caller be told before the round trip — Socket.subscribe/3 does exactly that, refusing before it ever builds a frame, since Socket never carries a credential to authenticate a private channel with in the first place.