Thanks to visit codestin.com
Credit goes to docs.rs

hyperliquid_rust_sdk/info/
sub_structs.rs

1use ethers::types::H160;
2use serde::Deserialize;
3
4#[derive(Deserialize, Debug)]
5#[serde(rename_all = "camelCase")]
6pub struct Leverage {
7    #[serde(rename = "type")]
8    pub type_string: String,
9    pub value: u32,
10    pub raw_usd: Option<String>,
11}
12
13#[derive(Deserialize, Debug)]
14#[serde(rename_all = "camelCase")]
15pub struct CumulativeFunding {
16    pub all_time: String,
17    pub since_open: String,
18    pub since_change: String,
19}
20
21#[derive(Deserialize, Debug)]
22#[serde(rename_all = "camelCase")]
23pub struct PositionData {
24    pub coin: String,
25    pub entry_px: Option<String>,
26    pub leverage: Leverage,
27    pub liquidation_px: Option<String>,
28    pub margin_used: String,
29    pub position_value: String,
30    pub return_on_equity: String,
31    pub szi: String,
32    pub unrealized_pnl: String,
33    pub max_leverage: u32,
34    pub cum_funding: CumulativeFunding,
35}
36
37#[derive(Deserialize, Debug)]
38pub struct AssetPosition {
39    pub position: PositionData,
40    #[serde(rename = "type")]
41    pub type_string: String,
42}
43
44#[derive(Deserialize, Debug)]
45#[serde(rename_all = "camelCase")]
46pub struct MarginSummary {
47    pub account_value: String,
48    pub total_margin_used: String,
49    pub total_ntl_pos: String,
50    pub total_raw_usd: String,
51}
52
53#[derive(Deserialize, Debug)]
54#[serde(rename_all = "camelCase")]
55pub struct Level {
56    pub n: u64,
57    pub px: String,
58    pub sz: String,
59}
60
61#[derive(Deserialize, Debug)]
62#[serde(rename_all = "camelCase")]
63pub struct Delta {
64    #[serde(rename = "type")]
65    pub type_string: String,
66    pub coin: String,
67    pub usdc: String,
68    pub szi: String,
69    pub funding_rate: String,
70}
71
72#[derive(Deserialize, Debug)]
73#[serde(rename_all = "camelCase")]
74pub struct DailyUserVlm {
75    pub date: String,
76    pub exchange: String,
77    pub user_add: String,
78    pub user_cross: String,
79}
80
81#[derive(Deserialize, Debug)]
82#[serde(rename_all = "camelCase")]
83pub struct FeeSchedule {
84    pub add: String,
85    pub cross: String,
86    pub referral_discount: String,
87    pub tiers: Tiers,
88}
89
90#[derive(Deserialize, Debug)]
91pub struct Tiers {
92    pub mm: Vec<Mm>,
93    pub vip: Vec<Vip>,
94}
95
96#[derive(Deserialize, Debug)]
97#[serde(rename_all = "camelCase")]
98pub struct Mm {
99    pub add: String,
100    pub maker_fraction_cutoff: String,
101}
102
103#[derive(Deserialize, Debug)]
104#[serde(rename_all = "camelCase")]
105pub struct Vip {
106    pub add: String,
107    pub cross: String,
108    pub ntl_cutoff: String,
109}
110
111#[derive(Deserialize, Debug)]
112#[serde(rename_all = "camelCase")]
113pub struct UserTokenBalance {
114    pub coin: String,
115    pub hold: String,
116    pub total: String,
117    pub entry_ntl: String,
118}
119
120#[derive(Deserialize, Clone, Debug)]
121#[serde(rename_all = "camelCase")]
122pub struct OrderInfo {
123    pub order: BasicOrderInfo,
124    pub status: String,
125    pub status_timestamp: u64,
126}
127
128#[derive(Deserialize, Clone, Debug)]
129#[serde(rename_all = "camelCase")]
130pub struct BasicOrderInfo {
131    pub coin: String,
132    pub side: String,
133    pub limit_px: String,
134    pub sz: String,
135    pub oid: u64,
136    pub timestamp: u64,
137    pub trigger_condition: String,
138    pub is_trigger: bool,
139    pub trigger_px: String,
140    pub is_position_tpsl: bool,
141    pub reduce_only: bool,
142    pub order_type: String,
143    pub orig_sz: String,
144    pub tif: String,
145    pub cloid: Option<String>,
146}
147
148#[derive(Deserialize, Debug)]
149#[serde(rename_all = "camelCase")]
150pub struct Referrer {
151    pub referrer: H160,
152    pub code: String,
153}
154
155#[derive(Deserialize, Debug)]
156#[serde(rename_all = "camelCase")]
157pub struct ReferrerState {
158    pub stage: String,
159    pub data: ReferrerData,
160}
161
162#[derive(Deserialize, Debug)]
163#[serde(rename_all = "camelCase")]
164pub struct ReferrerData {
165    pub required: String,
166}