Coinranking v0.1.0 Coinranking View Source

An Elixir wrapper for the Coinranking API, using HTTPoison and Poison.

example: coin(1, %{base: "USD", timePeriod: "30d"})

Coinranking API Documentation: https://docs.coinranking.com/public

Link to this section Summary

Functions

Get current data for a single asset.

Get pricing history for a single asset.

List all coins with data - paginated by 50.

List all exchanges - paginated by 50

GET request Returns an HTTPoison response

GET request Returns response body with keys as atoms

Get global stats

List all markets for currencies - paginated by 50

Link to this section Functions

Get current data for a single asset.

%{param: "value"}
param {string|number} id - ID of the coin you want to request
param {string} params.base [default: USD] - Base currency
param {string} params.timePeriod [default: 24h]- Time period where the change and history are based on
Link to this function

coin_history(id, timeframe \\ "24h", params \\ %{})

View Source

Get pricing history for a single asset.

%{param: "value"}
param {string|number} id - ID of the coin you want to request
param {string} params.base [default: USD] - Base currency
param {string} params.timeframe [default: 24h]- Time frame where the change and history are based on

List all coins with data - paginated by 50.

%{param: "value"}
param {string} params.base [default: USD] - Base currency
param {string} params.timePeriod [default: 24h] - Time period where the change and history are based on
param {string} params.prefix - Search to filter the list on. Only one of prefix, symbols, slugs or IDs parameters can be used at once
param {string} params.symbols - Symbols to filter the list on. Separated by comma. Only one of prefix, symbols, slugs or IDs parameters can be used at once
param {string} params.slugs - Slugs to filter the list on. Separated by comma. Only one of prefix, symbols, slugs or IDs parameters can be used at once
param {string} params.ids - IDs to filter the list on. Separated by comma. Only one of prefix, symbols, slugs or IDs parameters can be used at once
param {string} params.sort [default: coinranking] - Index to sort on. Default is Coinranking which takes the penalties in account
param {string|number} params.limit [default: 50] - Limit. Used for pagination. Range: 0-100
param {string|number} params.offset [default: 0] - Offset. Used for pagination
param {string} params.order [default: desc] - Sort in ascending or descending order
Link to this function

exchanges(params \\ %{})

View Source

List all exchanges - paginated by 50

%{param: "value"}
param {string|number} params.refCurrencyId [default: 1509] - Id of currency in which prices are calculated, defaults to USD
param {string|number} params.limit [default: 50] - Limit. Used for pagination. Range: 0-100
param {string|number} params.offset [default: 0] - Offset. Used for pagination
param {string} params.order [default: volume] - Sort by either volume, price, numberOfMarkets or lastTickerCreatedAt
param {string} params.orderDirection [default: desc] - Sort in ascending or descending order
param {string|number} params.currencyId - Filter exchanges with a specific currency. The exchanges shown will support the specific currency
  and Coinranking will have markets of these currencies. The price will be passed down when this paramater is set.
Link to this function

get(data, params \\ %{})

View Source
get(String.t(), map()) :: {atom(), map()}

GET request Returns an HTTPoison response

Link to this function

get!(data, params \\ %{})

View Source
get!(String.t(), map()) :: map()

GET request Returns response body with keys as atoms

Link to this function

global_stats(params \\ %{})

View Source

Get global stats

%{param: "value"}
param {string} params.base [default: USD] - Base currency

List all markets for currencies - paginated by 50

%{param: "value"}
param {string|number} params.refCurrencyId [default: 1509] - Id of currency in which prices are calculated, defaults to USD
param {string|number} params.currencyId - Filter markets with specific currency as either base or quote.
  Specifying a currencyId will also alter how prices are shown:
  By default all the markets will show the price of the base in the refCurrency (e.g. an ETH/BTC market will show the price of ETH).
  By specifying a currencyId the prices of this currency will always be shown, disregarding whether or not this currency represents the base or the quote in the market
  (e.g. by specifying BTC as currency, both ETH/BTC as BTC/USD markets will show prices of BTC)
param {string} params.toCurrencyId - Filter markets with specific currency as either base or quote. The toCurrencyId will not alter how the prices will be shown,
  but will keep the base price. This can be combined with the currencyId variable to get specific markets.
param {string} params.baseCurrencyId - Filter markets with specific currency as base
param {string} params.quoteCurrencyId - Filter markets with specific currency as quote
param {string} params.sourceId - Filter markets from specific source
param {string|number} params.limit [default: 50] - Limit. Used for pagination. Range: 0-100
param {string|number} params.offset [default: 0] - Offset. Used for pagination
param {string} params.order [default: volume] - Sort by either volume or price.
param {string} params.orderDirection [default: desc] - Sort in ascending or descending order