From 3a52f3fd126d03529edf87d16dcdaa9620cb1093 Mon Sep 17 00:00:00 2001 From: Gareth Kirwan Date: Fri, 10 Jan 2025 15:25:25 +0700 Subject: [PATCH] Bitfinex: Move websocket constants to websocket file --- exchanges/bitfinex/bitfinex_types.go | 57 ------------------------ exchanges/bitfinex/bitfinex_websocket.go | 57 ++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/exchanges/bitfinex/bitfinex_types.go b/exchanges/bitfinex/bitfinex_types.go index 085e01960ad..ef013496305 100644 --- a/exchanges/bitfinex/bitfinex_types.go +++ b/exchanges/bitfinex/bitfinex_types.go @@ -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"` diff --git a/exchanges/bitfinex/bitfinex_websocket.go b/exchanges/bitfinex/bitfinex_websocket.go index e7d0978a479..294b598fcde 100644 --- a/exchanges/bitfinex/bitfinex_websocket.go +++ b/exchanges/bitfinex/bitfinex_websocket.go @@ -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},