Commit f5cc5fd9 by ken

试试看吧

parent f36c3822
......@@ -77,6 +77,7 @@ function subscribe() {
const lastEventTime = lastEventTimeMap[symbol] || 0;
if (depth.timestamp > lastEventTime) {
lastEventTimeMap[symbol] = depth.timeStamp;
if (symbol === "BTCUSDT")
console.log(symbol + '@' + depth.timestamp * 1000 + ' from websocket');
const publishContent = JSON.stringify({symbol, time: depth.timestamp * 1000});
const depthJson = JSON.stringify({asks: depth.asks.reverse(), bids: depth.bids, symbol});
......@@ -115,9 +116,11 @@ function depthByRest(symbol,callback) {
console.error(err);
} else {
const key = symbol.replace('_', '').toUpperCase() + '@zb';
symbol = symbol.toUpperCase();
const lastEventTime = lastEventTimeMap[symbol] || 0;
if (data.timestamp > lastEventTime) {
lastEventTimeMap[symbol] = data.timeStamp;
if (symbol === "BTCUSDT")
console.log(symbol + '@' + data.timestamp * 1000 + ' from rest');
const publishContent = JSON.stringify({symbol, time: data.timestamp * 1000});
const depthJson = JSON.stringify({asks: data.asks.reverse(), bids: data.bids, symbol});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment