mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 06:53:52 +00:00
fix backtest Initialize call
This commit is contained in:
parent
4b70f864ff
commit
9efd8bd604
|
@ -26,7 +26,7 @@ backtest:
|
|||
endTime: "2022-03-01"
|
||||
symbols:
|
||||
- BTCUSDT
|
||||
sessions: [max,binance]
|
||||
sessions: [binance]
|
||||
# syncSecKLines: true
|
||||
accounts:
|
||||
binance:
|
||||
|
|
|
@ -357,7 +357,6 @@ func (trader *Trader) Run(ctx context.Context) error {
|
|||
}
|
||||
|
||||
func (trader *Trader) Initialize(ctx context.Context) error {
|
||||
log.Infof("initializing strategies...")
|
||||
return trader.IterateStrategies(func(strategy StrategyID) error {
|
||||
if initializer, ok := strategy.(StrategyInitializer); ok {
|
||||
return initializer.Initialize()
|
||||
|
|
|
@ -303,6 +303,10 @@ var BacktestCmd = &cobra.Command{
|
|||
return err
|
||||
}
|
||||
|
||||
if err := trader.Initialize(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := trader.Run(ctx); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -37,7 +37,10 @@ type Strategy struct {
|
|||
}
|
||||
|
||||
func (s *Strategy) Initialize() error {
|
||||
s.Strategy = &common.Strategy{}
|
||||
if s.Strategy == nil {
|
||||
s.Strategy = &common.Strategy{}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user