diff --git a/pkg/exchange/okex/convert.go b/pkg/exchange/okex/convert.go index f1889bb0a..0551ef684 100644 --- a/pkg/exchange/okex/convert.go +++ b/pkg/exchange/okex/convert.go @@ -97,6 +97,10 @@ func convertSubscription(s types.Subscription) (WebsocketSubscription, error) { }, nil case types.BookChannel: + if s.Options.Depth != types.DepthLevel400 { + return WebsocketSubscription{}, fmt.Errorf("%s depth not supported", s.Options.Depth) + } + return WebsocketSubscription{ Channel: ChannelBooks, InstrumentID: toLocalSymbol(s.Symbol), diff --git a/pkg/exchange/okex/stream_test.go b/pkg/exchange/okex/stream_test.go index a832767cf..7f85973ad 100644 --- a/pkg/exchange/okex/stream_test.go +++ b/pkg/exchange/okex/stream_test.go @@ -48,7 +48,7 @@ func TestStream(t *testing.T) { t.Run("book test", func(t *testing.T) { s.Subscribe(types.BookChannel, "BTCUSDT", types.SubscribeOptions{ - Depth: types.DepthLevel50, + Depth: types.DepthLevel400, }) s.SetPublicOnly() err := s.Connect(context.Background()) @@ -97,7 +97,7 @@ func TestStream(t *testing.T) { t.Run("Subscribe/Unsubscribe test", func(t *testing.T) { s.Subscribe(types.BookChannel, "BTCUSDT", types.SubscribeOptions{ - Depth: types.DepthLevel50, + Depth: types.DepthLevel400, }) s.SetPublicOnly() err := s.Connect(context.Background()) @@ -119,7 +119,7 @@ func TestStream(t *testing.T) { t.Run("Resubscribe test", func(t *testing.T) { s.Subscribe(types.BookChannel, "BTCUSDT", types.SubscribeOptions{ - Depth: types.DepthLevel50, + Depth: types.DepthLevel400, }) s.SetPublicOnly() err := s.Connect(context.Background()) diff --git a/pkg/types/stream.go b/pkg/types/stream.go index f8aa209e1..aaa9efab5 100644 --- a/pkg/types/stream.go +++ b/pkg/types/stream.go @@ -547,6 +547,7 @@ const ( DepthLevel20 Depth = "20" DepthLevel50 Depth = "50" DepthLevel200 Depth = "200" + DepthLevel400 Depth = "400" ) type Speed string