From c50d8e137b1a9a07ce4ec7685400c83aa5d84288 Mon Sep 17 00:00:00 2001 From: Tiago Siebler Date: Wed, 17 Jan 2018 00:20:54 +0000 Subject: [PATCH] Add potential setting for min hits before acting --- index.js | 4 +++- lib/TradingCore.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 16cf2bb..73edbb0 100644 --- a/index.js +++ b/index.js @@ -46,7 +46,9 @@ var botOptions = { trading: { paperOnly: true, // only candidates with over x% gain potential are queued for trading - minQueuePercentageThreshold: 3 + minQueuePercentageThreshold: 3, + // how many times we need to see the same opportunity before deciding to act on it + minHitsThreshold: 5 } }, ctrl = { diff --git a/lib/TradingCore.js b/lib/TradingCore.js index 38f2288..8770e39 100644 --- a/lib/TradingCore.js +++ b/lib/TradingCore.js @@ -41,7 +41,7 @@ TradingCore.prototype.processQueue = (queue, opts, currencyCore, stream)=>{ let cand = queue[keys[i]]; let liveRate = currencyCore.getArbitageRate(stream, cand.a_step_from, cand.b_step_from, cand.c_step_from); - if(liveRate >= opts.minQueuePercentageThreshold){ + if(liveRate >= opts.minQueuePercentageThreshold && cand.hits >= opts.minHitsThreshold){ // begin trading logic. Plan: /*