coinglecko/exchanges
Exchange data endpoints.
Types
Detailed exchange data.
pub type Exchange {
Exchange(
id: String,
name: String,
year_established: option.Option(Int),
country: option.Option(String),
trust_score: option.Option(Int),
trust_score_rank: option.Option(Int),
trade_volume_24h_btc: Float,
)
}
Constructors
-
Exchange( id: String, name: String, year_established: option.Option(Int), country: option.Option(String), trust_score: option.Option(Int), trust_score_rank: option.Option(Int), trade_volume_24h_btc: Float, )
A simple exchange list item (id and name only).
pub type ExchangeListItem {
ExchangeListItem(id: String, name: String)
}
Constructors
-
ExchangeListItem(id: String, name: String)
Exchange ticker data.
pub type ExchangeTicker {
ExchangeTicker(
base: String,
target: String,
coin_id: String,
target_coin_id: String,
last: Float,
volume: Float,
trust_score: option.Option(String),
)
}
Constructors
-
ExchangeTicker( base: String, target: String, coin_id: String, target_coin_id: String, last: Float, volume: Float, trust_score: option.Option(String), )
Exchange tickers response.
pub type ExchangeTickersResponse {
ExchangeTickersResponse(
name: String,
tickers: List(ExchangeTicker),
)
}
Constructors
-
ExchangeTickersResponse( name: String, tickers: List(ExchangeTicker), )
Values
pub fn decode_exchange(
json_string: String,
) -> Result(Exchange, error.CoinGeckoError)
Decode an exchange detail from a JSON string.
pub fn decode_exchange_list(
json_string: String,
) -> Result(List(ExchangeListItem), error.CoinGeckoError)
Decode an exchange list from a JSON string.
pub fn decode_exchange_tickers(
json_string: String,
) -> Result(ExchangeTickersResponse, error.CoinGeckoError)
Decode exchange tickers from a JSON string.
pub fn get_by_id(
client: client.Client,
id id: String,
send sender: fn(request.Request(String)) -> Result(
response.Response(String),
String,
),
) -> Result(Exchange, error.CoinGeckoError)
Get detailed data for a specific exchange.
pub fn get_by_id_request(
client: client.Client,
id id: String,
) -> Result(request.Request(String), error.CoinGeckoError)
Build a request to get detailed data for a specific exchange.
pub fn list(
client: client.Client,
send sender: fn(request.Request(String)) -> Result(
response.Response(String),
String,
),
) -> Result(List(ExchangeListItem), error.CoinGeckoError)
Get list of all supported exchanges (id and name only).
pub fn list_request(
client: client.Client,
) -> Result(request.Request(String), error.CoinGeckoError)
Build a request to get list of all supported exchanges.
pub fn tickers(
client: client.Client,
id id: String,
coin_ids coin_ids: option.Option(String),
page page: option.Option(Int),
order order: option.Option(String),
depth depth: option.Option(Bool),
send sender: fn(request.Request(String)) -> Result(
response.Response(String),
String,
),
) -> Result(ExchangeTickersResponse, error.CoinGeckoError)
Get tickers for a specific exchange.
pub fn tickers_request(
client: client.Client,
id id: String,
coin_ids coin_ids: option.Option(String),
page page: option.Option(Int),
order order: option.Option(String),
depth depth: option.Option(Bool),
) -> Result(request.Request(String), error.CoinGeckoError)
Build a request to get tickers for a specific exchange.