Skip to content

Commit

Permalink
fixup! GateIO: Split asset.Futures into CoinM and USDT
Browse files Browse the repository at this point in the history
  • Loading branch information
gbjk committed Jan 11, 2025
1 parent 6808333 commit 90395fd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions exchanges/gateio/gateio.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const (
gateioAPIVersion = "api/v4/"
tradeBaseURL = "https://www.gate.io/"
tradeSpot = "trade/"
tradeFutures = "futures/usdt/"
tradeDelivery = "futures-delivery/usdt/"

// SubAccount Endpoints
Expand Down Expand Up @@ -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)
}
Expand Down
6 changes: 4 additions & 2 deletions exchanges/gateio/gateio_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 90395fd

Please sign in to comment.