CCXT.WS.Subscription.MethodParams (ccxt_client v0.6.1)

Copy Markdown View Source

Kraken v2 / Crypto.com-style subscribe frame.

Accepts two caller conventions per channel list:

  1. Plain strings — channels are grouped under params.<channel_key> (default key "channel").

    MethodParams.subscribe(["ticker", "book"], %{})
    # => %{"method" => "subscribe", "params" => %{"channel" => ["ticker", "book"]}}
  2. Single pre-shaped map — the caller supplies the params object directly (Kraken v2 expects {"channel": "ticker", "symbol": [...]}).

    MethodParams.subscribe([%{"channel" => "ticker", "symbol" => ["BTC/USD"]}], %{})
    # => %{"method" => "subscribe",
    #      "params" => %{"channel" => "ticker", "symbol" => ["BTC/USD"]}}

Multiple maps per call return {:error, :multiple_maps_not_supported}; lists that mix maps and strings return {:error, :mixed_channel_types}. Both errors propagate verbatim through CCXT.WS.Subscription.build_subscribe/3.

Config keys:

  • :op_field — default "method"
  • :args_field — default "params"
  • :channel_key — default "channel" (string-channel branch only)