mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-31 07:26:44 +00:00
golangci-lint/CI: Bump versions and introduce new linters (#798)
* golangci-lint/CI: Bump versions
Fix remaining linter issues
* Specifically set AppVeyor version
* Fix the infamous typos 👀
* Add go env cmd to AppVeyor
* Add go version cmd to AppVeyor
* Specify AppVeyor image, adjust linters
* Update go get to go install due to deprecation
* Bump golangci-lint timeout time for AppVeyor
* Change NW contract to NQ
* Address nitters
* GetRandomPair -> Pair{}
* Address nits
* Address time nitterinos plus additional tweaks
* More time inception upgrades!
* Bending time and space
This commit is contained in:
@@ -291,8 +291,7 @@ func (b *Bithumb) UpdateTickers(ctx context.Context, a asset.Item) error {
|
||||
|
||||
// UpdateTicker updates and returns the ticker for a currency pair
|
||||
func (b *Bithumb) UpdateTicker(ctx context.Context, p currency.Pair, a asset.Item) (*ticker.Price, error) {
|
||||
err := b.UpdateTickers(ctx, a)
|
||||
if err != nil {
|
||||
if err := b.UpdateTickers(ctx, a); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ticker.GetTicker(b.Name, p, a)
|
||||
@@ -818,60 +817,33 @@ func (b *Bithumb) GetHistoricCandles(ctx context.Context, pair currency.Pair, a
|
||||
}
|
||||
|
||||
for x := range candle.Data {
|
||||
if len(candle.Data[x]) < 6 {
|
||||
return kline.Item{}, errors.New("invalid candle length")
|
||||
}
|
||||
var tempCandle kline.Candle
|
||||
|
||||
tempTime := candle.Data[x][0].(float64)
|
||||
timestamp := time.Unix(0, int64(tempTime)*int64(time.Millisecond))
|
||||
if timestamp.Before(start) {
|
||||
if tempCandle.Time, err = convert.TimeFromUnixTimestampFloat(candle.Data[x][0]); err != nil {
|
||||
return kline.Item{}, fmt.Errorf("unable to convert timestamp: %w", err)
|
||||
}
|
||||
if tempCandle.Time.Before(start) {
|
||||
continue
|
||||
}
|
||||
if timestamp.After(end) {
|
||||
if tempCandle.Time.After(end) {
|
||||
break
|
||||
}
|
||||
tempCandle.Time = timestamp
|
||||
|
||||
open, ok := candle.Data[x][1].(string)
|
||||
if !ok {
|
||||
return kline.Item{}, errors.New("open conversion failed")
|
||||
if tempCandle.Open, err = convert.FloatFromString(candle.Data[x][1]); err != nil {
|
||||
return kline.Item{}, fmt.Errorf("kline open conversion failed: %w", err)
|
||||
}
|
||||
tempCandle.Open, err = strconv.ParseFloat(open, 64)
|
||||
if err != nil {
|
||||
return kline.Item{}, err
|
||||
if tempCandle.High, err = convert.FloatFromString(candle.Data[x][2]); err != nil {
|
||||
return kline.Item{}, fmt.Errorf("kline high conversion failed: %w", err)
|
||||
}
|
||||
high, ok := candle.Data[x][2].(string)
|
||||
if !ok {
|
||||
return kline.Item{}, errors.New("high conversion failed")
|
||||
if tempCandle.Low, err = convert.FloatFromString(candle.Data[x][3]); err != nil {
|
||||
return kline.Item{}, fmt.Errorf("kline low conversion failed: %w", err)
|
||||
}
|
||||
tempCandle.High, err = strconv.ParseFloat(high, 64)
|
||||
if err != nil {
|
||||
return kline.Item{}, err
|
||||
if tempCandle.Close, err = convert.FloatFromString(candle.Data[x][4]); err != nil {
|
||||
return kline.Item{}, fmt.Errorf("kline close conversion failed: %w", err)
|
||||
}
|
||||
|
||||
low, ok := candle.Data[x][3].(string)
|
||||
if !ok {
|
||||
return kline.Item{}, errors.New("low conversion failed")
|
||||
}
|
||||
tempCandle.Low, err = strconv.ParseFloat(low, 64)
|
||||
if err != nil {
|
||||
return kline.Item{}, err
|
||||
}
|
||||
|
||||
closeTemp, ok := candle.Data[x][4].(string)
|
||||
if !ok {
|
||||
return kline.Item{}, errors.New("close conversion failed")
|
||||
}
|
||||
tempCandle.Close, err = strconv.ParseFloat(closeTemp, 64)
|
||||
if err != nil {
|
||||
return kline.Item{}, err
|
||||
}
|
||||
|
||||
vol, ok := candle.Data[x][5].(string)
|
||||
if !ok {
|
||||
return kline.Item{}, errors.New("vol conversion failed")
|
||||
}
|
||||
tempCandle.Volume, err = strconv.ParseFloat(vol, 64)
|
||||
if err != nil {
|
||||
return kline.Item{}, err
|
||||
if tempCandle.Volume, err = convert.FloatFromString(candle.Data[x][5]); err != nil {
|
||||
return kline.Item{}, fmt.Errorf("kline volume conversion failed: %w", err)
|
||||
}
|
||||
ret.Candles = append(ret.Candles, tempCandle)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user