aboutsummaryrefslogtreecommitdiffstats
path: root/binance.js
diff options
context:
space:
mode:
Diffstat (limited to 'binance.js')
-rw-r--r--binance.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/binance.js b/binance.js
index 007f7848..52d06ad9 100644
--- a/binance.js
+++ b/binance.js
@@ -1,5 +1,4 @@
const WebSocket = require("ws");
-
module.exports = (app, socket) => {
const binance = new WebSocket(
"wss://stream.binance.com:9443/ws/btcusdt@ticker"
@@ -11,7 +10,7 @@ module.exports = (app, socket) => {
app.set("ask", msg.a);
app.set("last", msg.l);
- let fx = app.get("rates");
+ let fx = app.get("fxrates");
if (!fx) return;
let rates = {};
@@ -19,6 +18,8 @@ module.exports = (app, socket) => {
rates[symbol] = msg.a * fx[symbol];
});
- socket.emit("rates", rates);
+ app.set("rates", rates);
};
+
+ return binance;
};