ftx/rest/model/
spot_margin.rs1use {
2 super::Request,
3 chrono::{DateTime, Utc},
4 http::Method,
5 rust_decimal::Decimal,
6 serde::{Deserialize, Serialize},
7};
8
9#[derive(Debug, Clone, Serialize, Default)]
10pub struct GetLendingRates {}
11
12#[derive(Clone, Debug, Deserialize, Serialize)]
13#[serde(rename_all = "camelCase")]
14pub struct LendingRate {
15 pub coin: String,
16 pub estimate: Decimal, pub previous: Decimal, }
19
20impl Request for GetLendingRates {
21 const METHOD: Method = Method::GET;
22 const PATH: &'static str = "/spot_margin/lending_rates";
23 const AUTH: bool = true;
24
25 type Response = Vec<LendingRate>;
26}
27
28#[derive(Clone, Debug, Deserialize, Serialize)]
29#[serde(rename_all = "camelCase")]
30pub struct MyLendingHistory {
31 pub coin: String,
32 pub proceeds: Decimal,
33 pub rate: Decimal,
34 pub size: Decimal,
35 pub time: DateTime<Utc>,
36}
37
38#[derive(Debug, Clone, Serialize, Default)]
39pub struct GetMyLendingHistory {
40 #[serde(
41 skip_serializing_if = "Option::is_none",
42 serialize_with = "super::serialize_as_timestamp"
43 )]
44 pub start_time: Option<DateTime<Utc>>,
45 #[serde(
46 skip_serializing_if = "Option::is_none",
47 serialize_with = "super::serialize_as_timestamp"
48 )]
49 pub end_time: Option<DateTime<Utc>>,
50}
51
52impl Request for GetMyLendingHistory {
53 const METHOD: Method = Method::GET;
54 const PATH: &'static str = "/spot_margin/lending_history";
55 const AUTH: bool = true;
56
57 type Response = Vec<MyLendingHistory>;
58}
59
60#[derive(Debug, Clone, Serialize, Default)]
61pub struct GetLendingInfo {}
62
63#[derive(Clone, Debug, Deserialize, Serialize)]
64#[serde(rename_all = "camelCase")]
65pub struct LendingInfo {
66 pub coin: String,
67 pub lendable: Decimal,
68 pub locked: Decimal,
69 pub min_rate: Option<Decimal>,
70 pub offered: Decimal,
71}
72
73impl Request for GetLendingInfo {
74 const METHOD: Method = Method::GET;
75 const PATH: &'static str = "/spot_margin/lending_info";
76 const AUTH: bool = true;
77
78 type Response = Vec<LendingInfo>;
79}
80
81#[derive(Debug, Clone, Serialize, Default)]
82pub struct SubmitLendingOffer {
83 pub coin: String,
84 pub size: Decimal,
85 pub rate: Decimal,
86}
87
88impl Request for SubmitLendingOffer {
89 const METHOD: Method = Method::POST;
90 const PATH: &'static str = "/spot_margin/offers";
91 const AUTH: bool = true;
92
93 type Response = ();
94}