open-exchange-rate
v1.0.2
Published
This package is used to get the exchange rates for the list of currencies.
Downloads
41
Maintainers
Readme
open-exchange-rate
This module is used to get the latest currency exchange rates from the open exchange rates public api.
Getting Started
Install the module using the following command.
npm i open-exchange-rate
Example
Below given is the example to use this package.
Note : USD is the base currency.
const oxr = require('open-exchange-rate');
oxr.set({ app_id: 'APP_ID_HERE' });
let currencies = ["CAD", "EUR"];
oxr.getExchangeRate(currencies).then(({rates}) => {
console.log(rates); // { CAD: 1.342507, EUR: 0.896797}
})
.catch(err => {
console.log('Error :: ',err);
});
Also please refer example.js file for an example.
Replace the APP_ID_HERE with your APP_ID or say API_KEY.
Use the below command to run the example.
node example.js
Documentation
For further reference and for list of currencies, please refer the documentation.
Authors
- Vishweswaran P - Initial work - Github
License
This project is licensed under the ISC License.