diff --git a/pkg/strategy/autoborrow/alert_interest_rate.go b/pkg/strategy/autoborrow/alert_interest_rate.go index 331396542..cf4a1059b 100644 --- a/pkg/strategy/autoborrow/alert_interest_rate.go +++ b/pkg/strategy/autoborrow/alert_interest_rate.go @@ -128,11 +128,16 @@ func (w *MarginHighInterestRateWorker) findMarginHighInterestRateAssets( ) (highRates types.MarginNextHourlyInterestRateMap, err error) { highRates = make(types.MarginNextHourlyInterestRateMap) for asset, rate := range rateMap { - _, ok := debts[asset] + bal, ok := debts[asset] if !ok { continue } + debt := bal.Debt() + if debt.IsZero() { + continue + } + if rate.AnnualizedRate.IsZero() { log.Warnf("annualized rate is zero for %s", asset) } @@ -202,10 +207,10 @@ func (w *MarginHighInterestRateWorker) Run(ctx context.Context) { } rate := rateMap[cur] + debtValue := bal.Debt().Mul(price) nextTotalInterestValue = nextTotalInterestValue.Add( - bal.Debt().Mul(rate.HourlyRate).Mul(price)) + debtValue.Mul(rate.HourlyRate)) - debtValue := bal.Debt().Mul(price) if w.config.MinDebtAmount.Sign() > 0 && debtValue.Compare(w.config.MinDebtAmount) > 0 { exceededDebtAmount = true