birdie/margin/account/
query_isolated_margin_fee_data.rs1use jiff::Timestamp;
2use reqwest::Method;
3use serde::{Deserialize, Serialize};
4
5use crate::{enums::SecurityType, rest_api::endpoint};
6
7endpoint!(
8 "/sapi/v1/margin/isolatedMarginData",
9 Method::GET,
10 SecurityType::UserData,
11 QueryIsolatedMarginFeeDataEndpoint,
12 QueryIsolatedMarginFeeDataParams,
13 QueryIsolatedMarginFeeDataResponse
14);
15
16pub struct QueryIsolatedMarginFeeDataEndpoint<'r> {
23 client: &'r crate::rest_api::RestApiClient,
24}
25
26impl<'r> QueryIsolatedMarginFeeDataEndpoint<'r> {
27 pub fn new(client: &'r crate::rest_api::RestApiClient) -> Self {
28 Self { client }
29 }
30}
31
32#[derive(Debug, Serialize)]
33#[serde(rename_all = "camelCase")]
34pub struct QueryIsolatedMarginFeeDataParams {
35 vip_level: Option<i64>,
36 symbol: Option<String>,
37 recv_window: Option<i64>,
38 timestamp: i64,
39}
40
41impl QueryIsolatedMarginFeeDataParams {
42 pub fn new() -> Self {
43 Self {
44 vip_level: None,
45 symbol: None,
46 recv_window: None,
47 timestamp: Timestamp::now().as_millisecond(),
48 }
49 }
50
51 pub fn vip_level(mut self, vip_level: i64) -> Self {
52 self.vip_level = Some(vip_level);
53 self
54 }
55
56 pub fn symbol(mut self, symbol: String) -> Self {
57 self.symbol = Some(symbol);
58 self
59 }
60
61 pub fn recv_window(mut self, recv_window: i64) -> Self {
62 self.recv_window = Some(recv_window);
63 self
64 }
65}
66
67pub type QueryIsolatedMarginFeeDataResponse = Vec<IsolatedMarginFee>;
68
69#[derive(Debug, Deserialize)]
70#[serde(rename_all = "camelCase")]
71pub struct IsolatedMarginFee {
72 pub vip_level: i64,
73 pub symbol: String,
74 pub leverage: String,
75 pub data: Vec<IsolatedMarginFeeData>,
76}
77
78#[derive(Debug, Deserialize)]
79#[serde(rename_all = "camelCase")]
80pub struct IsolatedMarginFeeData {
81 pub coin: String,
82 pub daily_interest: String,
83 pub borrow_limit: String,
84}