grid2: fix MinimalQuoteInvestment check

This commit is contained in:
c9s 2023-02-17 17:16:25 +08:00
parent 039fb4f4b7
commit 29692b0e1a
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -1100,7 +1100,7 @@ func (s *Strategy) getLastTradePrice(ctx context.Context, session *bbgo.Exchange
}
func calculateMinimalQuoteInvestment(market types.Market, lowerPrice, upperPrice fixedpoint.Value, gridNum int64) fixedpoint.Value {
num := fixedpoint.NewFromInt(gridNum)
num := fixedpoint.NewFromInt(gridNum - 1)
minimalAmountLowerPrice := fixedpoint.Max(lowerPrice.Mul(market.MinQuantity), market.MinNotional)
minimalAmountUpperPrice := fixedpoint.Max(upperPrice.Mul(market.MinQuantity), market.MinNotional)
return fixedpoint.Max(minimalAmountLowerPrice, minimalAmountUpperPrice).Mul(num)