deribit_websocket/
subscriptions.rs

1//! WebSocket subscription management
2
3/// Subscription channels
4#[derive(Debug, Clone)]
5pub enum SubscriptionChannel {
6    Ticker(String),
7    OrderBook(String),
8    Trades(String),
9    UserOrders,
10    UserTrades,
11}
12
13impl SubscriptionChannel {
14    /// Convert to channel string
15    pub fn to_string(&self) -> String {
16        match self {
17            Self::Ticker(instrument) => format!("ticker.{instrument}.raw"),
18            Self::OrderBook(instrument) => format!("book.{instrument}.raw"),
19            Self::Trades(instrument) => format!("trades.{instrument}.raw"),
20            Self::UserOrders => "user.orders.any.any.raw".to_string(),
21            Self::UserTrades => "user.trades.any.any.raw".to_string(),
22        }
23    }
24}