cbat/websocket/
ws_user.rs1use serde::Deserialize;
2
3#[derive(Debug, Clone, Deserialize)]
4pub struct UserOrder {
5 pub avg_price: String,
6 pub cancel_reason: String,
7 pub client_order_id: String,
8 pub completion_percentage: String,
9 pub contract_expiry_type: String,
10 pub cumulative_quantity: String,
11 pub filled_value: String,
12 pub leaves_quantity: String,
13 pub limit_price: String,
14 pub number_of_fills: String,
15 pub order_id: String,
16 pub order_side: String,
17 pub order_type: String,
18 pub outstanding_hold_amount: String,
19 pub post_only: String,
20 pub product_id: String,
21 pub product_type: String,
22 pub reject_reason: String,
23 pub retail_portfolio_id: String,
24 pub risk_managed_by: String,
25 pub status: String,
26 pub stop_price: String,
27 pub time_in_force: String,
28 pub total_fees: String,
29 pub total_value_after_fees: String,
30 pub trigger_status: String,
31 pub creation_time: String,
32 pub end_time: String,
33 pub start_time: String,
34}
35
36#[derive(Debug, Clone, Deserialize)]
37pub struct PerpetualFuturesPosition {
38 pub product_id: String,
39 pub portfolio_uuid: String,
40 pub vwap: String,
41 pub entry_vwap: String,
42 pub position_side: String,
43 pub margin_type: String,
44 pub net_size: String,
45 pub buy_order_size: String,
46 pub sell_order_size: String,
47 pub leverage: String,
48 pub mark_price: String,
49 pub liquidation_price: String,
50 pub im_notional: String,
51 pub mm_notional: String,
52 pub position_notional: String,
53 pub unrealized_pnl: String,
54 pub aggregated_pnl: String,
55}
56
57#[derive(Debug, Clone, Deserialize)]
58pub struct ExpiringFuturesPosition {
59 pub product_id: String,
60 pub side: String,
61 pub number_of_contracts: String,
62 pub realized_pnl: String,
63 pub unrealized_pnl: String,
64 pub entry_price: String,
65}
66
67#[derive(Debug, Clone, Deserialize)]
68pub struct Positions {
69 pub perpetual_futures_positions: Vec<PerpetualFuturesPosition>,
70 pub expiring_futures_positions: Vec<ExpiringFuturesPosition>,
71}
72
73#[derive(Debug, Clone, Deserialize)]
74pub struct UserEvent {
75 #[serde(rename = "type")]
76 pub event_type: String,
77 pub orders: Vec<UserOrder>,
78 pub positions: Positions,
79}
80
81#[derive(Debug, Clone, Deserialize)]
82pub struct UserMessage {
83 pub channel: String,
84 pub client_id: String,
85 pub timestamp: String,
86 pub sequence_num: i64,
87 pub events: Vec<UserEvent>,
88}