Commit 8bc20132 by ken

depth

parent 341fff60
...@@ -181,10 +181,13 @@ function depthByRest(symbol,callback) { ...@@ -181,10 +181,13 @@ function depthByRest(symbol,callback) {
symbol = symbol.toUpperCase(); symbol = symbol.toUpperCase();
const lastEventTime = lastEventTimeMap[symbol] || 0; const lastEventTime = lastEventTimeMap[symbol] || 0;
if (data.timestamp > lastEventTime || (data.timestamp === lastEventTime && JSON.stringify(data) !== lastDataMap[symbol])) { if (data.timestamp > lastEventTime || (data.timestamp === lastEventTime && JSON.stringify(data) !== lastDataMap[symbol])) {
if (symbol === "BTCUSDT" && data.timestamp === lastEventTime) { if (symbol === "BTCUSDT") {
console.log(symbol + '@' + data.timestamp * 1000 + ' from rest'); let consoleMethod = console.log;
console.log(lastDataMap[symbol]); if (data.timestamp === lastEventTime) {
console.log(JSON.stringify(data)); consoleMethod = console.error
}
consoleMethod(symbol + '@' + data.timestamp * 1000 + ' from rest');
consoleMethod(JSON.stringify(data));
} }
lastEventTimeMap[symbol] = data.timestamp; lastEventTimeMap[symbol] = data.timestamp;
lastDataMap[symbol] = JSON.stringify(data); lastDataMap[symbol] = JSON.stringify(data);
......
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