Commit 5717a89e by ken

depth

parent aa693302
...@@ -180,14 +180,14 @@ function depthByRest(symbol,callback) { ...@@ -180,14 +180,14 @@ function depthByRest(symbol,callback) {
const key = symbol.replace('_', '').toUpperCase() + 'DEPTH@zb'; const key = symbol.replace('_', '').toUpperCase() + 'DEPTH@zb';
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) !== JSON.stringify(lastDataMap[symbol]))) { if (data.timestamp > lastEventTime || (data.timestamp === lastEventTime && JSON.stringify(data) !== lastDataMap[symbol])) {
if (symbol === "BTCUSDT") { if (symbol === "BTCUSDT") {
console.log(symbol + '@' + data.timestamp * 1000 + ' from rest'); console.log(symbol + '@' + data.timestamp * 1000 + ' from rest');
console.log(JSON.stringify(lastDataMap[symbol])); console.log(lastDataMap[symbol]);
console.log(JSON.stringify(data)); console.log(JSON.stringify(data));
} }
lastEventTimeMap[symbol] = data.timestamp; lastEventTimeMap[symbol] = data.timestamp;
lastDataMap[symbol] = data; lastDataMap[symbol] = JSON.stringify(data);
const publishContent = JSON.stringify({symbol, time: data.timestamp * 1000}); const publishContent = JSON.stringify({symbol, time: data.timestamp * 1000});
const asks = data.asks.reverse(); const asks = data.asks.reverse();
const bids = data.bids; const bids = data.bids;
......
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