ftx: panic if subscribe unsupported channel

This commit is contained in:
ycdesu 2021-03-29 22:08:56 +08:00
parent 66f165584f
commit f912fde6e3

View File

@ -54,7 +54,6 @@ func NewStream(key, secret string) *Stream {
func (s *Stream) Connect(ctx context.Context) error { func (s *Stream) Connect(ctx context.Context) error {
// If it's not public only, let's do the authentication. // If it's not public only, let's do the authentication.
if atomic.LoadInt32(&s.publicOnly) == 0 { if atomic.LoadInt32(&s.publicOnly) == 0 {
logger.Infof("subscribe private events")
s.subscribePrivateEvents() s.subscribePrivateEvents()
} }
@ -105,8 +104,7 @@ func (s *Stream) SetPublicOnly() {
func (s *Stream) Subscribe(channel types.Channel, symbol string, _ types.SubscribeOptions) { func (s *Stream) Subscribe(channel types.Channel, symbol string, _ types.SubscribeOptions) {
if channel != types.BookChannel { if channel != types.BookChannel {
logger.Errorf("only support orderbook channel") panic("only support book channel now")
return
} }
s.addSubscription(websocketRequest{ s.addSubscription(websocketRequest{
Operation: subscribe, Operation: subscribe,