pub struct Subscription<'a> {
pub op: &'a str,
pub args: Vec<&'a str>,
}Expand description
Parameters for WebSocket subscription requests.
Used to construct a WebSocket subscription request to subscribe to real-time data streams, such as order book updates or trade events. Bots use this to configure WebSocket feeds for market monitoring and trading signals in perpetual futures trading.
Fields§
§op: &'a strThe operation type (e.g., “subscribe”).
Specifies the WebSocket operation, typically "subscribe" for subscribing to data streams. Bots must set this correctly to initiate subscriptions.
args: Vec<&'a str>A list of subscription arguments.
Specifies the data streams to subscribe to, such as "orderbook.50.BTCUSDT" or "trade.BTCUSDT". Bots should provide valid topics to receive relevant market data.
Implementations§
Source§impl<'a> Subscription<'a>
impl<'a> Subscription<'a>
Sourcepub fn new(op: &'a str, args: Vec<&'a str>) -> Self
pub fn new(op: &'a str, args: Vec<&'a str>) -> Self
Constructs a new Subscription with specified parameters.
Allows customization of the WebSocket subscription. Bots should use this to specify the operation and subscription arguments for their data needs.
Sourcepub fn default() -> Subscription<'a>
pub fn default() -> Subscription<'a>
Creates a default Subscription.
Returns a subscription with op set to "subscribe" and an empty argument list. Suitable for testing but should be customized with valid topics for production.
Trait Implementations§
Source§impl<'a> Clone for Subscription<'a>
impl<'a> Clone for Subscription<'a>
Source§fn clone(&self) -> Subscription<'a>
fn clone(&self) -> Subscription<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more