Skip to content

Commit

Permalink
binance order placement must not retry a MIN_NOTIONAL issue (DeviaVir…
Browse files Browse the repository at this point in the history
…#1130)

follow up of DeviaVir#1123; fix in DeviaVir#1096 was not working. tested against real life issue
  • Loading branch information
Haehnchen authored and defkev committed Jan 14, 2018
1 parent fe0845a commit 376de2c
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions extensions/exchanges/binance/exchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@ module.exports = function container (get, set, clear) {
cb(null, order)
}).catch(function (error) {
console.error('An error occurred', error)

// decide if this error is allowed for a retry:
// {"code":-1013,"msg":"Filter failure: MIN_NOTIONAL"}
if (error.message.match(new RegExp(/-1013|MIN_NOTIONAL/))) {
return cb(null, {
status: 'rejected',
reject_reason: 'balance'
})
}

return retry('buy', func_args)
})
},
Expand Down Expand Up @@ -241,6 +251,16 @@ module.exports = function container (get, set, clear) {
cb(null, order)
}).catch(function (error) {
console.error('An error occurred', error)

// decide if this error is allowed for a retry:
// {"code":-1013,"msg":"Filter failure: MIN_NOTIONAL"}
if (error.message.match(new RegExp(/-1013|MIN_NOTIONAL/))) {
return cb(null, {
status: 'rejected',
reject_reason: 'balance'
})
}

return retry('sell', func_args)
})
},
Expand Down

0 comments on commit 376de2c

Please sign in to comment.