mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-26 00:35:15 +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
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *PrivateStream) Read(ctx context.Context, messages chan []byte) {
|
func (s *PrivateStream) Read(ctx context.Context, eventC chan interface{}) {
|
||||||
defer close(messages)
|
defer close(eventC)
|
||||||
|
|
||||||
ticker := time.NewTicker(1 * time.Minute)
|
ticker := time.NewTicker(1 * time.Minute)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
@ -112,7 +112,14 @@ func (s *PrivateStream) Read(ctx context.Context, messages chan []byte) {
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("[binance] recv: %s", message)
|
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