aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2019-10-07 21:10:29 -0700
committerAdam Soltys <[email protected]>2019-10-07 21:10:29 -0700
commit10723d0dde2f40b09f20c03161e9fb0af002f719 (patch)
tree5ab174bbfe08cd673d9521300ea8d7081d9a042b
parent67b6cfb95f586503341696a9625514edec744606 (diff)
downloadcoinos-server-10723d0dde2f40b09f20c03161e9fb0af002f719.tar.gz
coinos-server-10723d0dde2f40b09f20c03161e9fb0af002f719.zip
custom rates for venezuela
-rw-r--r--rates.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/rates.js b/rates.js
index 33c66ec8..b3c04c6c 100644
--- a/rates.js
+++ b/rates.js
@@ -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&currency=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);
}