aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/binance.js5
-rw-r--r--lib/rates.js8
2 files changed, 7 insertions, 6 deletions
diff --git a/lib/binance.js b/lib/binance.js
index aa6364c8..55b29ee8 100644
--- a/lib/binance.js
+++ b/lib/binance.js
@@ -7,7 +7,7 @@ module.exports = () => {
try {
let msg = JSON.parse(event.data);
- let fx = app.get("fxrates");
+ let fx = app.get("fx");
if (!fx) return;
let rates = {};
@@ -16,7 +16,8 @@ module.exports = () => {
});
app.set("ask", msg.a);
- app.set("last", msg.l);
+ app.set("bid", msg.b);
+ app.set("last", msg.c);
app.set("balance", await lq.getBalance());
app.set("rates", rates);
checkQueue();
diff --git a/lib/rates.js b/lib/rates.js
index a8818375..33982ba3 100644
--- a/lib/rates.js
+++ b/lib/rates.js
@@ -4,7 +4,7 @@ let binance = require("./binance")();
let fetchRates;
(fetchRates = async () => {
- let rates = require("./devrates");
+ let fx = require("./devrates");
if (prod) {
try {
@@ -12,7 +12,7 @@ let fetchRates;
`http://data.fixer.io/api/latest?access_key=${config.fixer}`
);
- let fx = res.data.rates;
+ fx = res.data.rates;
fx &&
Object.keys(fx).map(symbol => {
@@ -23,13 +23,13 @@ let fetchRates;
}
}
- app.set("fxrates", rates);
+ app.set("fx", fx);
setTimeout(fetchRates, 7200000);
})();
setInterval(() => {
- broadcast("rates", app.get("rates"));
+ broadcast("rate", app.get("last"));
}, 1000);
setInterval(() => {