mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 14:55:16 +00:00
use PricePrecision for quote round up
This commit is contained in:
parent
80ea46ca92
commit
c8c9659dd1
|
@ -1365,7 +1365,7 @@ func (s *Strategy) generateGridOrders(totalQuote, totalBase, lastPrice fixedpoin
|
|||
|
||||
// because the precision issue, we need to round up quote quantity and add it into used quote
|
||||
// e.g. quote we calculate : 8888.85, but it may lock 8888.9 due to their precision.
|
||||
roundUpQuoteQuantity := quoteQuantity.Round(s.Market.VolumePrecision, fixedpoint.Up)
|
||||
roundUpQuoteQuantity := quoteQuantity.Round(s.Market.PricePrecision, fixedpoint.Up)
|
||||
usedQuote = usedQuote.Add(roundUpQuoteQuantity)
|
||||
}
|
||||
} else {
|
||||
|
@ -1384,7 +1384,7 @@ func (s *Strategy) generateGridOrders(totalQuote, totalBase, lastPrice fixedpoin
|
|||
|
||||
// because the precision issue, we need to round up quote quantity and add it into used quote
|
||||
// e.g. quote we calculate : 8888.85, but it may lock 8888.9 due to their precision.
|
||||
roundUpQuoteQuantity := quoteQuantity.Round(s.Market.VolumePrecision, fixedpoint.Up)
|
||||
roundUpQuoteQuantity := quoteQuantity.Round(s.Market.PricePrecision, fixedpoint.Up)
|
||||
if usedQuote.Add(roundUpQuoteQuantity).Compare(totalQuote) > 0 {
|
||||
if i > 0 {
|
||||
s.logger.Errorf("used quote %f > total quote %f, this should not happen", usedQuote.Add(quoteQuantity).Float64(), totalQuote.Float64())
|
||||
|
|
Loading…
Reference in New Issue
Block a user