diff --git a/.codespellrc b/.codespellrc index c7118d07..bafcaf3c 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,4 +1,5 @@ [codespell] -skip = ./.git,./web,./currency/code_types.go,*.json,*.sum,*.html +skip = ./.git,./web,./currency/code_types.go,*.json,*.sum,*.html,./vendor exclude-file = ./contrib/spellcheck/exclude_lines.txt -ignore-words = ./contrib/spellcheck/ignore_words.txt \ No newline at end of file +ignore-words = ./contrib/spellcheck/ignore_words.txt +ignore-regex = currency\.\w+ diff --git a/.github/workflows/spell-checker.yml b/.github/workflows/spell-checker.yml index ac3b2024..6f3fa8af 100644 --- a/.github/workflows/spell-checker.yml +++ b/.github/workflows/spell-checker.yml @@ -7,7 +7,3 @@ jobs: steps: - uses: actions/checkout@v4 - uses: codespell-project/actions-codespell@master - with: - exclude_file: contrib/spellcheck/exclude_lines.txt - skip: ./.git,./web,./currency/code_types.go,*.json,*.sum,*.html - ignore_words_file: contrib/spellcheck/ignore_words.txt diff --git a/backtester/engine/grpcserver.go b/backtester/engine/grpcserver.go index 279358e2..17a50794 100644 --- a/backtester/engine/grpcserver.go +++ b/backtester/engine/grpcserver.go @@ -211,36 +211,32 @@ func (s *GRPCServer) ExecuteStrategyFromFile(_ context.Context, request *btrpc.E return nil, err } - io64 := int64(request.IntervalOverride) - if io64 > 0 { + if io64 := int64(request.IntervalOverride); io64 > 0 { if io64 < gctkline.FifteenSecond.Duration().Nanoseconds() { return nil, fmt.Errorf("%w, interval must be >= 15 seconds, received '%v'", gctkline.ErrInvalidInterval, time.Duration(request.IntervalOverride)) } cfg.DataSettings.Interval = gctkline.Interval(request.IntervalOverride) } - sto := request.StartTimeOverride.AsTime() - if sto.Unix() != 0 && !sto.IsZero() { + + if startTime := request.StartTimeOverride.AsTime(); startTime.Unix() != 0 && !startTime.IsZero() { if cfg.DataSettings.DatabaseData != nil { - cfg.DataSettings.DatabaseData.StartDate = request.StartTimeOverride.AsTime() + cfg.DataSettings.DatabaseData.StartDate = startTime } else if cfg.DataSettings.APIData != nil { - cfg.DataSettings.APIData.StartDate = request.StartTimeOverride.AsTime() + cfg.DataSettings.APIData.StartDate = startTime } } - eto := request.EndTimeOverride.AsTime() - if eto.Unix() != 0 && !eto.IsZero() { + if endTime := request.EndTimeOverride.AsTime(); endTime.Unix() != 0 && !endTime.IsZero() { if cfg.DataSettings.DatabaseData != nil { - cfg.DataSettings.DatabaseData.EndDate = request.EndTimeOverride.AsTime() + cfg.DataSettings.DatabaseData.EndDate = endTime } else if cfg.DataSettings.APIData != nil { - cfg.DataSettings.APIData.EndDate = request.EndTimeOverride.AsTime() + cfg.DataSettings.APIData.EndDate = endTime } } - err = cfg.Validate() - if err != nil { + if err := cfg.Validate(); err != nil { return nil, err } if cfg == nil { - err = fmt.Errorf("%w backtester config", gctcommon.ErrNilPointer) - return nil, err + return nil, fmt.Errorf("%w backtester config", gctcommon.ErrNilPointer) } if !s.config.Report.GenerateReport { diff --git a/contrib/spellcheck/exclude_lines.txt b/contrib/spellcheck/exclude_lines.txt index 4c7bbba8..f55c7616 100644 --- a/contrib/spellcheck/exclude_lines.txt +++ b/contrib/spellcheck/exclude_lines.txt @@ -4,16 +4,6 @@ tt, errOt := order.StringToOrderType(genOrderDetail.Type) if errOt != nil { return order.Detail{}, fmt.Errorf("error parsing order type: %s", errOt) - currency.CANN: 0.2, - currency.DOTA: 0.01, - currency.SCRPT: 0.01, - currency.NOO: 0.002, - currency.BU: 0.1, - currency.HAV: 10, - currency.GARD: 100, - currency.DASHS: 0.01, - currency.ALIS: 0.05, - currency.MIS: 0.002, const pressXToJSON = `[0,"bu",[4131.85,4131.85]]` wsTradeExecuted = "te" wsBalanceUpdate = "bu" @@ -22,4 +12,4 @@ SHFT = NewCode("SHFT") currency.SHFT: 84, TotalIn float64 `json:"totalIn"` - TotalIn int64 `json:"totalIn"` \ No newline at end of file + TotalIn int64 `json:"totalIn"` diff --git a/contrib/spellcheck/ignore_words.txt b/contrib/spellcheck/ignore_words.txt index 918efc35..3fb32207 100644 --- a/contrib/spellcheck/ignore_words.txt +++ b/contrib/spellcheck/ignore_words.txt @@ -2,7 +2,6 @@ strat datas prevend flate -freez zar insid totalin diff --git a/exchanges/gateio/gateio_types.go b/exchanges/gateio/gateio_types.go index 3e2d7520..36b8a6a0 100644 --- a/exchanges/gateio/gateio_types.go +++ b/exchanges/gateio/gateio_types.go @@ -1301,7 +1301,7 @@ type CrossMarginBalance struct { BorrowedNet string `json:"borrowed_net"` TotalNetAssetInUSDT string `json:"net"` PositionLeverage string `json:"leverage"` - Risk string `json:"risk"` // Risk rate. When it belows 110%, liquidation will be triggered. Calculation formula: total / (borrowed+interest) + Risk string `json:"risk"` // Risk percentage; Liquidation is triggered when this falls below required margin. Calculation: total / (borrowed+interest) } // WalletSavedAddress represents currency saved address diff --git a/exchanges/request/request.go b/exchanges/request/request.go index 8bc1690c..2d9ce82f 100644 --- a/exchanges/request/request.go +++ b/exchanges/request/request.go @@ -204,7 +204,7 @@ func (r *Requester) doRequest(ctx context.Context, endpoint EndpointLimit, newRe return checkErr } else if retry { if err == nil { - // If the body isn't fully read, the connection cannot be re-used + // If the body isn't fully read, the connection cannot be reused r.drainBody(resp.Body) }