Commit 9cb9616c by ken

试试看吧

parent f5cc5fd9
...@@ -76,7 +76,7 @@ function subscribe() { ...@@ -76,7 +76,7 @@ function subscribe() {
const symbol = depth.channel.replace('_depth', '').toUpperCase(); const symbol = depth.channel.replace('_depth', '').toUpperCase();
const lastEventTime = lastEventTimeMap[symbol] || 0; const lastEventTime = lastEventTimeMap[symbol] || 0;
if (depth.timestamp > lastEventTime) { if (depth.timestamp > lastEventTime) {
lastEventTimeMap[symbol] = depth.timeStamp; lastEventTimeMap[symbol] = depth.timestamp;
if (symbol === "BTCUSDT") if (symbol === "BTCUSDT")
console.log(symbol + '@' + depth.timestamp * 1000 + ' from websocket'); console.log(symbol + '@' + depth.timestamp * 1000 + ' from websocket');
const publishContent = JSON.stringify({symbol, time: depth.timestamp * 1000}); const publishContent = JSON.stringify({symbol, time: depth.timestamp * 1000});
...@@ -119,7 +119,7 @@ function depthByRest(symbol,callback) { ...@@ -119,7 +119,7 @@ function depthByRest(symbol,callback) {
symbol = symbol.toUpperCase(); symbol = symbol.toUpperCase();
const lastEventTime = lastEventTimeMap[symbol] || 0; const lastEventTime = lastEventTimeMap[symbol] || 0;
if (data.timestamp > lastEventTime) { if (data.timestamp > lastEventTime) {
lastEventTimeMap[symbol] = data.timeStamp; lastEventTimeMap[symbol] = data.timestamp;
if (symbol === "BTCUSDT") if (symbol === "BTCUSDT")
console.log(symbol + '@' + data.timestamp * 1000 + ' from rest'); console.log(symbol + '@' + data.timestamp * 1000 + ' from rest');
const publishContent = JSON.stringify({symbol, time: data.timestamp * 1000}); const publishContent = JSON.stringify({symbol, time: data.timestamp * 1000});
......
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