bitfinexcom / bitfinex-api-node

BITFINEX NodeJS trading API - Bitcoin, Litecoin, and Ether exchange

Home Page:https://www.bitfinex.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Breaking change in trades subscription

wierzbix83 opened this issue · comments

Issue type

  • bug
  • missing functionality
  • performance
  • feature request

Brief description

Since 4.0.2 subscribing to trades with symbol tBTCUSD no longer works, instead I need to use BTCUSD which is inconsistent with for example candles trades trade:1m:tBTCUSD.
Are you planning to fix it more make more changes in symbols?

v3.0.2...4.0.2

Steps to reproduce

Execute following with 3.0.2 version and then upgrade to later versions and see that there is a change in symbols for trades

'use strict'

process.env.DEBUG = 'bfx:examples:*'

const debug = require('debug')('bfx:examples:ws2-manager')

const Manager = require('bitfinex-api-node/lib/ws2_manager')

const m = new Manager({
    //autoReconnect: true,
    seqAudit: true,
    //packetWDDelay: 10 * 1000,
    transform: true,
    //manageCandles: false
  })

debug('fetching symbol details...')

  const symbols = ['tBTCUSD', 'fUSD', 'BTCUSD']

  m.on('error', (err) => {
    debug('error: %s', err)
  })

  m.once('open', () => {
    debug('open')

    symbols.forEach(symbol => {
      m.subscribeTrades(symbol)
      m.onTrades({ symbol }, (trades) => {
        debug('recv %d trades on channel %s, content %s', trades.length, symbol, JSON.stringify(trades))
      })
    })

  })

  m.openSocket()
Additional Notes:

Fixed by #524