autoborrow: add more verbose logs

This commit is contained in:
c9s 2022-08-19 16:05:59 +08:00
parent 913343816c
commit 4622f9f34e
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -138,14 +138,18 @@ func (s *Strategy) reBalanceDebt(ctx context.Context) {
marginAsset.MinDebtRatio = fixedpoint.One
}
log.Infof("checking debtRatio: session = %s asset = %s, debtRatio = %f", s.ExchangeSession.Name, marginAsset.Asset, debtRatio.Float64())
// if debt is greater than total, skip repay
if b.Debt().Compare(b.Total()) > 0 {
log.Infof("%s debt %f is less than total %f", marginAsset.Asset, b.Debt().Float64(), b.Total().Float64())
continue
}
// the current debt ratio is less than the minimal ratio,
// we need to repay and reduce the debt
if marginAsset.MinDebtRatio.Compare(debtRatio) < 0 {
if debtRatio.Compare(marginAsset.MinDebtRatio) > 0 {
log.Infof("%s debt ratio %f is less than min debt ratio %f, skip", marginAsset.Asset, debtRatio.Float64(), marginAsset.MinDebtRatio.Float64())
continue
}
@ -210,7 +214,7 @@ func (s *Strategy) checkAndBorrow(ctx context.Context) {
log.Warn("balance is empty, skip autoborrow")
return
}
for _, marginAsset := range s.Assets {
changed := false