mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 01:01:56 +00:00
parse event from the binance private stream
This commit is contained in:
parent
338d2443b9
commit
4cd96360b3
|
@ -82,8 +82,8 @@ func (s *PrivateStream) Connect(ctx context.Context) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *PrivateStream) Read(ctx context.Context, messages chan []byte) {
|
||||
defer close(messages)
|
||||
func (s *PrivateStream) Read(ctx context.Context, eventC chan interface{}) {
|
||||
defer close(eventC)
|
||||
|
||||
ticker := time.NewTicker(1 * time.Minute)
|
||||
defer ticker.Stop()
|
||||
|
@ -112,7 +112,14 @@ func (s *PrivateStream) Read(ctx context.Context, messages chan []byte) {
|
|||
}
|
||||
|
||||
log.Debugf("[binance] recv: %s", message)
|
||||
messages <- message
|
||||
|
||||
e, err := ParseBinanceEvent(string(message))
|
||||
if err != nil {
|
||||
log.WithError(err).Errorf("[binance] event parse error")
|
||||
continue
|
||||
}
|
||||
|
||||
eventC <- e
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user