diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/rates.js | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/rates.js b/lib/rates.js index a392c913..d1cbb92b 100644 --- a/lib/rates.js +++ b/lib/rates.js @@ -49,9 +49,15 @@ export let getRates = async () => { date = Date.now(); try { let r = await got( - `https://v6.exchangerate-api.com/v6/${config.exchange}/latest/USD` + `http://data.fixer.io/api/latest?access_key=${config.fixer}` ).json(); - let { conversion_rates: fx } = r; + let { rates: fx } = r; + let USD = fx['USD']; + + Object.keys(fx).map(k => { + fx[k] = fx[k] / USD; + }); + await s("rates", { date, fx }); } catch (e) { err("error fetching rates", e.message); |
