From a0f67729555d62dba1e739e2624af07431cd9971 Mon Sep 17 00:00:00 2001 From: Aigars Sukurs Date: Mon, 12 Sep 2022 09:37:01 +0200 Subject: [PATCH 1/2] Handling balanceUpdate event on Spot. Fixes #477 --- node-binance-api.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node-binance-api.js b/node-binance-api.js index 615485fc..ac085741 100644 --- a/node-binance-api.js +++ b/node-binance-api.js @@ -2062,7 +2062,7 @@ let api = function Binance( options = {} ) { if ( Binance.options.execution_callback ) Binance.options.execution_callback( data ); } else if ( type === 'listStatus' ) { if ( Binance.options.list_status_callback ) Binance.options.list_status_callback( data ); - } else if ( type === 'outboundAccountPosition' ) { + } else if ( type === 'outboundAccountPosition' || type === 'balanceUpdate' ) { Binance.options.balance_callback( data ); } else { Binance.options.log( 'Unexpected userData: ' + type ); @@ -2082,7 +2082,7 @@ let api = function Binance( options = {} ) { if ( Binance.options.margin_execution_callback ) Binance.options.margin_execution_callback( data ); } else if ( type === 'listStatus' ) { if ( Binance.options.margin_list_status_callback ) Binance.options.margin_list_status_callback( data ); - } else if ( type === 'outboundAccountPosition' || type === 'balanceUpdate') { + } else if ( type === 'outboundAccountPosition' || type === 'balanceUpdate' ) { Binance.options.margin_balance_callback( data ); } else { Binance.options.log( 'Unexpected userMarginData: ' + type ); From adc0c29d6ca13064d09c942508bfff1bfe4b088a Mon Sep 17 00:00:00 2001 From: Aigars Sukurs Date: Mon, 12 Sep 2022 09:41:33 +0200 Subject: [PATCH 2/2] Handling userData execution_callback correctly. Fixes #834 --- node-binance-api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node-binance-api.js b/node-binance-api.js index ac085741..4b936adc 100644 --- a/node-binance-api.js +++ b/node-binance-api.js @@ -5347,7 +5347,7 @@ let api = function Binance( options = {} ) { } }, 60 * 30 * 1000 ); // 30 minute keepalive Binance.options.balance_callback = callback; - Binance.options.execution_callback = execution_callback ? callback : execution_callback;//This change is required to listen for Orders + Binance.options.execution_callback = execution_callback === false ? callback : execution_callback; Binance.options.list_status_callback = list_status_callback; const subscription = subscribe( Binance.options.listenKey, userDataHandler, reconnect ); if ( subscribed_callback ) subscribed_callback( subscription.endpoint );