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 20, 2025
1 parent d007930 commit d5ea500
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
5 changes: 1 addition & 4 deletions currency/pair.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ func NewPairWithDelimiter(base, quote, delimiter string) Pair {
// with or without delimiter
func NewPairFromString(currencyPair string) (Pair, error) {
if len(currencyPair) < 3 {
return EMPTYPAIR,
fmt.Errorf("%w from %s string too short to be a currency pair",
errCannotCreatePair,
currencyPair)
return EMPTYPAIR, fmt.Errorf("%w from %s string too short to be a currency pair", errCannotCreatePair, currencyPair)
}

for x := range currencyPair {
Expand Down
12 changes: 7 additions & 5 deletions exchanges/gateio/gateio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -890,16 +890,18 @@ func TestGetFuturesOrderbook(t *testing.T) {

func TestGetFuturesTradingHistory(t *testing.T) {
t.Parallel()
_, err := g.GetFuturesTradingHistory(context.Background(), currency.BTC, getPair(t, asset.CoinMarginedFutures), 0, 0, "", time.Time{}, time.Time{})
assert.NoError(t, err, "GetFuturesTradingHistory should not error for CoinMarginedFutures")
_, err = g.GetFuturesTradingHistory(context.Background(), currency.USDT, getPair(t, asset.USDTMarginedFutures), 0, 0, "", time.Time{}, time.Time{})
assert.NoError(t, err, "GetFuturesTradingHistory should not error")
assert.NoError(t, err, "GetFuturesTradingHistory should not error for USDTMarginedFutures")
}

func TestGetFuturesCandlesticks(t *testing.T) {
t.Parallel()
settle, err := getSettlementFromCurrency(getPair(t, asset.Futures))
require.NoError(t, err, "getSettlementFromCurrency must not error")
_, err = g.GetFuturesCandlesticks(context.Background(), settle, getPair(t, asset.Futures).String(), time.Time{}, time.Time{}, 0, kline.OneWeek)
assert.NoError(t, err, "GetFuturesCandlesticks should not error")
_, err := g.GetFuturesCandlesticks(context.Background(), currency.BTC, getPair(t, asset.CoinMarginedFutures).String(), time.Time{}, time.Time{}, 0, kline.OneWeek)
assert.NoError(t, err, "GetFuturesCandlesticks should not error for CoinMarginedFutures")
_, err = g.GetFuturesCandlesticks(context.Background(), currency.USDT, getPair(t, asset.USDTMarginedFutures).String(), time.Time{}, time.Time{}, 0, kline.OneWeek)
assert.NoError(t, err, "GetFuturesCandlesticks should not error for USDTMarginedFutures")
}

func TestPremiumIndexKLine(t *testing.T) {
Expand Down

0 comments on commit d5ea500

Please sign in to comment.