grid2: pull out CalculatePins

This commit is contained in:
c9s 2022-11-09 16:26:04 +08:00
parent 1fa5186002
commit 32b6299b93
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54

View File

@ -60,11 +60,15 @@ func NewGrid(lower, upper, size, tickSize fixedpoint.Value) *Grid {
Spread: spread,
}
var pins = calculateArithmeticPins(lower, upper, spread, tickSize)
grid.addPins(pins)
grid.CalculatePins()
return grid
}
func (g *Grid) CalculatePins() {
var pins = calculateArithmeticPins(g.LowerPrice, g.UpperPrice, g.Spread, g.TickSize)
g.addPins(pins)
}
func (g *Grid) Height() fixedpoint.Value {
return g.UpperPrice.Sub(g.LowerPrice)
}