From 007f3c9531f3df57b083e672b0239dd6330370b7 Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 13 Jun 2023 23:17:24 +0800 Subject: [PATCH] autoborrow: add margin level check back --- pkg/strategy/autoborrow/strategy.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/strategy/autoborrow/strategy.go b/pkg/strategy/autoborrow/strategy.go index 6fe224cd9..59e352122 100644 --- a/pkg/strategy/autoborrow/strategy.go +++ b/pkg/strategy/autoborrow/strategy.go @@ -380,6 +380,11 @@ func (s *Strategy) handleBinanceBalanceUpdateEvent(event *binance.BalanceUpdateE minMarginLevel := s.MinMarginLevel 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.Available.IsZero() { return