nautilus_coinbase_intx/websocket/
enums.rs

1// -------------------------------------------------------------------------------------------------
2//  Copyright (C) 2015-2025 Nautech Systems Pty Ltd. All rights reserved.
3//  https://nautechsystems.io
4//
5//  Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6//  You may not use this file except in compliance with the License.
7//  You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9//  Unless required by applicable law or agreed to in writing, software
10//  distributed under the License is distributed on an "AS IS" BASIS,
11//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12//  See the License for the specific language governing permissions and
13//  limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16use serde::{Deserialize, Serialize};
17use strum::{AsRefStr, Display, EnumIter, EnumString};
18
19/// Error types that can be returned by the WebSocket API.
20#[derive(
21    Clone,
22    Debug,
23    Display,
24    PartialEq,
25    Eq,
26    Hash,
27    AsRefStr,
28    EnumIter,
29    EnumString,
30    Serialize,
31    Deserialize,
32)]
33#[serde(rename_all = "camelCase")]
34pub enum WsErrorType {
35    /// General error.
36    Error,
37    /// Error during subscription.
38    SubscriptionError,
39    /// Error during unsubscription.
40    UnsubscriptionError,
41    /// Authentication failure.
42    AuthenticationError,
43    /// Rate limit exceeded.
44    RateLimit,
45}
46
47/// Operation type for WebSocket commands.
48#[derive(
49    Clone,
50    Debug,
51    Display,
52    PartialEq,
53    Eq,
54    Hash,
55    AsRefStr,
56    EnumIter,
57    EnumString,
58    Serialize,
59    Deserialize,
60)]
61#[serde(rename_all = "UPPERCASE")]
62pub enum WsOperation {
63    /// Subscribe to one or more topics.
64    Subscribe,
65    /// Unsubscribe from one or more topics.
66    Unsubscribe,
67}
68
69/// Operation type for WebSocket commands.
70#[derive(
71    Clone,
72    Debug,
73    Display,
74    PartialEq,
75    Eq,
76    Hash,
77    AsRefStr,
78    EnumIter,
79    EnumString,
80    Serialize,
81    Deserialize,
82)]
83#[serde(rename_all = "UPPERCASE")]
84pub enum WsMessageType {
85    /// Snapshot message type.
86    Snapshot,
87    /// Update message type.
88    Update,
89}
90
91/// Coinbase International WebSocket feed channel.
92#[derive(
93    Copy,
94    Clone,
95    Debug,
96    Display,
97    PartialEq,
98    Eq,
99    Hash,
100    AsRefStr,
101    EnumIter,
102    EnumString,
103    Serialize,
104    Deserialize,
105)]
106#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
107pub enum CoinbaseIntxWsChannel {
108    Subscriptions,
109    Instruments,
110    Match,
111    Funding,
112    Risk,
113    Level1,
114    Level2,
115    CandlesOneMinute,
116    CandlesFiveMinute,
117    CandlesThirtyMinute,
118    CandlesTwoHour,
119    CandlesOneDay,
120}