[fix] midprice fix

This commit is contained in:
ying liu 2024-07-29 12:51:07 +08:00
parent 7404bdf0dc
commit 4cb31648ad

View File

@ -149,7 +149,7 @@ func (s *Strategy) generateOrders(ctx context.Context, kline types.KLine) ([]typ
log.Infof(fmt.Sprintf("place order keline info: symbol %s, high %v, low %v, open %v, close %v", symbol, log.Infof(fmt.Sprintf("place order keline info: symbol %s, high %v, low %v, open %v, close %v", symbol,
kline.High.Float64(), kline.Low.Float64(), kline.Open.Float64(), kline.Close.Float64())) kline.High.Float64(), kline.Low.Float64(), kline.Open.Float64(), kline.Close.Float64()))
placePrice := fixedpoint.Value(0) placePrice := fixedpoint.Value(0)
midPrice := (kline.High.Add(kline.Low)).Div(2) midPrice := (kline.High.Add(kline.Low)).Div(fixedpoint.Value(2.0))
if s.TradeType[symbol] == "long" { if s.TradeType[symbol] == "long" {
placePrice = midPrice placePrice = midPrice
} else if s.TradeType[symbol] == "short" { } else if s.TradeType[symbol] == "short" {