Skip to content

Commit

Permalink
Bitfinex: Rename channel consts
Browse files Browse the repository at this point in the history
  • Loading branch information
gbjk committed Jan 10, 2025
1 parent 3a52f3f commit 0b3fdd6
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions exchanges/bitfinex/bitfinex_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ const (
wsFundingOfferUpdateRequest = wsFundingOfferUpdate + wsRequest
wsFundingOfferCancelRequest = wsFundingOfferCancel + wsRequest
wsCancelMultipleOrders = "oc_multi"
wsBook = "book"
wsCandles = "candles"
wsTicker = "ticker"
wsTrades = "trades"
wsBookChannel = "book"
wsCandlesChannel = "candles"
wsTickerChannel = "ticker"
wsTradesChannel = "trades"
wsError = "error"
wsEventSubscribed = "subscribed"
wsEventUnsubscribed = "unsubscribed"
Expand Down Expand Up @@ -116,10 +116,10 @@ var checksumStore = make(map[int]*checksum)
var cMtx sync.Mutex

var subscriptionNames = map[string]string{
subscription.TickerChannel: wsTicker,
subscription.OrderbookChannel: wsBook,
subscription.CandlesChannel: wsCandles,
subscription.AllTradesChannel: wsTrades,
subscription.TickerChannel: wsTickerChannel,
subscription.OrderbookChannel: wsBookChannel,
subscription.CandlesChannel: wsCandlesChannel,
subscription.AllTradesChannel: wsTradesChannel,
}

// WsConnect starts a new websocket connection
Expand Down Expand Up @@ -1767,7 +1767,7 @@ func (b *Bitfinex) subscribeToChan(subs subscription.List) error {
}

// subId is a single round-trip identifier that provides linking sub requests to chanIDs
// Although docs only mention subId for wsBook, it works for all chans
// Although docs only mention subId for wsBookChannel, it works for all chans
subID := strconv.FormatInt(b.Websocket.Conn.GenerateMessageID(false), 10)
req["subId"] = subID

Expand Down Expand Up @@ -2237,7 +2237,7 @@ func subToMap(s *subscription.Subscription, a asset.Item, p currency.Pair) map[s
pairFmt.Delimiter = ":"
}
symbol := p.Format(pairFmt).String()
if c == wsCandles {
if c == wsCandlesChannel {
req["key"] = "trade:" + s.Interval.Short() + ":" + prefix + symbol + fundingPeriod
} else {
req["symbol"] = prefix + symbol
Expand Down

0 comments on commit 0b3fdd6

Please sign in to comment.