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

websockets.userData not working any more !

Open elaarabi opened this issue 4 years ago • 3 comments

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 !

elaarabi avatar Jul 23 '20 01:07 elaarabi

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

Haslick avatar Nov 04 '21 05:11 Haslick

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

Haslick avatar Nov 05 '21 04:11 Haslick

you just use it wrong, its working in 0.13.0


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

mr-smit avatar Nov 06 '21 23:11 mr-smit