autoborrow: add margin level check back

This commit is contained in:
c9s 2023-06-13 23:17:24 +08:00
parent 1855e52838
commit 007f3c9531
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -380,6 +380,11 @@ func (s *Strategy) handleBinanceBalanceUpdateEvent(event *binance.BalanceUpdateE
minMarginLevel := s.MinMarginLevel minMarginLevel := s.MinMarginLevel
curMarginLevel := account.MarginLevel curMarginLevel := account.MarginLevel
// margin repay/borrow also trigger this update event
if curMarginLevel.Compare(minMarginLevel) > 0 {
return
}
if b, ok := account.Balance(event.Asset); ok { if b, ok := account.Balance(event.Asset); ok {
if b.Available.IsZero() { if b.Available.IsZero() {
return return