mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
grid2: round up minBaseQuantity
This commit is contained in:
parent
4c13171cb0
commit
c93a3d14b3
|
@ -793,6 +793,7 @@ func (s *Strategy) calculateBaseQuoteInvestmentQuantity(quoteInvestment, baseInv
|
|||
|
||||
if baseQuantity.Compare(minBaseQuantity) <= 0 {
|
||||
numberOfSellOrders = int(math.Floor(baseInvestment.Div(minBaseQuantity).Float64()))
|
||||
baseQuantity = s.Market.RoundUpQuantityByPrecision(minBaseQuantity)
|
||||
}
|
||||
|
||||
s.logger.Infof("grid base investment sell orders: %d", numberOfSellOrders)
|
||||
|
|
|
@ -76,6 +76,11 @@ func (m Market) RoundDownQuantityByPrecision(quantity fixedpoint.Value) fixedpoi
|
|||
return quantity.Round(m.VolumePrecision, fixedpoint.Down)
|
||||
}
|
||||
|
||||
// RoundUpQuantityByPrecision uses the volume precision to round up the quantity
|
||||
func (m Market) RoundUpQuantityByPrecision(quantity fixedpoint.Value) fixedpoint.Value {
|
||||
return quantity.Round(m.VolumePrecision, fixedpoint.Up)
|
||||
}
|
||||
|
||||
func (m Market) TruncatePrice(price fixedpoint.Value) fixedpoint.Value {
|
||||
return fixedpoint.MustNewFromString(m.FormatPrice(price))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user