swea-exchange-rate v1.2.0
Description
This module will return the exchange rate between a currency and SEK (Swedish Kronor) or the other way around, from SEK to a currency, using the 'Sveriges Riksbanks API'.
Install
Install with npm:
npm install swea-exchange-rate
How to use
In this example the cross rate between EUR (€ Euro) and SEK (Svenska kronor) is returned.
var exchangeRates = require('swea-exchange-rate');
exchangeRates.getExchangeRate( 'EUR', 'SEK', '2016-02-29', ( err, exchangeRate ) => {
if (err) {
// TODO: Handle error
}
console.log( `Rate: ${exchangeRate.value}`);
});
The response of the result in the callback method will be something like:
{
description: '1 EUR = ? SEK',
date: '2016-02-29',
value: '9.3936'
}
If the specified date is a bank holiday, sunday or saturday, then no exchange rate will be available and in that case the most recent date with an exchange rate will be returned.
More information
This module will call Sveriges Riksbanks API using the SOAP protocol.
The seriesId that's being used are from this list (under "Valutakurser"): http://www.riksbank.se/sv/Rantor-och-valutakurser/serier-for-webbservices/