bbgo: fix: filter trades by symbol

This commit is contained in:
c9s 2021-12-27 16:32:30 +08:00
parent 42f22e0ef3
commit 0f24eec715

View File

@ -412,7 +412,9 @@ func (session *ExchangeSession) initSymbol(ctx context.Context, environ *Environ
session.Trades[symbol] = &types.TradeSlice{Trades: trades}
session.UserDataStream.OnTradeUpdate(func(trade types.Trade) {
session.Trades[symbol].Append(trade)
if trade.Symbol == symbol {
session.Trades[symbol].Append(trade)
}
})
position := &types.Position{