From 90395fd7b335c2c5977105e6173fd2fb4a3fb81e Mon Sep 17 00:00:00 2001 From: Gareth Kirwan Date: Sat, 11 Jan 2025 15:34:17 +0700 Subject: [PATCH] fixup! GateIO: Split asset.Futures into CoinM and USDT --- exchanges/gateio/gateio.go | 7 ++++--- exchanges/gateio/gateio_wrapper.go | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/exchanges/gateio/gateio.go b/exchanges/gateio/gateio.go index a0658d44ac7..6b3c080440b 100644 --- a/exchanges/gateio/gateio.go +++ b/exchanges/gateio/gateio.go @@ -30,7 +30,6 @@ const ( gateioAPIVersion = "api/v4/" tradeBaseURL = "https://www.gate.io/" tradeSpot = "trade/" - tradeFutures = "futures/usdt/" tradeDelivery = "futures-delivery/usdt/" // SubAccount Endpoints @@ -1195,8 +1194,10 @@ func (g *Gateio) SubAccountTransfer(ctx context.Context, arg SubAccountTransferP if arg.Amount <= 0 { return errInvalidAmount } - if arg.SubAccountType != "" && arg.SubAccountType != asset.Spot.String() && arg.SubAccountType != asset.Futures.String() && arg.SubAccountType != asset.CrossMargin.String() { - return fmt.Errorf("%v; only %v,%v, and %v are allowed", asset.ErrNotSupported, asset.Spot, asset.Futures, asset.CrossMargin) + switch arg.SubAccountType { + case "", "spot", "futures", "delivery": + default: + return fmt.Errorf("%v; only spot, futures and delivery are allowed", asset.ErrNotSupported) } return g.SendAuthenticatedHTTPRequest(ctx, exchange.RestSpot, walletSubAccountTransferEPL, http.MethodPost, walletSubAccountTransfer, nil, &arg, nil) } diff --git a/exchanges/gateio/gateio_wrapper.go b/exchanges/gateio/gateio_wrapper.go index 6b2e43ccf4f..9aec984023d 100644 --- a/exchanges/gateio/gateio_wrapper.go +++ b/exchanges/gateio/gateio_wrapper.go @@ -2339,8 +2339,10 @@ func (g *Gateio) GetCurrencyTradeURL(_ context.Context, a asset.Item, cp currenc switch a { case asset.Spot, asset.CrossMargin, asset.Margin: return tradeBaseURL + tradeSpot + cp.Upper().String(), nil - case asset.Futures: - return tradeBaseURL + tradeFutures + cp.Upper().String(), nil + case asset.CoinMarginedFutures: + return tradeBaseURL + futuresPath + "btc/" + cp.Upper().String(), nil + case asset.USDTMarginedFutures: + return tradeBaseURL + futuresPath + "usdt/" + cp.Upper().String(), nil case asset.DeliveryFutures: return tradeBaseURL + tradeDelivery + cp.Upper().String(), nil default: