hyperliquid_rust_sdk_abrkn/info/
response_structs.rs

1use crate::{
2    info::{AssetPosition, Level, MarginSummary},
3    DailyUserVlm, Delta, FeeSchedule, OrderInfo, Referrer, ReferrerState, UserTokenBalance,
4};
5use serde::Deserialize;
6
7#[derive(Deserialize, Debug)]
8#[serde(rename_all = "camelCase")]
9pub struct UserStateResponse {
10    pub asset_positions: Vec<AssetPosition>,
11    pub cross_margin_summary: MarginSummary,
12    pub margin_summary: MarginSummary,
13    pub withdrawable: String,
14}
15
16#[derive(Deserialize, Debug)]
17pub struct UserTokenBalanceResponse {
18    pub balances: Vec<UserTokenBalance>,
19}
20
21#[derive(Deserialize, Debug)]
22#[serde(rename_all = "camelCase")]
23pub struct UserFeesResponse {
24    pub active_referral_discount: String,
25    pub daily_user_vlm: Vec<DailyUserVlm>,
26    pub fee_schedule: FeeSchedule,
27    pub user_add_rate: String,
28    pub user_cross_rate: String,
29}
30
31#[derive(serde::Deserialize, Debug)]
32#[serde(rename_all = "camelCase")]
33pub struct OpenOrdersResponse {
34    pub coin: String,
35    pub limit_px: String,
36    pub oid: u64,
37    pub side: String,
38    pub sz: String,
39    pub timestamp: u64,
40}
41
42#[derive(serde::Deserialize, Debug)]
43#[serde(rename_all = "camelCase")]
44pub struct UserFillsResponse {
45    pub closed_pnl: String,
46    pub coin: String,
47    pub crossed: bool,
48    pub dir: String,
49    pub hash: String,
50    pub oid: u64,
51    pub px: String,
52    pub side: String,
53    pub start_position: String,
54    pub sz: String,
55    pub time: u64,
56    pub fee: String,
57}
58
59#[derive(serde::Deserialize, Debug)]
60#[serde(rename_all = "camelCase")]
61pub struct FundingHistoryResponse {
62    pub coin: String,
63    pub funding_rate: String,
64    pub premium: String,
65    pub time: u64,
66}
67
68#[derive(Deserialize, Debug)]
69pub struct UserFundingResponse {
70    pub time: u64,
71    pub hash: String,
72    pub delta: Delta,
73}
74
75#[derive(serde::Deserialize, Debug)]
76#[serde(rename_all = "camelCase")]
77pub struct L2SnapshotResponse {
78    pub coin: String,
79    pub levels: Vec<Vec<Level>>,
80    pub time: u64,
81}
82
83#[derive(serde::Deserialize, Debug)]
84#[serde(rename_all = "camelCase")]
85pub struct RecentTradesResponse {
86    pub coin: String,
87    pub side: String,
88    pub px: String,
89    pub sz: String,
90    pub time: u64,
91    pub hash: String,
92}
93
94#[derive(serde::Deserialize, Debug)]
95pub struct CandlesSnapshotResponse {
96    #[serde(rename = "t")]
97    pub time_open: u64,
98    #[serde(rename = "T")]
99    pub time_close: u64,
100    #[serde(rename = "s")]
101    pub coin: String,
102    #[serde(rename = "i")]
103    pub candle_interval: String,
104    #[serde(rename = "o")]
105    pub open: String,
106    #[serde(rename = "c")]
107    pub close: String,
108    #[serde(rename = "h")]
109    pub high: String,
110    #[serde(rename = "l")]
111    pub low: String,
112    #[serde(rename = "v")]
113    pub vlm: String,
114    #[serde(rename = "n")]
115    pub num_trades: u64,
116}
117
118#[derive(Deserialize, Debug)]
119pub struct OrderStatusResponse {
120    pub status: String,
121    /// `None` if the order is not found
122    pub order: Option<OrderInfo>,
123}
124
125#[derive(Deserialize, Debug)]
126#[serde(rename_all = "camelCase")]
127pub struct ReferralResponse {
128    pub referred_by: Option<Referrer>,
129    pub cum_vlm: String,
130    pub unclaimed_rewards: String,
131    pub claimed_rewards: String,
132    pub referrer_state: ReferrerState,
133}