Skip to content

onTrades for funding trades does not call the handler  #563

@dutu

Description

@dutu

Issue type

  • bug
  • missing functionality
  • performance
  • feature request

Brief description

The handlers registered for public funding trades with onTrades are not called when fte/ftu messages are received.

This is because the fte/ftu messages are not properly handled and the messages don't propagate to listener registered with onTrades method.

Steps to reproduce

const ws = new WSv2()

ws.on('open', async () => {
  ws.onTrades({ symbol: 'fUSD' }, (trades) => {
    console.log('recv trades: %j', trades)
 })

  ws.subscribeTrades('fUSD')
})

await ws.open()
Additional Notes:

Possible bug fix:

Change

const eventName = msg[1][0] === 'f'
? msg[1] // Funding trades are passed to fte/ftu handlers
: msg[1] === 'te'
? 'trade-entry'
: 'trades'

with

    const eventName = msg[1] === 'te' || msg[1] === 'fte'
        ? 'trade-entry'
        : 'trades'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions