mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
grid2: calculate minBaseQuantity
This commit is contained in:
parent
45328a9f3d
commit
46bebb1022
|
@ -358,11 +358,13 @@ func (s *Strategy) calculateQuoteBaseInvestmentQuantity(quoteInvestment, baseInv
|
|||
// if the maxBaseQuantity is less than minQuantity, then we need to reduce the number of the sell orders
|
||||
// so that the quantity can be increased.
|
||||
numberOfSellOrders++
|
||||
minBaseQuantity := fixedpoint.Max(s.Market.MinNotional.Div(lastPrice), s.Market.MinQuantity)
|
||||
maxBaseQuantity := fixedpoint.Zero
|
||||
for maxBaseQuantity.Compare(s.Market.MinQuantity) <= 0 {
|
||||
numberOfSellOrders--
|
||||
maxBaseQuantity = baseInvestment.Div(fixedpoint.NewFromInt(int64(numberOfSellOrders)))
|
||||
}
|
||||
log.Infof("grid %s base investment quantity range: %f <=> %f", s.Symbol, minBaseQuantity.Float64(), maxBaseQuantity.Float64())
|
||||
|
||||
buyPlacedPrice := fixedpoint.Zero
|
||||
totalQuotePrice := fixedpoint.Zero
|
||||
|
|
Loading…
Reference in New Issue
Block a user