From 5455ae810b0f37a0c1a69deb29dca520fc8f96b9 Mon Sep 17 00:00:00 2001 From: Andy Cheng Date: Mon, 8 Aug 2022 17:42:21 +0800 Subject: [PATCH] strategy/supertrend: only show nterval profit report in backtesting --- pkg/strategy/supertrend/strategy.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/strategy/supertrend/strategy.go b/pkg/strategy/supertrend/strategy.go index 2373b4349..ae169e2bd 100644 --- a/pkg/strategy/supertrend/strategy.go +++ b/pkg/strategy/supertrend/strategy.go @@ -334,10 +334,14 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se if s.TradeStats == nil { s.TradeStats = types.NewTradeStats(s.Symbol) } - startTime := s.Environment.StartTime() - s.TradeStats.SetIntervalProfitCollector(types.NewIntervalProfitCollector(types.Interval1d, startTime)) - s.TradeStats.SetIntervalProfitCollector(types.NewIntervalProfitCollector(types.Interval1w, startTime)) - s.TradeStats.SetIntervalProfitCollector(types.NewIntervalProfitCollector(types.Interval1mo, startTime)) + + // Interval profit report + if bbgo.IsBackTesting { + startTime := s.Environment.StartTime() + s.TradeStats.SetIntervalProfitCollector(types.NewIntervalProfitCollector(types.Interval1d, startTime)) + s.TradeStats.SetIntervalProfitCollector(types.NewIntervalProfitCollector(types.Interval1w, startTime)) + s.TradeStats.SetIntervalProfitCollector(types.NewIntervalProfitCollector(types.Interval1mo, startTime)) + } // Set fee rate if s.session.MakerFeeRate.Sign() > 0 || s.session.TakerFeeRate.Sign() > 0 {