fix connection status callbacks

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

View File

@ -322,15 +322,13 @@ func (session *ExchangeSession) Init(ctx context.Context, environ *Environment)
// forward trade updates and order updates to the order executor
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.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)