From 874b6471914dafcc9de58bf137216614d7d3bbdd Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 15 Aug 2023 17:54:24 +0800 Subject: [PATCH] cmd: document tradeStats binding --- pkg/cmd/backtest.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/cmd/backtest.go b/pkg/cmd/backtest.go index 6dbfb8d1e..7ed612ee3 100644 --- a/pkg/cmd/backtest.go +++ b/pkg/cmd/backtest.go @@ -308,6 +308,8 @@ var BacktestCmd = &cobra.Command{ var reportDir = outputDirectory var sessionTradeStats = make(map[string]map[string]*types.TradeStats) + // for each exchange session, iterate the positions and + // allocate trade collector to calculate the tradeStats var tradeCollectorList []*core.TradeCollector for _, exSource := range exchangeSources { sessionName := exSource.Session.Name @@ -335,6 +337,7 @@ var BacktestCmd = &cobra.Command{ } sessionTradeStats[sessionName] = tradeStatsMap } + kLineHandlers = append(kLineHandlers, func(k types.KLine, _ *backtest.ExchangeDataSource) { if k.Interval == types.Interval1d && k.Closed { for _, collector := range tradeCollectorList {