From 70d6d8f5db142b94054084a8f19ebc38217b41d5 Mon Sep 17 00:00:00 2001 From: Andy Cheng Date: Mon, 13 Jun 2022 12:26:47 +0800 Subject: [PATCH] optimizer: share klines in report --- apps/backtest-report/components/TradingViewChart.tsx | 2 +- pkg/cmd/backtest.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/backtest-report/components/TradingViewChart.tsx b/apps/backtest-report/components/TradingViewChart.tsx index 5fd4d6c79..447ed0a9d 100644 --- a/apps/backtest-report/components/TradingViewChart.tsx +++ b/apps/backtest-report/components/TradingViewChart.tsx @@ -211,7 +211,7 @@ const removeDuplicatedKLines = (klines: Array): Array => { function fetchKLines(basePath: string, runID: string, symbol: string, interval: string) { return fetch( - `${basePath}/${runID}/klines/${symbol}-${interval}.tsv`, + `${basePath}/klines/${symbol}-${interval}.tsv`, ) .then((response) => response.text()) .then((data) => tsvParse(data, parseKline())) diff --git a/pkg/cmd/backtest.go b/pkg/cmd/backtest.go index 92205c3ce..0acc5baed 100644 --- a/pkg/cmd/backtest.go +++ b/pkg/cmd/backtest.go @@ -291,8 +291,11 @@ var BacktestCmd = &cobra.Command{ // reportDir = filepath.Join(reportDir, backtestSessionName) reportDir = filepath.Join(reportDir, runID) } + if err := util.SafeMkdirAll(reportDir); err != nil { + return err + } - kLineDataDir := filepath.Join(reportDir, "klines") + kLineDataDir := filepath.Join(outputDirectory, "klines") if err := util.SafeMkdirAll(kLineDataDir); err != nil { return err }