optimizer: share klines in report

This commit is contained in:
Andy Cheng 2022-06-13 12:26:47 +08:00
parent e60e2177f9
commit 70d6d8f5db
2 changed files with 5 additions and 2 deletions

View File

@ -211,7 +211,7 @@ const removeDuplicatedKLines = (klines: Array<KLine>): Array<KLine> => {
function fetchKLines(basePath: string, runID: string, symbol: string, interval: string) { function fetchKLines(basePath: string, runID: string, symbol: string, interval: string) {
return fetch( return fetch(
`${basePath}/${runID}/klines/${symbol}-${interval}.tsv`, `${basePath}/klines/${symbol}-${interval}.tsv`,
) )
.then((response) => response.text()) .then((response) => response.text())
.then((data) => tsvParse(data, parseKline())) .then((data) => tsvParse(data, parseKline()))

View File

@ -291,8 +291,11 @@ var BacktestCmd = &cobra.Command{
// reportDir = filepath.Join(reportDir, backtestSessionName) // reportDir = filepath.Join(reportDir, backtestSessionName)
reportDir = filepath.Join(reportDir, runID) 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 { if err := util.SafeMkdirAll(kLineDataDir); err != nil {
return err return err
} }