Skip to content

Commit

Permalink
fixup! GateIO: Abstract WSConnect for all assets
Browse files Browse the repository at this point in the history
  • Loading branch information
gbjk committed Jan 30, 2025
1 parent 37ab2be commit f9b84ab
Showing 1 changed file with 0 additions and 31 deletions.
31 changes: 0 additions & 31 deletions exchanges/gateio/gateio_websocket_futures.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,10 @@ import (
"encoding/json"
"errors"
"fmt"
"net/http"
"strconv"
"strings"
"time"

"github.com/gorilla/websocket"
"github.com/thrasher-corp/gocryptotrader/common"
"github.com/thrasher-corp/gocryptotrader/currency"
"github.com/thrasher-corp/gocryptotrader/exchanges/account"
Expand All @@ -25,35 +23,6 @@ import (
"github.com/thrasher-corp/gocryptotrader/exchanges/trade"
)

// WsFuturesConnect initiates a websocket connection for futures account
func (g *Gateio) WsFuturesConnect(ctx context.Context, conn stream.Connection) error {
a := asset.USDTMarginedFutures
if conn.GetURL() == btcFuturesWebsocketURL {
a = asset.CoinMarginedFutures
}
if err := g.CurrencyPairs.IsAssetEnabled(a); err != nil {
return err
}
if err := conn.DialContext(ctx, &websocket.Dialer{}, http.Header{}); err != nil {
return err
}
pingMessage, err := json.Marshal(WsInput{
ID: conn.GenerateMessageID(false),
Time: time.Now().Unix(), // TODO: Func for dynamic time as this will be the same time for every ping message.
Channel: futuresPingChannel,
})
if err != nil {
return err
}
conn.SetupPingHandler(websocketRateLimitNotNeededEPL, stream.PingHandler{
Websocket: true,
MessageType: websocket.PingMessage,
Delay: time.Second * 15,
Message: pingMessage,
})
return nil
}

// GenerateFuturesDefaultSubscriptions returns default subscriptions information.
func (g *Gateio) GenerateFuturesDefaultSubscriptions(a asset.Item) (subscription.List, error) {
channelsToSubscribe := defaultFuturesSubscriptions
Expand Down

0 comments on commit f9b84ab

Please sign in to comment.