strategy: should always handle trade even if the strategy status is not running

This commit is contained in:
c9s 2022-06-06 06:56:44 +08:00
parent 0f0a0185b9
commit 4dafa32e97
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
2 changed files with 0 additions and 10 deletions

View File

@ -605,11 +605,6 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
s.tradeCollector = bbgo.NewTradeCollector(s.Symbol, s.Position, s.orderStore)
s.tradeCollector.OnTrade(func(trade types.Trade, profit, netProfit fixedpoint.Value) {
// StrategyController
if s.Status != types.StrategyStatusRunning {
return
}
s.Notifiability.Notify(trade)
s.ProfitStats.AddTrade(trade)

View File

@ -263,11 +263,6 @@ func (s *Strategy) Run(ctx context.Context, orderExecutor bbgo.OrderExecutor, se
s.tradeCollector = bbgo.NewTradeCollector(s.Symbol, s.Position, s.orderStore)
s.tradeCollector.OnTrade(func(trade types.Trade, profit, netProfit fixedpoint.Value) {
// StrategyController
if s.Status != types.StrategyStatusRunning {
return
}
s.Notifiability.Notify(trade)
s.ProfitStats.AddTrade(trade)