Skip to content

Commit

Permalink
FIX: [grid2] fix upper pin
Browse files Browse the repository at this point in the history
  • Loading branch information
gx578007 authored and c9s committed Jul 18, 2023
1 parent 19552b0 commit bded2ed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/strategy/grid2/grid.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,12 @@ func calculateArithmeticPins(lower, upper, spread, tickSize fixedpoint.Value) []
}

// this makes sure there is no error at the upper price
pins = append(pins, Pin(upper))
pp := math.Round(upper.Float64()*pow10*10.0) / 10.0
pp = math.Trunc(pp) / pow10

pps := strconv.FormatFloat(pp, 'f', prec, 64)
upperPrice := fixedpoint.MustNewFromString(pps)
pins = append(pins, Pin(upperPrice))

return pins
}
Expand Down

0 comments on commit bded2ed

Please sign in to comment.