mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
autoborrow: add margin level check back
This commit is contained in:
parent
1855e52838
commit
007f3c9531
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user