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

Copy Markdown View Source

KuCoin/Coinbase-style subscribe frame keyed on a "type" field.

KuCoin single-topic form:

%{"type" => "subscribe", "topic" => "/market/ticker:BTC-USDT"}

Coinbase dual-field form:

%{
  "type"         => "subscribe",
  "product_ids"  => ["BTC-USD", "ETH-USD"],
  "channels"     => ["matches"]
}

The dual-field form is selected by setting config[:channels_field] to "channels" (or similar); in that case args_field receives the market id list and channels_field receives the channel name (wrapped in a single-element list when the field is literally "channels", otherwise bare).

Config keys:

  • :op_field — default "type"
  • :args_field — default "topic"; Coinbase sets "product_ids"
  • :args_format:string (KuCoin default) or :string_list for arrays
  • :channels_field — when set, activates the dual-field shape
  • :channel_name — the channel name placed under channels_field