mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 16:55:15 +00:00
binance: add listenKeyExpired callback
This commit is contained in:
parent
4890d19ebf
commit
ff635195fb
|
@ -62,6 +62,8 @@ type Stream struct {
|
||||||
accountUpdateEventCallbacks []func(e *AccountUpdateEvent)
|
accountUpdateEventCallbacks []func(e *AccountUpdateEvent)
|
||||||
accountConfigUpdateEventCallbacks []func(e *AccountConfigUpdateEvent)
|
accountConfigUpdateEventCallbacks []func(e *AccountConfigUpdateEvent)
|
||||||
|
|
||||||
|
listenKeyExpiredCallbacks []func(e *ListenKeyExpired)
|
||||||
|
|
||||||
depthBuffers map[string]*depth.Buffer
|
depthBuffers map[string]*depth.Buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,6 +365,10 @@ func (s *Stream) dispatchEvent(e interface{}) {
|
||||||
|
|
||||||
case *AccountConfigUpdateEvent:
|
case *AccountConfigUpdateEvent:
|
||||||
s.EmitAccountConfigUpdateEvent(e)
|
s.EmitAccountConfigUpdateEvent(e)
|
||||||
|
|
||||||
|
case *ListenKeyExpired:
|
||||||
|
s.EmitListenKeyExpired(e)
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,16 @@ func (s *Stream) EmitAccountConfigUpdateEvent(e *AccountConfigUpdateEvent) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Stream) OnListenKeyExpired(cb func(e *ListenKeyExpired)) {
|
||||||
|
s.listenKeyExpiredCallbacks = append(s.listenKeyExpiredCallbacks, cb)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *Stream) EmitListenKeyExpired(e *ListenKeyExpired) {
|
||||||
|
for _, cb := range s.listenKeyExpiredCallbacks {
|
||||||
|
cb(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type StreamEventHub interface {
|
type StreamEventHub interface {
|
||||||
OnDepthEvent(cb func(e *DepthEvent))
|
OnDepthEvent(cb func(e *DepthEvent))
|
||||||
|
|
||||||
|
@ -184,4 +194,6 @@ type StreamEventHub interface {
|
||||||
OnAccountUpdateEvent(cb func(e *AccountUpdateEvent))
|
OnAccountUpdateEvent(cb func(e *AccountUpdateEvent))
|
||||||
|
|
||||||
OnAccountConfigUpdateEvent(cb func(e *AccountConfigUpdateEvent))
|
OnAccountConfigUpdateEvent(cb func(e *AccountConfigUpdateEvent))
|
||||||
|
|
||||||
|
OnListenKeyExpired(cb func(e *ListenKeyExpired))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user