Tradehub.Ticker (Tradehub v0.1.17) View Source
Enable features to work with tickers endpoints.
Link to this section Summary
Types
Candlestick resolution allowed value
Functions
Requests candlesticks for the given market.
Requests latest statistics information about the given market or all markets
Get recent ticker prices of the given market.
Link to this section Types
Specs
resolution() :: 1 | 5 | 30 | 60 | 360 | 1440
Candlestick resolution allowed value
Link to this section Functions
Specs
candlesticks(String.t(), resolution(), integer(), integer()) :: {:ok, [Tradehub.candlestick()]} | String.t() | {:error, HTTPoison.Error.t()}
Requests candlesticks for the given market.
Parameters
- market: the market symbols: e.g
swth_eth1
- resolution: the candlestick period in minutes, possible values are: 1, 5, 30, 60, 360, 1440
- from: the start of time range for data in epoch
seconds
- to: the end of time range for data in epoch
seconds
Returns
- a list of
Tradehub.candlestick()
as expected - a string that represents of an error
- an error if something goes wrong with the connection
Examples
iex> Tradehub.Ticker.candlesticks("swth_eth1", 5, 1610203000, 1610203000)
Specs
market_stats(nil) :: {:ok, [Tradehub.market_stats()]} | String.t() | {:error, HTTPoison.Error.t()}
market_stats(String.t()) :: {:ok, [Tradehub.market_stats()]} | String.t() | {:error, HTTPoison.Error.t()}
Requests latest statistics information about the given market or all markets
Returns
- a list of
Tradehub.market_stats()
as expected - a string that represents of an error
- an error if something goes wrong with the connection
Examples
iex> Tradehub.Ticker.market_stats
iex> Tradehub.Ticker.market_stats("swth_eth1")
Specs
prices(String.t()) :: {:ok, Tradehub.ticker_prices()} | {:error, HTTPoison.Error.t()}
Get recent ticker prices of the given market.
Returns
- an object of type
Tradehub.ticker_prices()
as expected - an error if something goes wrong with the connection
Note
The GET /get_prices
endpoint is not completely implemented, it always responses
an object of type Tradehub.ticker_prices()
although the market param is invalid
Examples
iex> Tradehub.Ticker.prices("swth_eth1")