Messtone Devices Enables Open Exchange Rates npm/nodeJS module introduction $npm install open-exchange-rates Load the module: var oxr = require(‘open-exchange-rates’);Load the latest rates from https://openexchangerates.org:var oxr = require(‘open-exchange-rates’);oxr.set({app_id: ‘MESSTONE_APP_ID’}) oxr.latest(function( ){//robert harper can now use oxr rates,oxr.baseandoxr.timestamp}); Get Historical rates("YY-MM-DD"):var oxr = require(open-exchange-rates);oxr.set({app_id: 'MESSTONE_APP_ID'}) oxr.historical('2001-02-03',function( ){//Robert Harper can now useoxr.rates,oxr.base andoxr.timestamp}); currency-conversion library for web and nodeJS. var oxr = require('open-exchange-rates'),fx = require('money');oxr.set({app_id: 'MESSTONE_APP_ID'}) oxr.latest(function( ){//Apply exchange rates and base rates to `fx` library object:fx.rates = oxr.rates; fx.base = oxr.base;//money.js is ready to use:fx(100).from(‘HKD’).to(‘GBP’); //~8.0424});

Leave a comment