diff --git a/lib/trader.js b/lib/trader.js index 5584b44b..a07b99be 100644 --- a/lib/trader.js +++ b/lib/trader.js @@ -163,6 +163,27 @@ Trader.prototype.tradeQueueFiatBalance = function (exchangeRate) { return (satoshis / SATOSHI_FACTOR) * exchangeRate; }; +Trader.prototype._consolidateTrades = function () { + var queue = this._tradeQueue; + + var tradeRec = { + fiat: 0, + satoshis: 0, + currency: 'USD' + }; + + while (true) { + var lastRec = queue.shift(); + if (!lastRec) { + break; + } + tradeRec.fiat += lastRec.fiat; + tradeRec.satoshis += lastRec.satoshis; + tradeRec.currency = lastRec.currency; + } + return tradeRec; +}; + Trader.prototype.startPolling = function () { this.pollBalance(); this.pollRate();