diff options
| author | Adam Soltys <[email protected]> | 2019-10-07 21:10:29 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2019-10-07 21:10:29 -0700 |
| commit | 10723d0dde2f40b09f20c03161e9fb0af002f719 (patch) | |
| tree | 5ab174bbfe08cd673d9521300ea8d7081d9a042b /rates.js | |
| parent | 67b6cfb95f586503341696a9625514edec744606 (diff) | |
| download | coinos-server-10723d0dde2f40b09f20c03161e9fb0af002f719.tar.gz coinos-server-10723d0dde2f40b09f20c03161e9fb0af002f719.zip | |
custom rates for venezuela
Diffstat (limited to 'rates.js')
| -rw-r--r-- | rates.js | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -13,16 +13,20 @@ module.exports = app => { let fx = res.data.rates; - if (fx) { + fx && Object.keys(fx).map(symbol => { rates[symbol] = fx[symbol] / fx["USD"]; - if (symbol === "VEF") rates[symbol] *= 5; }); - app.set("rates", rates); - } else { - l("Problem fetching rates", res); - } + res = await axios.get( + "https://api.bitcoinvenezuela.com/?html=no¤cy=VEF" + ); + + rates.VEF = res.data["exchange_rates"].VEF_USD; + rates.VES = res.data["exchange_rates"].VEF_USD / 100000; + rates.KVES = res.data["exchange_rates"].VEF_USD / 100000000; + + app.set("rates", rates); } catch (e) { l(e); } |
