Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/81dr/ex_changerate
Elixir client for exchangerate platform API
https://github.com/81dr/ex_changerate
api-exchange-rates convert-currencies exchange-client
Last synced: 7 days ago
JSON representation
Elixir client for exchangerate platform API
- Host: GitHub
- URL: https://github.com/81dr/ex_changerate
- Owner: 81dr
- License: 0bsd
- Created: 2020-06-03T15:55:14.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-11-10T15:58:27.000Z (about 4 years ago)
- Last Synced: 2024-10-06T16:48:13.918Z (about 1 month ago)
- Topics: api-exchange-rates, convert-currencies, exchange-client
- Language: Elixir
- Homepage:
- Size: 21.5 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-elixir - ex_changerate - Elixir client for [exchangerate.host](https://exchangerate.host) API. (Third Party APIs)
- awesome-elixir - ex_changerate - Elixir client for [exchangerate.host](https://exchangerate.host) API. (Third Party APIs)
README
# ex_changerate [![build](https://img.shields.io/travis/81dr/ex_changerate?style=flat-square)](https://travis-ci.org/81dr/ex_changerate) [![license](https://img.shields.io/hexpm/l/ex_changerate?style=flat-square)](https://github.com/81dr/ex_changerate/blob/master/LICENSE) [![contributions welcome](https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat-square)](https://github.com/81dr/ex_changerate/issues) [![hex](https://img.shields.io/hexpm/v/ex_changerate?style=flat-square)](https://hex.pm/packages/ex_changerate)
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:
```elixir
iex> ExChangerate.LatestRates.get
```Convert currencies
```elixir
iex> ExChangerate.ConvertCurrency.get(from: "BTC", to: "USD")
```Get historical rates from given date:
```elixir
iex> ExChangerate.HistoricalRates.get(date: "2020-01-01")
```Display timeseries within given date range:
```elixir
iex> ExChangerate.Timeseries.get(start_date: "2020-04-01", end_date: "2020-04-30")
```Retrieve information about how currencies fluctuate:
```elixir
iex> ExChangerate.Fluctuation.get(start_date: "2020-05-01", end_date: "2020-05-05")
```Access list of currently available currencies:
```elixir
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:
```elixir
iex> ExChangerate.ConvertCurrency.get([from: "BTC", to: "USD"], amount: 2, date: "2020-04-04")
```
or equivalent by including `options`:
```elixir
iex> ExChangerate.ConvertCurrency.get([from: "BTC", to: "USD"], options: "amount=2&date=2020-04-04")
```## Installation
```elixir
def deps do
[
{:ex_changerate, "~> 0.1"}
]
end
```