1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//! WebSocket streaming channel support
//!
//! This module provides typed subscription and message parsing for stock and FutOpt channels.
//!
//! # Stock Subscription
//!
//! Use [`StockSubscription`] to create typed stock subscriptions:
//!
//! ```rust
//! use marketdata_core::models::Channel;
//! use marketdata_core::websocket::channels::StockSubscription;
//!
//! // Subscribe to trades
//! let sub = StockSubscription::new(Channel::Trades, "2330");
//!
//! // Subscribe to odd lot trades
//! let odd_lot_sub = StockSubscription::new(Channel::Trades, "2330")
//! .with_odd_lot(true);
//! ```
//!
//! # FutOpt Subscription
//!
//! Use [`FutOptSubscription`] to create typed futures/options subscriptions:
//!
//! ```rust
//! use marketdata_core::models::futopt::FutOptChannel;
//! use marketdata_core::websocket::channels::FutOptSubscription;
//!
//! // Subscribe to futures trades
//! let sub = FutOptSubscription::new(FutOptChannel::Trades, "TXF202502");
//!
//! // Subscribe to after-hours trading
//! let ah_sub = FutOptSubscription::new(FutOptChannel::Trades, "TXF202502")
//! .with_after_hours(true);
//! ```
//!
//! # Message Parsing
//!
//! Parse incoming WebSocket messages:
//!
//! ```rust
//! use marketdata_core::websocket::channels::{parse_stream_message, parse_channel_data};
//!
//! // Parse top-level message
//! let json = r#"{"event": "subscribed", "id": "sub-1", "channel": "trades", "symbol": "2330"}"#;
//! let msg = parse_stream_message(json).unwrap();
//!
//! // Parse channel-specific data (from snapshot or data events)
//! use marketdata_core::models::streaming::StreamMessage;
//! if let StreamMessage::Snapshot { channel, payload, .. } = msg {
//! let data = parse_channel_data(&channel, &payload.data, true);
//! }
//! ```
pub use FutOptSubscription;
pub use ;
pub use StockSubscription;