aboutsummaryrefslogtreecommitdiffstats
path: root/lib/binance.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/binance.js')
-rw-r--r--lib/binance.js17
1 files changed, 7 insertions, 10 deletions
diff --git a/lib/binance.js b/lib/binance.js
index 3e25e277..1dc1facd 100644
--- a/lib/binance.js
+++ b/lib/binance.js
@@ -1,7 +1,7 @@
import app from "../app.js";
import WebSocket from "ws";
import { err } from "./logging.js";
-import { rates } from "./store.js";
+import store from "./store.js";
export default () => {
const binance = new WebSocket(
@@ -12,18 +12,15 @@ export default () => {
try {
let msg = JSON.parse(event.data);
- let fx = app.get("fx");
- if (!fx) return;
- let rates = {};
+ if (!store.fx) return;
- Object.keys(fx).map(symbol => {
- rates[symbol] = msg.c * fx[symbol];
+ Object.keys(store.fx).map(symbol => {
+ store.rates[symbol] = msg.c * store.fx[symbol];
});
- app.set("ask", msg.a);
- app.set("bid", msg.b);
- app.set("last", msg.c);
- app.set("rates", rates);
+ // app.set("ask", msg.a);
+ // app.set("bid", msg.b);
+ last = msg.c;
} catch (e) {
err("binance message error", e.message);
}