diff options
Diffstat (limited to 'lib/rates.js')
| -rw-r--r-- | lib/rates.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rates.js b/lib/rates.js index e7c16548..1827c1f6 100644 --- a/lib/rates.js +++ b/lib/rates.js @@ -27,7 +27,7 @@ let fetchRates; try { let { data: { rates: fx } - } = await axios.get("https://api.exchangerate.host/latest?base=USD"); + } = await axios.get(`https://api.exchangerate.host/latest?base=USD&v={(new Date()).toISOString().split('T')[0]}`); fs.writeFileSync("fx", JSON.stringify({ date, fx })); } catch (e) { try { @@ -41,6 +41,7 @@ let fetchRates; Object.keys(fx).map(k => { fx[k] = parseFloat((fx[k] / fx["USD"]).toFixed(6)); }); + fs.writeFileSync("fx", JSON.stringify({ date, fx })); } catch (e) { err("error fetching rates", e.message); |
