Skip to content

Latest commit

 

History

History
175 lines (113 loc) · 3.75 KB

API.md

File metadata and controls

175 lines (113 loc) · 3.75 KB

Table of Contents

exchange

Javascript client for exchangeratesapi.io

Import the client

const exchange = require('@abskmj/exchangeratesapi')

symbols

Get exchange symbols

Parameters

Examples

exchange.symbols({ access_key: '<API_KEY>' })

Returns Axios.Response Response from Axios module

rates

Get exchange rates

Parameters

  • access_key string API Key
  • date string Date in YYYY-MM-DD format (optional, default latest)
  • base string Currency against which rates are quoted (optional, default EUR)
  • symbols string? Comma separated currencies for which rates are needed

Examples

// 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

convert

Get converted amount

Parameters

  • access_key string API Key
  • from string Symbol converted from
  • to string Symbol converted to
  • amount string Amount to be converted
  • date string? Date in YYYY-MM-DD format

Examples

exchange.convert({ access_key, from: 'USD', to: 'EUR', amount: 1 })

Returns Axios.Response Response from Axios module

timeseries

Get historical exchange rates

Parameters

  • access_key string API Key
  • start_at string State date in YYYY-MM-DD format
  • end_at string End date in YYYY-MM-DD format
  • base string Currency against which rates are quoted (optional, default EUR)
  • symbols string? Comma separated currencies for which rates are needed

Examples

exchange.timeseries({ access_key: '<API_KEY>', start_at: '2020-01-01', end_at: '2020-03-31' })

Returns Axios.Response Response from Axios module

fluctuation

Get fluctuations

Parameters

  • access_key string API Key
  • start_at string State date in YYYY-MM-DD format
  • end_at string End date in YYYY-MM-DD format
  • base string Currency against which rates are quoted (optional, default EUR)
  • symbols string? Comma separated currencies for which rates are needed

Examples

exchange.fluctuation({ access_key: '<API_KEY>', start_at: '2020-01-01', end_at: '2020-03-31' })

Returns Axios.Response Response from Axios module