mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-22 23:05:15 +00:00
fix(ftx): subscribe channel first to avoid losing order update
This commit is contained in:
parent
14abd1436b
commit
02912f362c
|
@ -48,8 +48,6 @@ func NewStream(key, secret string, subAccount string, e *Exchange) *Stream {
|
||||||
|
|
||||||
s.ws.OnMessage((&messageHandler{StandardStream: s.StandardStream}).handleMessage)
|
s.ws.OnMessage((&messageHandler{StandardStream: s.StandardStream}).handleMessage)
|
||||||
s.ws.OnConnected(func(conn *websocket.Conn) {
|
s.ws.OnConnected(func(conn *websocket.Conn) {
|
||||||
s.EmitConnect()
|
|
||||||
|
|
||||||
subs := []websocketRequest{newLoginRequest(s.key, s.secret, time.Now(), s.subAccount)}
|
subs := []websocketRequest{newLoginRequest(s.key, s.secret, time.Now(), s.subAccount)}
|
||||||
subs = append(subs, s.subscriptions...)
|
subs = append(subs, s.subscriptions...)
|
||||||
for _, sub := range subs {
|
for _, sub := range subs {
|
||||||
|
@ -57,6 +55,8 @@ func NewStream(key, secret string, subAccount string, e *Exchange) *Stream {
|
||||||
s.ws.EmitError(fmt.Errorf("failed to send subscription: %+v", sub))
|
s.ws.EmitError(fmt.Errorf("failed to send subscription: %+v", sub))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.EmitConnect()
|
||||||
})
|
})
|
||||||
go s.handleChannelKlineMessage()
|
go s.handleChannelKlineMessage()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user