mirror of
https://github.com/c9s/bbgo.git
synced 2024-09-20 16:21:09 +00:00
put sign check back
This commit is contained in:
parent
7b66d36f15
commit
5c2274c55c
|
@ -102,6 +102,10 @@ func (s *Strategy) checkAndBorrow(ctx context.Context) {
|
|||
// check if we over borrow
|
||||
if toBorrow.Add(b.Borrowed).Compare(marginAsset.MaxTotalBorrow) > 0 {
|
||||
toBorrow = toBorrow.Sub( toBorrow.Add(b.Borrowed).Sub(marginAsset.MaxTotalBorrow) )
|
||||
if toBorrow.Sign() < 0 {
|
||||
log.Warnf("margin asset %s is over borrowed, skip", marginAsset.Asset)
|
||||
continue
|
||||
}
|
||||
}
|
||||
toBorrow = fixedpoint.Min(toBorrow.Add(b.Borrowed), marginAsset.MaxTotalBorrow)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user