Commit c83945c9 by ken

depth

parent f4909e49
...@@ -167,7 +167,7 @@ function _handleDepthData(symbol, data, source) { ...@@ -167,7 +167,7 @@ function _handleDepthData(symbol, data, source) {
const bids = data.bids.slice(0, 5); const bids = data.bids.slice(0, 5);
const currentJsonData = JSON.stringify({asks, bids}); const currentJsonData = JSON.stringify({asks, bids});
if (data.timestamp > lastEventTime if (data.timestamp > lastEventTime
|| (data.timestamp === lastEventTime /*&& currentJsonData !== lastDataMap[symbol] && (currentJsonData !== lastLastDataMap[symbol] || lastLastEventTime != data.timestamp)*/)) { || (data.timestamp === lastEventTime && currentJsonData !== lastDataMap[symbol] && (currentJsonData !== lastLastDataMap[symbol] || lastLastEventTime != data.timestamp))) {
if (symbol === "BTCUSDT") { if (symbol === "BTCUSDT") {
let consoleMethod = console.log; let consoleMethod = console.log;
if (data.timestamp === lastEventTime) { if (data.timestamp === lastEventTime) {
...@@ -252,11 +252,11 @@ function getBalanceByRest() { ...@@ -252,11 +252,11 @@ function getBalanceByRest() {
function run() { function run() {
subscribe(); subscribe();
const depthInterval = Math.max(60 * 1000 / (900 * ips.length / observerSymbol.length), 55); const depthInterval = Math.max(60 * 1000 / (900 * ips.length / observerSymbol.length), 60);
console.log(depthInterval); console.log(depthInterval);
setInterval(() => { setInterval(() => {
for (const symbol of observerSymbol) { for (const symbol of observerSymbol) {
// depthByRest(symbol); depthByRest(symbol);
} }
}, depthInterval); }, depthInterval);
setInterval(() => { setInterval(() => {
......
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