Package Exports
- fixer-node
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fixer-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
fixer-node
A Node.js SDK to interact with the fixer.io API for currency conversion and exchange rates.
For release notes, see the CHANGELOG.
The Future Studio University supports development of this Node.js library 🚀
Join the Future Studio University and Skyrocket in Node.js
Requirements
Node.js v8 (or newer)
fixer-node uses async/await which requires Node.js v8 or newer.
Installation
Add fixer-node as a dependency to your project:
# NPM v5 users, this way is yours
npm i fixer-node
# you’re using NPM v4:
npm i -S fixer-nodeUsage
Initialize an instance of fixer-node and pass your fixer.io access key as an argument:
const Fixer = require('fixer-node')
const fixer = new Fixer('access-key')Options
The constructor of fixer-node requires an access key as the first argument.
The second argument is an options object allowing the following properties:
https:(boolean) set the fixer.io API base URL to eitherhttpsorhttp; default:http
const Fixer = require('fixer-node')
const fixer = new Fixer('access-key', {
https: true
})Symbols
Request a list of currency symbols. This is a mapping between the currency shortcut (EUR) and full name (Euro).
const data = await fixer.symbols()Latest
Request the latest exchange rates.
The .latest() method accepts two parameters:
symbols: (string) a list of symbols you want the exchange rates for (this reduces the response payload)base: (string) the base currency
// get the latest rates for all currencies
const latest = await fixer.latest(symbols, base)
// get the latest rates for selected currencies
const latest = await fixer.latest('EUR, USD, AUD')
// get the latest rates for selected currencies and base
const latest = await fixer.latest('EUR, USD', 'AUD')Base
Request exchange rates for a given base.
// get all rates for a selected base
const latest = await fixer.base('AUD')Historic
Request historic exchange rates for a given day.
// get exchange rates for May 9th, 2018
const latest = await fixer.forDate('2018-05-09')
// with symbols
const latest = await fixer.forDate('2018-05-09', 'USD, EUR, AUD')
// with symbols and base
const latest = await fixer.forDate('2018-05-09', 'EUR, AUD', 'USD')Feature Requests
Do you miss a feature? Please don’t hesitate to create an issue with a short description of your desired addition to this plugin.
Links & Resources
- fixer.io: exchange rate and currency conversion
Contributing
- Create a fork
- Create your feature branch:
git checkout -b my-feature - Commit your changes:
git commit -am 'Add some feature' - Push to the branch:
git push origin my-new-feature - Submit a pull request 🚀
License
MIT © Future Studio
futurestud.io · GitHub @fs-opensource · Twitter @futurestud_io