Skip to content

binance.mgAccount returns 404 error #688

@rostislavryzhkov

Description

@rostislavryzhkov

it seems that there is a bug for the method mgAccount. I tried to get my margin account balance and receive error 404 not found :

{"timestamp":1623791037710,"status":404,"error":"Not Found","message":"No message available","path":"/sapi//isolated"}
this is code I called this method :

function logAcount(error,out) {
    if (error) { 
        console.log(error.body)
    }
    console.log(out)

}

binance.mgAccount(logAcount,true)

It seems that your code returns wrong route for binance API call
I looked through your library and found bug, after I fixed it everything worked:
file: node-finance-api.js (4685)

 mgAccount: function( callback ,isIsolated = false) {
            const endpoint = 'v1/margin' + isIsolated ? '/isolated' : ''  + '/account'
            signedRequest( sapi + endpoint, {}, function( error, data ) {
                if( callback ) return callback( error, data );
            } );
        },

I checked and const endpoint instead of whole route returns only result for condition of isIsolated variable
so if isIsolated is true, the endpoint ='/isolated', but the correct value must be endpoint='v1/margin/isolated/account'
I don't know why it is happening, because the code seems correct, but anyway this issue and problem exist.

I changed code to :

const endpoint =  `v1/margin${isIsolated ? '/isolated' : '' }/account`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions