pivotshort: improve balance check for margin

This commit is contained in:
c9s 2022-07-01 15:41:50 +08:00
parent 09ba2d31c3
commit c792da2164
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -294,6 +294,10 @@ func (s *Strategy) placeOrder(ctx context.Context, price fixedpoint.Value, quant
}
func (s *Strategy) useQuantityOrBaseBalance(quantity fixedpoint.Value) fixedpoint.Value {
if s.session.Margin || s.session.IsolatedMargin || s.session.Futures || s.session.IsolatedFutures {
return quantity
}
balance, hasBalance := s.session.Account.Balance(s.Market.BaseCurrency)
if hasBalance {