From 8ed39f7565729b489d925e304d449502eb80d880 Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 6 Sep 2022 13:18:35 +0800 Subject: [PATCH 1/2] cmd: add session name to the symbol report json file --- pkg/cmd/backtest.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cmd/backtest.go b/pkg/cmd/backtest.go index e3866f4c2..3909f1526 100644 --- a/pkg/cmd/backtest.go +++ b/pkg/cmd/backtest.go @@ -548,7 +548,7 @@ var BacktestCmd = &cobra.Command{ // write report to a file if generatingReport { - reportFileName := fmt.Sprintf("symbol_report_%s.json", symbol) + reportFileName := fmt.Sprintf("symbol_report_%s_%s.json", session.Name, symbol) if err := util.WriteJsonFile(filepath.Join(reportDir, reportFileName), &symbolReport); err != nil { return err } From ed975de2cd06777f66bc0afcbb96390abe57c853 Mon Sep 17 00:00:00 2001 From: c9s Date: Tue, 6 Sep 2022 13:20:37 +0800 Subject: [PATCH 2/2] cmd: write config json file into the backtest report dir --- pkg/cmd/backtest.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/backtest.go b/pkg/cmd/backtest.go index 3909f1526..0e61e8a9b 100644 --- a/pkg/cmd/backtest.go +++ b/pkg/cmd/backtest.go @@ -563,7 +563,12 @@ var BacktestCmd = &cobra.Command{ fmt.Println(summaryReportFile) if err := util.WriteJsonFile(summaryReportFile, summaryReport); err != nil { - return err + return errors.Wrapf(err, "can not write summary report json file: %s", summaryReportFile) + } + + configJsonFile := filepath.Join(reportDir, "config.json") + if err := util.WriteJsonFile(configJsonFile, userConfig); err != nil { + return errors.Wrapf(err, "can not write config json file: %s", configJsonFile) } // append report index