mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
autoborrow: add more verbose logs
This commit is contained in:
parent
913343816c
commit
4622f9f34e
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user