jaggedsoft / node-binance-api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.
MIT License
1.58k stars 768 forks source link

websockets.userData not working any more ! #464

Open elaarabi opened 4 years ago

elaarabi commented 4 years ago

Hello, The userData function callbacks are no longer working in my code !

Here is the code i am using :

binance.websockets.userData(function (data) { console.log("balance_update"); self.balance_update(data); }, function (data) { console.log("execution_update"); self.execution_update(data); });

PS: this was working before just fine !

Haslick commented 3 years ago

hey, did you solve it out? i'm having the same problem

Haslick commented 3 years ago

it seems like the function "binance.websockets.userData" doesn't work any more. I solved it this way:

const signature = crypto.createHmac('sha256', ${process.env.BINANCE_SECRETKEY}).update('').digest('hex'); const streamingKey = await axios.post('https://testnet.binancefuture.com/fapi/v1/listenKey', signature=${signature}, {headers: {'X-MBX-APIKEY': ${process.env.BINANCE_APIKEY},'content-type': 'application/x-www-form-urlencoded'}});

binance.futuresSubscribe( streamingKey.data.listenKey, console.log ); //function of "jaggedsoft / node-binance-api"

becareful with de base url, en this code i used de tesnet base

mr-smit commented 3 years ago

you just use it wrong, its working in 0.13.0


    function order_update(data) {
        console.log(data)
    }
    binance.websockets.userData(order_update, true);