Home

Awesome

ex_changerate build license contributions welcome hex

Exchangerate is a free exchange & crypto rates API, no access key is required.

Development is made in accordance to available endpoint specs (see https://exchangerate.host/#/docs)

By default, the api_instance configuration is pointing to the widely-available public instance.

Examples

Get latest rates:

iex> ExChangerate.LatestRates.get

Convert currencies

iex> ExChangerate.ConvertCurrency.get(from: "BTC", to: "USD")

Get historical rates from given date:

iex> ExChangerate.HistoricalRates.get(date: "2020-01-01")

Display timeseries within given date range:

iex> ExChangerate.Timeseries.get(start_date: "2020-04-01", end_date: "2020-04-30")

Retrieve information about how currencies fluctuate:

iex> ExChangerate.Fluctuation.get(start_date: "2020-05-01", end_date: "2020-05-05")

Access list of currently available currencies:

iex> ExChangerate.SupportedSymbols.get

Additional parameters can be provided if they are supported by given endpoint. Below techniques can be used depending on preferences, e.g. for converting currencies, comma separated:

iex> ExChangerate.ConvertCurrency.get([from: "BTC", to: "USD"], amount: 2, date: "2020-04-04")

or equivalent by including options:

iex> ExChangerate.ConvertCurrency.get([from: "BTC", to: "USD"], options: "amount=2&date=2020-04-04")

Installation

def deps do
  [
      {:ex_changerate, "~> 0.1"}
  ]
end