mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-24 07:26:47 +00:00
build/ci: Update Go to v1.24, golangci-lint to v1.64.6 and fix issues (#1804)
* build/ci: Update Go to v1.24, golangci-lint to v1.64.5 and fix issues * Address shazbert's nitters * linter/config: Fix new linter issue and use versionSize const * Address gk's nitters and fix additional linter issue after rebase * Address glorious nits * staticcheck: Fix additional linter issues after upgrading to Go 1.24.1 and golangci-lint v1.64.6 Also addresses nits * Improve testing, assertify usage and use common.ErrParsingWSField * TestCreateNewStrategy: Replace must > should wording
This commit is contained in:
@@ -396,7 +396,7 @@ func (b *Binance) GetSpotKline(ctx context.Context, arg *KlinesRequestParams) ([
|
||||
params.Set("symbol", symbol)
|
||||
params.Set("interval", arg.Interval)
|
||||
if arg.Limit != 0 {
|
||||
params.Set("limit", strconv.Itoa(arg.Limit))
|
||||
params.Set("limit", strconv.FormatUint(arg.Limit, 10))
|
||||
}
|
||||
if !arg.StartTime.IsZero() {
|
||||
params.Set("startTime", timeString(arg.StartTime))
|
||||
|
||||
@@ -243,7 +243,7 @@ func (b *Binance) GetFundingRateInfo(ctx context.Context) ([]FundingRateInfoResp
|
||||
}
|
||||
|
||||
// GetFuturesKlineData gets futures kline data for CoinMarginedFutures,
|
||||
func (b *Binance) GetFuturesKlineData(ctx context.Context, symbol currency.Pair, interval string, limit int64, startTime, endTime time.Time) ([]FuturesCandleStick, error) {
|
||||
func (b *Binance) GetFuturesKlineData(ctx context.Context, symbol currency.Pair, interval string, limit uint64, startTime, endTime time.Time) ([]FuturesCandleStick, error) {
|
||||
params := url.Values{}
|
||||
if !symbol.IsEmpty() {
|
||||
symbolValue, err := b.FormatSymbol(symbol, asset.CoinMarginedFutures)
|
||||
@@ -253,7 +253,7 @@ func (b *Binance) GetFuturesKlineData(ctx context.Context, symbol currency.Pair,
|
||||
params.Set("symbol", symbolValue)
|
||||
}
|
||||
if limit > 0 {
|
||||
params.Set("limit", strconv.FormatInt(limit, 10))
|
||||
params.Set("limit", strconv.FormatUint(limit, 10))
|
||||
}
|
||||
if !slices.Contains(validFuturesIntervals, interval) {
|
||||
return nil, errors.New("invalid interval parsed")
|
||||
@@ -364,7 +364,7 @@ func (b *Binance) GetFuturesKlineData(ctx context.Context, symbol currency.Pair,
|
||||
}
|
||||
|
||||
// GetContinuousKlineData gets continuous kline data
|
||||
func (b *Binance) GetContinuousKlineData(ctx context.Context, pair, contractType, interval string, limit int64, startTime, endTime time.Time) ([]FuturesCandleStick, error) {
|
||||
func (b *Binance) GetContinuousKlineData(ctx context.Context, pair, contractType, interval string, limit uint64, startTime, endTime time.Time) ([]FuturesCandleStick, error) {
|
||||
params := url.Values{}
|
||||
params.Set("pair", pair)
|
||||
if !slices.Contains(validContractType, contractType) {
|
||||
@@ -372,7 +372,7 @@ func (b *Binance) GetContinuousKlineData(ctx context.Context, pair, contractType
|
||||
}
|
||||
params.Set("contractType", contractType)
|
||||
if limit > 0 {
|
||||
params.Set("limit", strconv.FormatInt(limit, 10))
|
||||
params.Set("limit", strconv.FormatUint(limit, 10))
|
||||
}
|
||||
if !slices.Contains(validFuturesIntervals, interval) {
|
||||
return nil, errors.New("invalid interval parsed")
|
||||
@@ -483,11 +483,11 @@ func (b *Binance) GetContinuousKlineData(ctx context.Context, pair, contractType
|
||||
}
|
||||
|
||||
// GetIndexPriceKlines gets continuous kline data
|
||||
func (b *Binance) GetIndexPriceKlines(ctx context.Context, pair, interval string, limit int64, startTime, endTime time.Time) ([]FuturesCandleStick, error) {
|
||||
func (b *Binance) GetIndexPriceKlines(ctx context.Context, pair, interval string, limit uint64, startTime, endTime time.Time) ([]FuturesCandleStick, error) {
|
||||
params := url.Values{}
|
||||
params.Set("pair", pair)
|
||||
if limit > 0 {
|
||||
params.Set("limit", strconv.FormatInt(limit, 10))
|
||||
params.Set("limit", strconv.FormatUint(limit, 10))
|
||||
}
|
||||
if !slices.Contains(validFuturesIntervals, interval) {
|
||||
return nil, errors.New("invalid interval parsed")
|
||||
@@ -598,7 +598,7 @@ func (b *Binance) GetIndexPriceKlines(ctx context.Context, pair, interval string
|
||||
}
|
||||
|
||||
// GetMarkPriceKline gets mark price kline data
|
||||
func (b *Binance) GetMarkPriceKline(ctx context.Context, symbol currency.Pair, interval string, limit int64, startTime, endTime time.Time) ([]FuturesCandleStick, error) {
|
||||
func (b *Binance) GetMarkPriceKline(ctx context.Context, symbol currency.Pair, interval string, limit uint64, startTime, endTime time.Time) ([]FuturesCandleStick, error) {
|
||||
symbolValue, err := b.FormatSymbol(symbol, asset.CoinMarginedFutures)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -606,7 +606,7 @@ func (b *Binance) GetMarkPriceKline(ctx context.Context, symbol currency.Pair, i
|
||||
params := url.Values{}
|
||||
params.Set("symbol", symbolValue)
|
||||
if limit > 0 {
|
||||
params.Set("limit", strconv.FormatInt(limit, 10))
|
||||
params.Set("limit", strconv.FormatUint(limit, 10))
|
||||
}
|
||||
if !slices.Contains(validFuturesIntervals, interval) {
|
||||
return nil, errors.New("invalid interval parsed")
|
||||
@@ -716,7 +716,7 @@ func (b *Binance) GetMarkPriceKline(ctx context.Context, symbol currency.Pair, i
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
func getKlineRateBudget(limit int64) request.EndpointLimit {
|
||||
func getKlineRateBudget(limit uint64) request.EndpointLimit {
|
||||
rateBudget := cFuturesDefaultRate
|
||||
switch {
|
||||
case limit > 0 && limit < 100:
|
||||
|
||||
@@ -530,7 +530,7 @@ var (
|
||||
type KlinesRequestParams struct {
|
||||
Symbol currency.Pair // Required field; example LTCBTC, BTCUSDT
|
||||
Interval string // Time interval period
|
||||
Limit int // Default 500; max 500.
|
||||
Limit uint64 // Default 500; max 500.
|
||||
StartTime time.Time
|
||||
EndTime time.Time
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ func (b *Binance) UCompressedTrades(ctx context.Context, symbol currency.Pair, f
|
||||
}
|
||||
|
||||
// UKlineData gets kline data for usdt margined futures
|
||||
func (b *Binance) UKlineData(ctx context.Context, symbol currency.Pair, interval string, limit int64, startTime, endTime time.Time) ([]FuturesCandleStick, error) {
|
||||
func (b *Binance) UKlineData(ctx context.Context, symbol currency.Pair, interval string, limit uint64, startTime, endTime time.Time) ([]FuturesCandleStick, error) {
|
||||
params := url.Values{}
|
||||
symbolValue, err := b.FormatSymbol(symbol, asset.USDTMarginedFutures)
|
||||
if err != nil {
|
||||
@@ -231,7 +231,7 @@ func (b *Binance) UKlineData(ctx context.Context, symbol currency.Pair, interval
|
||||
}
|
||||
params.Set("interval", interval)
|
||||
if limit > 0 {
|
||||
params.Set("limit", strconv.FormatInt(limit, 10))
|
||||
params.Set("limit", strconv.FormatUint(limit, 10))
|
||||
}
|
||||
if !startTime.IsZero() && !endTime.IsZero() {
|
||||
if startTime.After(endTime) {
|
||||
|
||||
@@ -1668,7 +1668,7 @@ func (b *Binance) GetHistoricCandles(ctx context.Context, pair currency.Pair, a
|
||||
Symbol: req.Pair,
|
||||
StartTime: req.Start,
|
||||
EndTime: req.End,
|
||||
Limit: int(req.RequestLimit),
|
||||
Limit: req.RequestLimit,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -1749,7 +1749,7 @@ func (b *Binance) GetHistoricCandlesExtended(ctx context.Context, pair currency.
|
||||
Symbol: req.Pair,
|
||||
StartTime: req.RangeHolder.Ranges[x].Start.Time,
|
||||
EndTime: req.RangeHolder.Ranges[x].End.Time,
|
||||
Limit: int(req.RequestLimit),
|
||||
Limit: req.RequestLimit,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -1769,7 +1769,7 @@ func (b *Binance) GetHistoricCandlesExtended(ctx context.Context, pair currency.
|
||||
candles, err = b.UKlineData(ctx,
|
||||
req.RequestFormatted,
|
||||
b.FormatExchangeKlineInterval(interval),
|
||||
int64(req.RangeHolder.Limit),
|
||||
req.RangeHolder.Limit,
|
||||
req.RangeHolder.Ranges[x].Start.Time,
|
||||
req.RangeHolder.Ranges[x].End.Time)
|
||||
if err != nil {
|
||||
@@ -1790,7 +1790,7 @@ func (b *Binance) GetHistoricCandlesExtended(ctx context.Context, pair currency.
|
||||
candles, err = b.GetFuturesKlineData(ctx,
|
||||
req.RequestFormatted,
|
||||
b.FormatExchangeKlineInterval(interval),
|
||||
int64(req.RangeHolder.Limit),
|
||||
req.RangeHolder.Limit,
|
||||
req.RangeHolder.Ranges[x].Start.Time,
|
||||
req.RangeHolder.Ranges[x].End.Time)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user