mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +00:00
check symbol for the position update
This commit is contained in:
parent
48dd697ce3
commit
8a08c406c3
|
@ -217,6 +217,8 @@ func (environ *Environment) Init(ctx context.Context) (err error) {
|
|||
}
|
||||
|
||||
session.positions[symbol] = position
|
||||
position.BindStream(session.Stream)
|
||||
|
||||
session.Trades[symbol] = trades
|
||||
session.lastPrices[symbol] = 0.0
|
||||
|
||||
|
|
|
@ -14,7 +14,9 @@ type Position struct {
|
|||
|
||||
func (p *Position) BindStream(stream types.Stream) {
|
||||
stream.OnTradeUpdate(func(trade types.Trade) {
|
||||
p.AddTrade(trade)
|
||||
if p.Symbol == trade.Symbol {
|
||||
p.AddTrade(trade)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user