await oxr.latest();
// You can now use `oxr.rates`, `oxr.base` and `oxr.timestamp`
console.log('oxr.rates', oxr.rates);
console.log('oxr.base', oxr.base);
console.log('oxr.timestamp', oxr.timestamp);
UPDATE:
It appears it doesn't work with "await".
The following works but I am not sure how to use it like that for my use case as I need to wait for the results and then do something else.
oxr.latest(function() {
// You can now use `oxr.rates`, `oxr.base` and `oxr.timestamp`
console.log('oxr', oxr);
console.log('oxr.rates', oxr.rates);
console.log('oxr.base', oxr.base);
console.log('oxr.timestamp', oxr.timestamp);
});
const oxr = require('open-exchange-rates'); oxr.set({ app_id: OXR_APP_ID })
Using version 0.3.0 My app id works fine using: https://openexchangerates.org/api/latest.json?app_id=
UPDATE: It appears it doesn't work with "await". The following works but I am not sure how to use it like that for my use case as I need to wait for the results and then do something else.