fix up consolidation
This commit is contained in:
parent
1fe57e7cf1
commit
b6d12c8129
1 changed files with 10 additions and 1 deletions
|
|
@ -586,8 +586,17 @@ function consolidateTrades (cryptoCode) {
|
||||||
|
|
||||||
const t0 = Date.now()
|
const t0 = Date.now()
|
||||||
|
|
||||||
const cryptoAtoms = tradesQueues[cryptoCode]
|
const filtered = tradesQueues[cryptoCode]
|
||||||
.filter(trade => t0 - trade.timestamp < TRADE_TTL)
|
.filter(trade => t0 - trade.timestamp < TRADE_TTL)
|
||||||
|
|
||||||
|
const filteredCount = tradesQueues[cryptoCode].length - filtered.length
|
||||||
|
|
||||||
|
if (filteredCount > 0) {
|
||||||
|
tradesQueues[cryptoCode] = filtered
|
||||||
|
logger.debug('[%s] expired %d trades', cryptoCode, filteredCount)
|
||||||
|
}
|
||||||
|
|
||||||
|
const cryptoAtoms = filtered
|
||||||
.reduce((prev, current) => prev.plus(current.cryptoAtoms), new BigNumber(0))
|
.reduce((prev, current) => prev.plus(current.cryptoAtoms), new BigNumber(0))
|
||||||
|
|
||||||
var consolidatedTrade = {
|
var consolidatedTrade = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue