From 376de2cf639d713c35b6e6d192f6b77bc081b944 Mon Sep 17 00:00:00 2001 From: Daniel Espendiller Date: Sun, 14 Jan 2018 20:56:19 +0100 Subject: [PATCH] binance order placement must not retry a MIN_NOTIONAL issue (#1130) follow up of #1123; fix in #1096 was not working. tested against real life issue --- extensions/exchanges/binance/exchange.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/extensions/exchanges/binance/exchange.js b/extensions/exchanges/binance/exchange.js index 855c588e02..204dd8a8d9 100644 --- a/extensions/exchanges/binance/exchange.js +++ b/extensions/exchanges/binance/exchange.js @@ -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) }) }, @@ -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) }) },