mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 08:11:08 +00:00
autoborrow: fix debt checking condition
This commit is contained in:
parent
a2a062e95b
commit
bfb1165304
|
@ -126,7 +126,9 @@ func (s *Strategy) tryToRepayAnyDebt(ctx context.Context) {
|
|||
|
||||
balances := account.Balances()
|
||||
for _, b := range balances {
|
||||
if b.Borrowed.Sign() <= 0 {
|
||||
debt := b.Debt()
|
||||
|
||||
if debt.Sign() <= 0 {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -134,7 +136,7 @@ func (s *Strategy) tryToRepayAnyDebt(ctx context.Context) {
|
|||
continue
|
||||
}
|
||||
|
||||
toRepay := fixedpoint.Min(b.Available, b.Debt())
|
||||
toRepay := fixedpoint.Min(b.Available, debt)
|
||||
if toRepay.IsZero() {
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user