From 7bb439f8d39ab2410bd5868d6193df2b71734707 Mon Sep 17 00:00:00 2001 From: ying liu Date: Mon, 29 Jul 2024 13:47:20 +0800 Subject: [PATCH] [fix] place price --- config/ccinr.yaml | 2 +- pkg/strategy/ccinr/strategy.go | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/ccinr.yaml b/config/ccinr.yaml index c14d799..129ac1e 100644 --- a/config/ccinr.yaml +++ b/config/ccinr.yaml @@ -44,7 +44,7 @@ exchangeStrategies: longCCI: -150.0 shortCCI: 150.0 leverage: 5.0 - profitRange: 0.25% + profitRange: 2% lossRange: 1% amount: 20 # recalculate: false diff --git a/pkg/strategy/ccinr/strategy.go b/pkg/strategy/ccinr/strategy.go index ae63d5e..7a3ebb6 100644 --- a/pkg/strategy/ccinr/strategy.go +++ b/pkg/strategy/ccinr/strategy.go @@ -151,10 +151,10 @@ func (s *Strategy) generateOrders(ctx context.Context, kline types.KLine) ([]typ //midPrice := (kline.High.Add(kline.Low)).Div(fixedpoint.Value(2.0)) //midP := (kline.High + kline.Low) / 2 if s.TradeType[symbol] == "long" { - placePrice = kline.Low + placePrice = kline.High //placePrice = midP } else if s.TradeType[symbol] == "short" { - placePrice = kline.High + placePrice = kline.Low //placePrice = midP } else { return orders, nil @@ -361,12 +361,12 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor qbtrade.OrderExecutor, if !s.Traded[symbol] { // 如若在下一根k线未成交 则取消订单 - if s.TradeType[symbol] != "" && s.TradeRetry[symbol] > 10 { + if s.TradeType[symbol] != "" && s.TradeRetry[symbol] > 1 { qbtrade.Notify(fmt.Sprintf("交易信号未成交,取消订单: %s", symbol)) s.cancelOrders(ctx, symbol) } - if s.TradeType[symbol] != "" && s.TradeRetry[symbol] <= 10 { + if s.TradeType[symbol] != "" && s.TradeRetry[symbol] <= 1 { s.TradeRetry[symbol] = s.TradeRetry[symbol] + 1 } }