Packages

Elixir client library for cryptocurrency exchanges — generated from CCXT specs via compile-time macros.

Current section

Files

Jump to
ccxt_client lib ccxt ws helpers.ex
Raw

lib/ccxt/ws/helpers.ex

defmodule CCXT.WS.Helpers do
@moduledoc """
Pure helpers for WS URL resolution.
Subscribe-frame construction lives in the pattern modules under
`CCXT.WS.Subscription.*` (T94); this module now only holds the hostname
interpolation helper used by `CCXT.WS.URLRouting`.
"""
@doc """
Replaces the `{hostname}` placeholder in a URL template. Nil hostname returns
the template unchanged (mirrors the private helper of the same name in `CCXT.Exchange`).
"""
@spec interpolate_hostname(String.t(), String.t() | nil) :: String.t()
def interpolate_hostname(url, nil), do: url
def interpolate_hostname(url, hostname) when is_binary(hostname), do: String.replace(url, "{hostname}", hostname)
end