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 767 forks source link

How to receive Delivery (dapi) user data events? #538

Closed waterdrop01 closed 3 years ago

waterdrop01 commented 3 years ago

Hello @nurdtechie98 @jaggedsoft,

Could you please share how to subscribe to delivery (dapi) user data events?

I currently have this code:

const onMarginCall = (res) => {
    debug('onMarginCall %o', res);
  };

  const onAccountUpdate = (res) => {
    debug('onAccountUpdate %o', res);
  };
  const onOrderUpdate = (res) => {
    debug('onOrderUpdate', res);
  };
  const onSubscribed = (res) => {
    debug('onSubscribed', res);
  };

  client.websockets.userFutureData(
    onMarginCall,
    onAccountUpdate,
    onOrderUpdate,
    onSubscribed,
  );

But when I move BTC from spot wallet to Futures "COIN-m" wallet, no event is received. Only transferring to USDT-m wallet will call "onAccountUpdate" function.

Is there an option to specify I want to subscribe to "COIN-m" or "delivery" futures websocket endpoint?

Thanks in advance for your help!

NOTE: Also, I was wondering if the delivery API works for perpetual swaps as well? (ex: BTCUSD_perpetual : https://www.binance.com/en/delivery/btcusd_perpetual)

waterdrop01 commented 3 years ago

fixed by https://github.com/jaggedsoft/node-binance-api/pull/541