Javascript client for exchangeratesapi.io
Import the client
const exchange = require('@abskmj/exchangeratesapi')
Get exchange symbols
access_key
string API Key
exchange.symbols({ access_key: '<API_KEY>' })
Returns Axios.Response Response from Axios module
Get exchange rates
access_key
string API Keydate
string Date in YYYY-MM-DD format (optional, defaultlatest
)base
string Currency against which rates are quoted (optional, defaultEUR
)symbols
string? Comma separated currencies for which rates are needed
// get latest rates
exchange.rates({ access_key: '<API_KEY>' })
// get latest rates for a base symbol
exchange.rates({ access_key: '<API_KEY>', base: 'USD' })
// get latest rates in specific symbols
exchange.rates({ access_key: '<API_KEY>', symbols: 'USD,GBP' })
// get rates on a specific date
exchange.rates({ access_key: '<API_KEY>', date: '2010-01-12' })
Returns Axios.Response Response from Axios module
Get converted amount
access_key
string API Keyfrom
string Symbol converted fromto
string Symbol converted toamount
string Amount to be converteddate
string? Date in YYYY-MM-DD format
exchange.convert({ access_key, from: 'USD', to: 'EUR', amount: 1 })
Returns Axios.Response Response from Axios module
Get historical exchange rates
access_key
string API Keystart_at
string State date in YYYY-MM-DD formatend_at
string End date in YYYY-MM-DD formatbase
string Currency against which rates are quoted (optional, defaultEUR
)symbols
string? Comma separated currencies for which rates are needed
exchange.timeseries({ access_key: '<API_KEY>', start_at: '2020-01-01', end_at: '2020-03-31' })
Returns Axios.Response Response from Axios module
Get fluctuations
access_key
string API Keystart_at
string State date in YYYY-MM-DD formatend_at
string End date in YYYY-MM-DD formatbase
string Currency against which rates are quoted (optional, defaultEUR
)symbols
string? Comma separated currencies for which rates are needed
exchange.fluctuation({ access_key: '<API_KEY>', start_at: '2020-01-01', end_at: '2020-03-31' })
Returns Axios.Response Response from Axios module