mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-23 15:25:14 +00:00
types: add RoundDownQuantityByPrecision
This commit is contained in:
parent
df842a04ee
commit
aff5447e71
|
@ -70,6 +70,12 @@ func (m Market) TruncateQuantity(quantity fixedpoint.Value) fixedpoint.Value {
|
|||
return fixedpoint.MustNewFromString(qs)
|
||||
}
|
||||
|
||||
// RoundDownQuantityByPrecision uses the volume precision to round down the quantity
|
||||
// This is different from the TruncateQuantity, which uses StepSize (it uses fewer fractions to truncate)
|
||||
func (m Market) RoundDownQuantityByPrecision(quantity fixedpoint.Value) fixedpoint.Value {
|
||||
return quantity.Round(m.VolumePrecision, fixedpoint.Down)
|
||||
}
|
||||
|
||||
func (m Market) TruncatePrice(price fixedpoint.Value) fixedpoint.Value {
|
||||
return fixedpoint.MustNewFromString(m.FormatPrice(price))
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user