nautilus_bybit/websocket/enums.rs
1// -------------------------------------------------------------------------------------------------
2// Copyright (C) 2015-2026 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
16//! Enumerations for Bybit WebSocket operations and channels.
17
18use serde::{Deserialize, Serialize};
19use strum::{AsRefStr, Display, EnumIter, EnumString};
20
21/// WebSocket operation type.
22#[derive(
23 Clone,
24 Debug,
25 Display,
26 PartialEq,
27 Eq,
28 Hash,
29 AsRefStr,
30 EnumIter,
31 EnumString,
32 Serialize,
33 Deserialize,
34)]
35#[serde(rename_all = "lowercase")]
36#[strum(serialize_all = "lowercase")]
37pub enum BybitWsOperation {
38 /// Subscribe to topics.
39 Subscribe,
40 /// Unsubscribe from topics.
41 Unsubscribe,
42 /// Authenticate connection.
43 Auth,
44 /// Ping message.
45 Ping,
46 /// Pong message.
47 Pong,
48}
49
50/// Private authenticated channel types.
51#[derive(
52 Clone,
53 Debug,
54 Display,
55 PartialEq,
56 Eq,
57 Hash,
58 AsRefStr,
59 EnumIter,
60 EnumString,
61 Serialize,
62 Deserialize,
63)]
64#[serde(rename_all = "lowercase")]
65#[strum(serialize_all = "lowercase")]
66pub enum BybitWsPrivateChannel {
67 /// Order updates.
68 Order,
69 /// Execution/fill updates.
70 Execution,
71 /// Fast execution stream (slimmer payload, lower latency).
72 ///
73 /// Effective 2026-03-17 the venue extended this stream to support options.
74 #[serde(rename = "execution.fast")]
75 #[strum(serialize = "execution.fast")]
76 ExecutionFast,
77 /// Position updates.
78 Position,
79 /// Wallet/balance updates.
80 Wallet,
81}
82
83/// Public channel types.
84#[derive(
85 Clone,
86 Debug,
87 Display,
88 PartialEq,
89 Eq,
90 Hash,
91 AsRefStr,
92 EnumIter,
93 EnumString,
94 Serialize,
95 Deserialize,
96)]
97#[serde(rename_all = "lowercase")]
98#[strum(serialize_all = "lowercase")]
99pub enum BybitWsPublicChannel {
100 /// Order book updates.
101 #[serde(rename = "orderbook")]
102 #[strum(serialize = "orderbook")]
103 OrderBook,
104 /// Public trades.
105 #[serde(rename = "publicTrade")]
106 #[strum(serialize = "publicTrade")]
107 PublicTrade,
108 /// Trade updates.
109 Trade,
110 /// Kline/candlestick updates.
111 Kline,
112 /// Ticker updates.
113 Tickers,
114}