Skip to content

Commit

Permalink
Insight into Depth Cache Events
Browse files Browse the repository at this point in the history
Tickers with low volume might not emit a depth cache update during long periods of time
  • Loading branch information
bmino committed May 3, 2019
1 parent 449c65e commit ae18afb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ function calculateArbitrage() {
const msg = `Completed ${completedCalculations}/${totalCalculations} (${((completedCalculations/totalCalculations)*100).toFixed(1)}%) calculations in ${calculationTime} ms`;
(errorCount > 0) ? logger.performance.info(msg) : logger.performance.trace(msg);

const tickersWithoutDepthUpdate = MarketCache.getTickersWithoutDepthCacheUpdate();
(tickersWithoutDepthUpdate.length > 0) && logger.execution.trace(`Found ${tickersWithoutDepthUpdate.length} tickers without a depth cache update: [${tickersWithoutDepthUpdate}]`);

if (CONFIG.HUD.ENABLED) refreshHUD(results);

setTimeout(calculateArbitrage, CONFIG.CALCULATION_COOLDOWN);
Expand Down
4 changes: 4 additions & 0 deletions src/main/MarketCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ const MarketCache = {
return trades;
},

getTickersWithoutDepthCacheUpdate() {
return MarketCache.getTickerArray().filter(ticker => !binance.depthCache(ticker).eventTime);
},

createTrade(a, b, c) {
const ab = MarketCache.getRelationship(a, b);
if (!ab) return;
Expand Down

0 comments on commit ae18afb

Please sign in to comment.