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

How to handle ws.user stream data

Open bizjaya opened this issue 3 years ago • 0 comments

Currently the following code

   const clean = await _client.ws.user(async (msg) => {
    console.log(msg);
  });

gives two sets of json which is invalid and cannot be parsed. I just need the first Object with eventType: 'executionReport'

{
  eventType: 'executionReport',
  eventTime: 1646079392293,
  symbol: 'XRPUSDT'
  ....
}
{
  balances: [ .... ],
  eventTime: 1646079392293,
  eventType: 'outboundAccountPosition',
  lastAccountUpdate: 1646079392293
}

bizjaya avatar Feb 28 '22 20:02 bizjaya