Current section
Files
Jump to
Current section
Files
lib/ccxt/currency.ex
defmodule CCXT.Currency do
@moduledoc """
Unified currency data.
Describes a currency or token supported by an exchange, including
deposit/withdraw capabilities and network information.
## Fields
* `id` - Exchange-specific currency ID
* `code` - Unified currency code (e.g., "BTC")
* `name` - Full currency name
* `numeric_id` - Numeric ID (some exchanges)
* `precision` - Decimal precision
* `type` - "crypto" or "fiat"
* `active` - Whether trading/deposit/withdraw is enabled
* `deposit` - Whether deposits are enabled
* `withdraw` - Whether withdrawals are enabled
* `fee` - Default withdrawal fee
* `margin` - Whether margin trading is available
* `networks` - Network-specific deposit/withdraw info
* `info` - Raw exchange response
"""
import JSONSpec, only: [schema: 2]
@type t :: %__MODULE__{
id: String.t() | nil,
code: String.t() | nil,
name: String.t() | nil,
numeric_id: integer() | nil,
precision: number() | nil,
type: String.t() | nil,
active: boolean() | nil,
deposit: boolean() | nil,
withdraw: boolean() | nil,
fee: number() | nil,
margin: boolean() | nil,
networks: map(),
info: map() | nil
}
defstruct [
:id,
:code,
:name,
:numeric_id,
:precision,
:type,
:active,
:deposit,
:withdraw,
:fee,
:margin,
:info,
networks: %{}
]
@json_schema schema(
%{
id: String.t() | nil,
code: String.t() | nil,
name: String.t() | nil,
numeric_id: integer() | nil,
precision: number() | nil,
type: String.t() | nil,
active: boolean() | nil,
deposit: boolean() | nil,
withdraw: boolean() | nil,
fee: number() | nil,
margin: boolean() | nil,
networks: map(),
info: map() | nil
},
doc: [
id: "Exchange-specific currency ID",
code: "Unified currency code (e.g., BTC)",
name: "Full currency name",
numeric_id: "Numeric ID (some exchanges)",
precision: "Decimal precision",
type: "crypto or fiat",
active: "Whether trading/deposit/withdraw is enabled",
deposit: "Whether deposits are enabled",
withdraw: "Whether withdrawals are enabled",
fee: "Default withdrawal fee",
margin: "Whether margin trading is available",
networks: "Network-specific deposit/withdraw info",
info: "Raw exchange response"
]
)
@doc "JSON Schema for the Currency unified type."
@spec schema() :: map()
def schema, do: @json_schema
end