BinanceElixir.Spot.UserStream (binance_elixir v0.2.1)

Copy Markdown View Source

Supervised signed Spot User Data Stream over Binance WebSocket API.

Reconnects use a fresh timestamp and signature. Events are held in a bounded queue; consumers must resynchronize account and order state after drops or reconnects.

Summary

Functions

Returns a specification to start this module under a supervisor.

Pops and normalizes the oldest account event or WebSocket API response.

Renews the connection and signs a fresh subscription request.

Builds a signed WebSocket API subscription request. Keep its return value out of logs.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

pop(server)

@spec pop(GenServer.server()) :: {:ok, map()} | :empty

pop_normalized(server)

@spec pop_normalized(GenServer.server()) :: {:ok, map()} | :empty

Pops and normalizes the oldest account event or WebSocket API response.

renew(server)

@spec renew(GenServer.server()) :: :ok | {:error, :disconnected}

Renews the connection and signs a fresh subscription request.

signed_request(client, id)

@spec signed_request(BinanceElixir.t(), String.t()) :: map()

Builds a signed WebSocket API subscription request. Keep its return value out of logs.

start_link(client, opts \\ [])

@spec start_link(BinanceElixir.t(), keyword()) :: GenServer.on_start()

stats(server)

@spec stats(GenServer.server()) :: map()

subscribe(server)

@spec subscribe(GenServer.server()) :: :ok

subscriptions(server)

@spec subscriptions(GenServer.server()) :: :ok

unsubscribe(server)

@spec unsubscribe(GenServer.server()) :: :ok