Commit f5cc5fd9 by ken

试试看吧

parent f36c3822
......@@ -77,7 +77,8 @@ function subscribe() {
const lastEventTime = lastEventTimeMap[symbol] || 0;
if (depth.timestamp > lastEventTime) {
lastEventTimeMap[symbol] = depth.timeStamp;
console.log(symbol + '@' + depth.timestamp * 1000 + ' from websocket');
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});
redisClient.set(key, depthJson, 'EX', 1);
......@@ -115,10 +116,12 @@ 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;
console.log(symbol + '@' + data.timestamp * 1000 + ' from rest');
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});
redisClient.set(key, depthJson, 'EX', 1);
......
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