pivotshort: fix bounce ratio calculation

This commit is contained in:
c9s 2022-06-28 22:17:55 +08:00 committed by Austin Liu
parent b32cfef2fd
commit 37413e4355

View File

@ -361,7 +361,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
bbgo.Notify("%s price %f breaks the previous low %f with ratio %f, submitting market sell to open a short position", s.Symbol, kline.Close.Float64(), previousLow.Float64(), s.BreakLow.Ratio.Float64()) bbgo.Notify("%s price %f breaks the previous low %f with ratio %f, submitting market sell to open a short position", s.Symbol, kline.Close.Float64(), previousLow.Float64(), s.BreakLow.Ratio.Float64())
s.placeMarketSell(ctx, quantity, "breakLowMarket") s.placeMarketSell(ctx, quantity, "breakLowMarket")
} else { } else {
sellPrice := kline.Close.Mul(fixedpoint.One.Add(s.BreakLow.BounceRatio)) sellPrice := previousLow.Mul(fixedpoint.One.Add(s.BreakLow.BounceRatio))
bbgo.Notify("%s price %f breaks the previous low %f with ratio %f, submitting limit sell @ %f", s.Symbol, kline.Close.Float64(), previousLow.Float64(), s.BreakLow.Ratio.Float64(), sellPrice.Float64()) bbgo.Notify("%s price %f breaks the previous low %f with ratio %f, submitting limit sell @ %f", s.Symbol, kline.Close.Float64(), previousLow.Float64(), s.BreakLow.Ratio.Float64(), sellPrice.Float64())
s.placeLimitSell(ctx, sellPrice, quantity, "breakLowLimit") s.placeLimitSell(ctx, sellPrice, quantity, "breakLowLimit")