clean up debug
This commit is contained in:
parent
98c5faae27
commit
51cad4da9c
1 changed files with 5 additions and 2 deletions
|
|
@ -578,6 +578,8 @@ function purchase (trade, cb) {
|
||||||
function consolidateTrades (cryptoCode) {
|
function consolidateTrades (cryptoCode) {
|
||||||
// NOTE: value in cryptoAtoms stays the same no matter the currency
|
// NOTE: value in cryptoAtoms stays the same no matter the currency
|
||||||
|
|
||||||
|
if (tradesQueues[cryptoCode].length === 0) return null
|
||||||
|
|
||||||
logger.debug('tradesQueues size: %d', tradesQueues[cryptoCode].length)
|
logger.debug('tradesQueues size: %d', tradesQueues[cryptoCode].length)
|
||||||
logger.debug('tradesQueues head: %j', tradesQueues[cryptoCode][0])
|
logger.debug('tradesQueues head: %j', tradesQueues[cryptoCode][0])
|
||||||
var cryptoAtoms = tradesQueues[cryptoCode].reduce(function (prev, current) {
|
var cryptoAtoms = tradesQueues[cryptoCode].reduce(function (prev, current) {
|
||||||
|
|
@ -603,6 +605,7 @@ function executeTrades (cryptoCode) {
|
||||||
logger.debug('[%s] checking for trades', cryptoCode)
|
logger.debug('[%s] checking for trades', cryptoCode)
|
||||||
|
|
||||||
var trade = consolidateTrades(cryptoCode)
|
var trade = consolidateTrades(cryptoCode)
|
||||||
|
if (trade === null) return logger.debug('[%s] no trades', cryptoCode)
|
||||||
|
|
||||||
if (trade.cryptoAtoms.eq(0)) {
|
if (trade.cryptoAtoms.eq(0)) {
|
||||||
logger.debug('[%s] rejecting 0 trade', cryptoCode)
|
logger.debug('[%s] rejecting 0 trade', cryptoCode)
|
||||||
|
|
@ -612,9 +615,9 @@ function executeTrades (cryptoCode) {
|
||||||
logger.debug('making a trade: %d', trade.cryptoAtoms.toString())
|
logger.debug('making a trade: %d', trade.cryptoAtoms.toString())
|
||||||
purchase(trade, function (err) {
|
purchase(trade, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
logger.debug(err)
|
|
||||||
tradesQueues[cryptoCode].push(trade)
|
tradesQueues[cryptoCode].push(trade)
|
||||||
if (err.name !== 'orderTooSmall') logger.error(err)
|
if (err.name !== 'orderTooSmall') return logger.error(err)
|
||||||
|
else return logger.debug(err)
|
||||||
}
|
}
|
||||||
logger.debug('Successful trade.')
|
logger.debug('Successful trade.')
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue