autoborrow: show debt and total for debt ratio

This commit is contained in:
c9s 2023-07-18 10:54:39 +08:00
parent 844bd8be87
commit 84ec320601
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -180,7 +180,9 @@ func (s *Strategy) reBalanceDebt(ctx context.Context) {
}
// debt / total
debtRatio := b.Debt().Div(b.Total())
debt := b.Debt()
total := b.Total()
debtRatio := debt.Div(total)
if marginAsset.MinDebtRatio.IsZero() {
marginAsset.MinDebtRatio = fixedpoint.One
}
@ -189,7 +191,7 @@ func (s *Strategy) reBalanceDebt(ctx context.Context) {
continue
}
log.Infof("checking debtRatio: session = %s asset = %s, debtRatio = %f", s.ExchangeSession.Name, marginAsset.Asset, debtRatio.Float64())
log.Infof("checking debtRatio: session = %s asset = %s, debt = %f, total = %f, debtRatio = %f", s.ExchangeSession.Name, marginAsset.Asset, debt.Float64(), total.Float64(), debtRatio.Float64())
// if debt is greater than total, skip repay
if b.Debt().Compare(b.Total()) > 0 {