BinanceElixir (binance_elixir v0.2.1)

Copy Markdown View Source

Binance Spot REST client. Requests return {:ok, %BinanceElixir.Response{}} or {:error, %BinanceElixir.Error{}}.

Write requests are never automatically retried: after a timeout or HTTP 5xx, Binance may have executed an order even though its result is unknown.

Summary

Functions

Creates a client. The default REST host is Binance Spot testnet.

Sends a Spot REST request. security is :none, :api_key, or :signed. Signed requests use the configured HMAC SHA-256 or Ed25519 key and a millisecond timestamp.

Types

t()

@type t() :: %BinanceElixir{
  api_key: term(),
  api_secret: term(),
  backoff_ms: term(),
  base_url: term(),
  clock: term(),
  enable_live_trading?: term(),
  private_key: term(),
  rate_tracker: term(),
  recv_window: term(),
  retries: term(),
  signing_algorithm: term(),
  sleep: term(),
  timeout: term(),
  transport: term()
}

Functions

new(opts \\ [])

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

Creates a client. The default REST host is Binance Spot testnet.

request(client, method, path, params \\ %{}, opts \\ [])

@spec request(t(), atom(), String.t(), map() | keyword(), keyword()) ::
  {:ok, BinanceElixir.Response.t()} | {:error, BinanceElixir.Error.t()}

Sends a Spot REST request. security is :none, :api_key, or :signed. Signed requests use the configured HMAC SHA-256 or Ed25519 key and a millisecond timestamp.