From bded2edaf2cb3fbbc4a41516e2b5fb978bff004a Mon Sep 17 00:00:00 2001 From: gx578007 Date: Tue, 18 Jul 2023 15:48:27 +0800 Subject: [PATCH] FIX: [grid2] fix upper pin --- pkg/strategy/grid2/grid.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/strategy/grid2/grid.go b/pkg/strategy/grid2/grid.go index e5f9978c9..84e646733 100644 --- a/pkg/strategy/grid2/grid.go +++ b/pkg/strategy/grid2/grid.go @@ -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 }