mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +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()
|
balances := account.Balances()
|
||||||
for _, b := range balances {
|
for _, b := range balances {
|
||||||
if b.Borrowed.Sign() <= 0 {
|
debt := b.Debt()
|
||||||
|
|
||||||
|
if debt.Sign() <= 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +136,7 @@ func (s *Strategy) tryToRepayAnyDebt(ctx context.Context) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
toRepay := fixedpoint.Min(b.Available, b.Debt())
|
toRepay := fixedpoint.Min(b.Available, debt)
|
||||||
if toRepay.IsZero() {
|
if toRepay.IsZero() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user