autoborrow: always repay first when it deposits

This commit is contained in:
c9s 2023-06-13 13:23:10 +08:00
parent fe5a6f4c36
commit 5a30bedc77
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -368,15 +368,7 @@ func (s *Strategy) handleBalanceUpdate(balances types.BalanceMap) {
func (s *Strategy) handleBinanceBalanceUpdateEvent(event *binance.BalanceUpdateEvent) { func (s *Strategy) handleBinanceBalanceUpdateEvent(event *binance.BalanceUpdateEvent) {
bbgo.Notify(event) bbgo.Notify(event)
if s.MinMarginLevel.IsZero() {
return
}
account := s.ExchangeSession.GetAccount() account := s.ExchangeSession.GetAccount()
if account.MarginLevel.Compare(s.MinMarginLevel) > 0 {
bbgo.Notify("account margin level %f is greater than minimal margin level %f, skip", account.MarginLevel.Float64(), s.MinMarginLevel.Float64())
return
}
delta := event.Delta delta := event.Delta