[fix] trade kline replace with nr kline

This commit is contained in:
ying liu 2024-07-29 13:31:44 +08:00
parent e0657fc9b4
commit f976de85cc

View File

@ -52,7 +52,6 @@ type Strategy struct {
Traded map[string]bool Traded map[string]bool
TradeType map[string]string TradeType map[string]string
TradeKLine map[string]types.KLine
TradeRetry map[string]int TradeRetry map[string]int
// orders // orders
@ -311,7 +310,6 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor qbtrade.OrderExecutor,
s.Traded = make(map[string]bool) s.Traded = make(map[string]bool)
s.TradeType = make(map[string]string) s.TradeType = make(map[string]string)
s.TradeKLine = make(map[string]types.KLine)
s.TradeRetry = make(map[string]int) s.TradeRetry = make(map[string]int)
s.ShortOrder = make(map[string]types.SubmitOrder) s.ShortOrder = make(map[string]types.SubmitOrder)
@ -372,7 +370,6 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor qbtrade.OrderExecutor,
s.TradeRetry[symbol] = s.TradeRetry[symbol] + 1 s.TradeRetry[symbol] = s.TradeRetry[symbol] + 1
} }
} }
s.TradeKLine[symbol] = k
} }
}) })
@ -394,7 +391,7 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor qbtrade.OrderExecutor,
sym, s.TradeType[sym], s.nr[sym].NrKLine.GetStartTime(), s.nr[sym].NrKLine.High.Float64(), sym, s.TradeType[sym], s.nr[sym].NrKLine.GetStartTime(), s.nr[sym].NrKLine.High.Float64(),
s.nr[sym].NrKLine.Low.Float64(), cciV) s.nr[sym].NrKLine.Low.Float64(), cciV)
qbtrade.Notify(msg) qbtrade.Notify(msg)
tk := s.TradeKLine[sym] tk := s.nr[sym].NrKLine
s.placeOrders(ctx, tk) s.placeOrders(ctx, tk)
}) })
} }