How to get Exchange rate between two currencies for a certain date

We can utilize the currency module to get the exchange rate between two currencies on a specific date.

The following example illustrates the conversion from the Canadian dollar to the US dollar.

var canadianAmount = 100;
var rate = currency.exchangeRate({
    source: 'CAD',
    target: 'USD',
    date: new Date('7/28/2015')
});
var usdAmount = canadianAmount * rate;

Leave a comment

Your email address will not be published. Required fields are marked *