xmaker: fix s.state.CoveredPosition.AtomicAdd add

This commit is contained in:
c9s 2021-12-31 02:00:39 +08:00
parent 63ccc2d3d0
commit 5999dc1151

View File

@ -748,10 +748,7 @@ func (s *Strategy) CrossRun(ctx context.Context, orderExecutionRouter bbgo.Order
s.tradeCollector.OnTrade(func(trade types.Trade) {
c := trade.PositionChange()
s.state.HedgePosition.AtomicAdd(c)
if trade.Exchange == s.sourceSession.ExchangeName {
s.state.CoveredPosition.AtomicAdd(c)
}
s.state.CoveredPosition.AtomicAdd(c)
s.state.ProfitStats.AddTrade(trade)
if err := s.SaveState(); err != nil {