mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-21 22:43:52 +00:00
types: reset order book when stream disconnected
This commit is contained in:
parent
505decce48
commit
5b23671b44
|
@ -212,6 +212,10 @@ func (sb *StreamOrderBook) updateMetrics(t time.Time) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sb *StreamOrderBook) BindStream(stream Stream) {
|
func (sb *StreamOrderBook) BindStream(stream Stream) {
|
||||||
|
stream.OnDisconnect(func() {
|
||||||
|
sb.Reset()
|
||||||
|
})
|
||||||
|
|
||||||
stream.OnBookSnapshot(func(book SliceOrderBook) {
|
stream.OnBookSnapshot(func(book SliceOrderBook) {
|
||||||
if sb.MutexOrderBook.Symbol != book.Symbol {
|
if sb.MutexOrderBook.Symbol != book.Symbol {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue
Block a user