fix connection status callbacks

This commit is contained in:
c9s 2021-12-30 17:23:27 +08:00
parent 4383823135
commit 26ff576727

View File

@ -323,14 +323,12 @@ func (session *ExchangeSession) Init(ctx context.Context, environ *Environment)
session.UserDataStream.OnTradeUpdate(session.OrderExecutor.EmitTradeUpdate)
session.UserDataStream.OnOrderUpdate(session.OrderExecutor.EmitOrderUpdate)
if len(session.Notifiability.notifiers) > 0 {
session.UserDataStream.OnDisconnect(func() {
session.Notifiability.Notify("session %s user data stream disconnected", session.Name)
})
session.UserDataStream.OnConnect(func() {
session.Notifiability.Notify("session %s user data stream connected", session.Name)
})
}
session.Account.BindStream(session.UserDataStream)