mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 16:25:16 +00:00
core: add trade to the trade store when order is not matched
This commit is contained in:
parent
7adc786c8a
commit
71d86aa483
|
@ -77,7 +77,7 @@ func (c *TradeCollector) BindStreamForBackground(stream types.Stream) {
|
|||
|
||||
func (c *TradeCollector) BindStream(stream types.Stream) {
|
||||
stream.OnTradeUpdate(func(trade types.Trade) {
|
||||
c.ProcessTrade(trade)
|
||||
c.processTrade(trade)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -194,6 +194,9 @@ func (c *TradeCollector) processTrade(trade types.Trade) bool {
|
|||
}
|
||||
|
||||
if !c.orderStore.Exists(trade.OrderID) {
|
||||
// not done yet
|
||||
// add this trade to the trade store for the later processing
|
||||
c.tradeStore.Add(trade)
|
||||
c.mu.Unlock()
|
||||
return false
|
||||
}
|
||||
|
@ -241,7 +244,7 @@ func (c *TradeCollector) Run(ctx context.Context) {
|
|||
c.Process()
|
||||
|
||||
case trade := <-c.tradeC:
|
||||
c.ProcessTrade(trade)
|
||||
c.processTrade(trade)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user