From d96e6e8cccab8a392f8880492faaec46c69ed5f3 Mon Sep 17 00:00:00 2001 From: c9s Date: Fri, 15 Jan 2021 10:47:49 +0800 Subject: [PATCH] use environment to configure database --- pkg/cmd/backtest.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/cmd/backtest.go b/pkg/cmd/backtest.go index 7db6d9354..4f616edcb 100644 --- a/pkg/cmd/backtest.go +++ b/pkg/cmd/backtest.go @@ -115,6 +115,11 @@ var BacktestCmd = &cobra.Command{ return err } + environ := bbgo.NewEnvironment() + if err := environ.ConfigureDatabase(ctx); err != nil { + return err + } + backtestService := &service.BacktestService{DB: db} if wantSync { @@ -178,7 +183,6 @@ var BacktestCmd = &cobra.Command{ backtestExchange := backtest.NewExchange(exchangeName, backtestService, userConfig.Backtest) - environ := bbgo.NewEnvironment() environ.SetStartTime(startTime) environ.AddExchange(exchangeName.String(), backtestExchange)