mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-23 15:25:14 +00:00
add range detection methods
This commit is contained in:
parent
47fbe3a3ed
commit
e1a882bbad
|
@ -41,6 +41,18 @@ func NewGrid(lower, upper, density fixedpoint.Value) *Grid {
|
|||
return grid
|
||||
}
|
||||
|
||||
func (g *Grid) Above(price fixedpoint.Value) bool {
|
||||
return price > g.UpperPrice
|
||||
}
|
||||
|
||||
func (g *Grid) Below(price fixedpoint.Value) bool {
|
||||
return price < g.LowerPrice
|
||||
}
|
||||
|
||||
func (g *Grid) OutOfRange(price fixedpoint.Value) bool {
|
||||
return price < g.LowerPrice || price > g.UpperPrice
|
||||
}
|
||||
|
||||
func (g *Grid) updatePinsCache() {
|
||||
for _, pin := range g.Pins {
|
||||
g.pinsCache[pin] = struct{}{}
|
||||
|
|
Loading…
Reference in New Issue
Block a user