node-binance-api icon indicating copy to clipboard operation
node-binance-api copied to clipboard

orderStatus contains bug when building parameters.

Open csskevin opened this issue 3 years ago • 3 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

When fetching the orderStatus, the API responds always with: Param 'origClientOrderId' or 'orderId' must be sent, but both were empty/null! After digging in the source code, I have figured out, that you have a bug when creating the parameters. Here is the diff that solved my problem:

diff --git a/node_modules/node-binance-api/node-binance-api.js b/node_modules/node-binance-api/node-binance-api.js
index 6da6165..9b877a0 100644
--- a/node_modules/node-binance-api/node-binance-api.js
+++ b/node_modules/node-binance-api/node-binance-api.js
@@ -3025,7 +3025,7 @@ let api = function Binance( options = {} ) {
         orderStatus: function ( symbol, orderid, callback, flags = {} ) {
             let parameters = Object.assign( { symbol: symbol }, flags );
             if (orderid){
-                Object.assign( { orderId: orderid }, parameters )
+               parameters = Object.assign( { orderId: orderid }, parameters )
             }
 
             if ( !callback ) {

This issue body was partially generated by patch-package.

You forgot the save the return value in parameters, therefore the order id is never appended in the query.

csskevin avatar Jan 11 '22 23:01 csskevin

Tested this change on my local - works great! 🙏🏽

olafkotur avatar Jan 23 '22 15:01 olafkotur

This worked for me, thanks :) Any ideas on when the fix will be applied in the official repository?

johanhez avatar Mar 01 '22 18:03 johanhez

I found the same problem and the same solution. When it will be applied to the repo?

luiztools avatar Jun 01 '22 02:06 luiztools