CCXT.Signing.HmacSha256Query (ccxt_client v0.6.1)

Copy Markdown View Source

HMAC-SHA256 query string signing pattern (Binance-style).

Used by: Binance, MEXC, Huobi, and ~40 other exchanges.

How it works

  1. Add timestamp to query parameters
  2. URL-encode all parameters (sorted alphabetically)
  3. Sign the query string with HMAC-SHA256
  4. Append signature to URL as &signature=...
  5. API key sent in header

Configuration

signing: %{
  pattern: :hmac_sha256_query,
  api_key_header: "X-MBX-APIKEY",
  timestamp_key: "timestamp",
  signature_key: "signature",
  recv_window_key: "recvWindow",
  recv_window: 5000,
  signature_encoding: :hex,
  post_as_json: false
}

Optional: set post_as_json: true to send POST params as JSON body instead of query string (used by some Binance-derivative exchanges).