Skip to content

Commit a31a72b

Browse files
committed
autoborrow: check rate
1 parent 6998827 commit a31a72b

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

pkg/strategy/autoborrow/alert_interest_rate.go

+9-8
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,15 @@ func (w *MarginHighInterestRateWorker) Run(ctx context.Context) {
235235
continue
236236
}
237237

238-
rate := rateMap[cur]
239-
debtValue := bal.Debt().Mul(price)
240-
nextTotalInterestValue = nextTotalInterestValue.Add(
241-
debtValue.Mul(rate.HourlyRate))
242-
243-
if w.config.MinDebtAmount.Sign() > 0 &&
244-
debtValue.Compare(w.config.MinDebtAmount) > 0 {
245-
exceededDebtAmount = true
238+
if rate, ok := rateMap[cur]; ok {
239+
debtValue := bal.Debt().Mul(price)
240+
nextTotalInterestValue = nextTotalInterestValue.Add(
241+
debtValue.Mul(rate.HourlyRate))
242+
243+
if w.config.MinDebtAmount.Sign() > 0 &&
244+
debtValue.Compare(w.config.MinDebtAmount) > 0 {
245+
exceededDebtAmount = true
246+
}
246247
}
247248
}
248249

0 commit comments

Comments
 (0)