Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onTrades for funding trades does not call the handler #563

Open
1 of 4 tasks
dutu opened this issue Nov 20, 2020 · 0 comments
Open
1 of 4 tasks

onTrades for funding trades does not call the handler #563

dutu opened this issue Nov 20, 2020 · 0 comments

Comments

@dutu
Copy link
Contributor

dutu commented Nov 20, 2020

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'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant