mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 00:05:15 +00:00
improve deposit.GetCurrentConfirmation
This commit is contained in:
parent
0917b13b3f
commit
3eff1abba7
|
@ -369,10 +369,15 @@ func (s *Strategy) scanDepositHistory(ctx context.Context, asset string, duratio
|
||||||
case types.DepositSuccess:
|
case types.DepositSuccess:
|
||||||
logger.Infof("found pending -> success deposit: %+v", deposit)
|
logger.Infof("found pending -> success deposit: %+v", deposit)
|
||||||
current, required := deposit.GetCurrentConfirmation()
|
current, required := deposit.GetCurrentConfirmation()
|
||||||
if required > 0 && deposit.UnlockConfirm > 0 && current < deposit.UnlockConfirm {
|
if deposit.UnlockConfirm > 0 {
|
||||||
|
if current < deposit.UnlockConfirm {
|
||||||
logger.Infof("deposit %s unlock confirm %d is not reached, current: %d, required: %d, skip this round", deposit.TransactionID, deposit.UnlockConfirm, current, required)
|
logger.Infof("deposit %s unlock confirm %d is not reached, current: %d, required: %d, skip this round", deposit.TransactionID, deposit.UnlockConfirm, current, required)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
} else if required > 0 && current < required {
|
||||||
|
logger.Infof("deposit %s confirm %d/%d is not reached", deposit.TransactionID, current, required)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
succeededDeposits = append(succeededDeposits, deposit)
|
succeededDeposits = append(succeededDeposits, deposit)
|
||||||
delete(s.watchingDeposits, deposit.TransactionID)
|
delete(s.watchingDeposits, deposit.TransactionID)
|
||||||
|
|
|
@ -71,7 +71,10 @@ func (d Deposit) GetCurrentConfirmation() (current int, required int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
strs := strings.Split(d.Confirmation, "/")
|
strs := strings.Split(d.Confirmation, "/")
|
||||||
if len(strs) < 2 {
|
if len(strs) == 1 {
|
||||||
|
current, _ = strconv.Atoi(strs[0])
|
||||||
|
return current, 0
|
||||||
|
} else if len(strs) < 2 {
|
||||||
return 0, 0
|
return 0, 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user