use environment to configure database

This commit is contained in:
c9s 2021-01-15 10:47:49 +08:00
parent 2a524c0505
commit d96e6e8ccc

View File

@ -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)