Skip to content

Commit

Permalink
Bitfinex: Move websocket constants to websocket file
Browse files Browse the repository at this point in the history
  • Loading branch information
gbjk committed Jan 10, 2025
1 parent f86fff4 commit 3a52f3f
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 57 deletions.
57 changes: 0 additions & 57 deletions exchanges/bitfinex/bitfinex_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -616,63 +616,6 @@ type WebsocketHandshake struct {
Version float64 `json:"version"`
}

const (
authenticatedBitfinexWebsocketEndpoint = "wss://api.bitfinex.com/ws/2"
publicBitfinexWebsocketEndpoint = "wss://api-pub.bitfinex.com/ws/2"
pong = "pong"
wsHeartbeat = "hb"
wsChecksum = "cs"
wsPositionSnapshot = "ps"
wsPositionNew = "pn"
wsPositionUpdate = "pu"
wsPositionClose = "pc"
wsWalletSnapshot = "ws"
wsWalletUpdate = "wu"
wsTradeUpdated = "tu"
wsTradeExecuted = "te"
wsFundingCreditSnapshot = "fcs"
wsFundingCreditNew = "fcn"
wsFundingCreditUpdate = "fcu"
wsFundingCreditCancel = "fcc"
wsFundingLoanSnapshot = "fls"
wsFundingLoanNew = "fln"
wsFundingLoanUpdate = "flu"
wsFundingLoanCancel = "flc"
wsFundingTradeExecuted = "fte"
wsFundingTradeUpdated = "ftu"
wsFundingInfoUpdate = "fiu"
wsBalanceUpdate = "bu"
wsMarginInfoUpdate = "miu"
wsNotification = "n"
wsOrderSnapshot = "os"
wsOrderNew = "on"
wsOrderUpdate = "ou"
wsOrderCancel = "oc"
wsRequest = "-req"
wsOrderNewRequest = wsOrderNew + wsRequest
wsOrderUpdateRequest = wsOrderUpdate + wsRequest
wsOrderCancelRequest = wsOrderCancel + wsRequest
wsFundingOfferSnapshot = "fos"
wsFundingOfferNew = "fon"
wsFundingOfferUpdate = "fou"
wsFundingOfferCancel = "foc"
wsFundingOfferNewRequest = wsFundingOfferNew + wsRequest
wsFundingOfferUpdateRequest = wsFundingOfferUpdate + wsRequest
wsFundingOfferCancelRequest = wsFundingOfferCancel + wsRequest
wsCancelMultipleOrders = "oc_multi"
wsBook = "book"
wsCandles = "candles"
wsTicker = "ticker"
wsTrades = "trades"
wsError = "error"
wsEventSubscribed = "subscribed"
wsEventUnsubscribed = "unsubscribed"
wsEventAuth = "auth"
wsEventError = "error"
wsEventConf = "conf"
wsEventInfo = "info"
)

// WsAuthRequest container for WS auth request
type WsAuthRequest struct {
Event string `json:"event"`
Expand Down
57 changes: 57 additions & 0 deletions exchanges/bitfinex/bitfinex_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,63 @@ var (
errParsingWSField = errors.New("error parsing WS field")
)

const (
authenticatedBitfinexWebsocketEndpoint = "wss://api.bitfinex.com/ws/2"
publicBitfinexWebsocketEndpoint = "wss://api-pub.bitfinex.com/ws/2"
pong = "pong"
wsHeartbeat = "hb"
wsChecksum = "cs"
wsPositionSnapshot = "ps"
wsPositionNew = "pn"
wsPositionUpdate = "pu"
wsPositionClose = "pc"
wsWalletSnapshot = "ws"
wsWalletUpdate = "wu"
wsTradeUpdated = "tu"
wsTradeExecuted = "te"
wsFundingCreditSnapshot = "fcs"
wsFundingCreditNew = "fcn"
wsFundingCreditUpdate = "fcu"
wsFundingCreditCancel = "fcc"
wsFundingLoanSnapshot = "fls"
wsFundingLoanNew = "fln"
wsFundingLoanUpdate = "flu"
wsFundingLoanCancel = "flc"
wsFundingTradeExecuted = "fte"
wsFundingTradeUpdated = "ftu"
wsFundingInfoUpdate = "fiu"
wsBalanceUpdate = "bu"
wsMarginInfoUpdate = "miu"
wsNotification = "n"
wsOrderSnapshot = "os"
wsOrderNew = "on"
wsOrderUpdate = "ou"
wsOrderCancel = "oc"
wsRequest = "-req"
wsOrderNewRequest = wsOrderNew + wsRequest
wsOrderUpdateRequest = wsOrderUpdate + wsRequest
wsOrderCancelRequest = wsOrderCancel + wsRequest
wsFundingOfferSnapshot = "fos"
wsFundingOfferNew = "fon"
wsFundingOfferUpdate = "fou"
wsFundingOfferCancel = "foc"
wsFundingOfferNewRequest = wsFundingOfferNew + wsRequest
wsFundingOfferUpdateRequest = wsFundingOfferUpdate + wsRequest
wsFundingOfferCancelRequest = wsFundingOfferCancel + wsRequest
wsCancelMultipleOrders = "oc_multi"
wsBook = "book"
wsCandles = "candles"
wsTicker = "ticker"
wsTrades = "trades"
wsError = "error"
wsEventSubscribed = "subscribed"
wsEventUnsubscribed = "unsubscribed"
wsEventAuth = "auth"
wsEventError = "error"
wsEventConf = "conf"
wsEventInfo = "info"
)

var defaultSubscriptions = subscription.List{
{Enabled: true, Channel: subscription.TickerChannel, Asset: asset.All},
{Enabled: true, Channel: subscription.AllTradesChannel, Asset: asset.All},
Expand Down

0 comments on commit 3a52f3f

Please sign in to comment.