1use crate::order::Side;
2use rust_decimal::Decimal;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6#[serde(rename_all = "camelCase")]
7pub struct AccountSettings {
8 pub auto_borrow_settlements: bool,
9 pub auto_lend: bool,
10 pub auto_realize_pnl: bool,
11 pub auto_repay_borrows: bool,
12 pub borrow_limit: Decimal,
13 pub futures_maker_fee: Decimal,
14 pub futures_taker_fee: Decimal,
15 pub leverage_limit: Decimal,
16 pub limit_orders: u32,
17 pub liquidating: bool,
18 pub position_limit: Decimal,
19 pub spot_maker_fee: Decimal,
20 pub spot_taker_fee: Decimal,
21 pub trigger_orders: u32,
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
25#[serde(rename_all = "camelCase")]
26pub struct AccountMaxBorrow {
27 pub max_borrow_quantity: Decimal,
28 pub symbol: String,
29}
30
31#[derive(Debug, Clone, Serialize, Deserialize)]
32#[serde(rename_all = "camelCase")]
33pub struct AccountMaxWithdrawal {
34 pub auto_borrow: Option<bool>,
35 pub auto_lend_redeem: Option<bool>,
36 pub max_withdrawal_quantity: Decimal,
37 pub symbol: String,
38}
39
40#[derive(Debug, Clone, Serialize, Deserialize, Default)]
41#[serde(rename_all = "camelCase")]
42pub struct UpdateAccountPayload {
43 #[serde(skip_serializing_if = "Option::is_none")]
44 pub auto_borrow_settlements: Option<bool>,
45 #[serde(skip_serializing_if = "Option::is_none")]
46 pub auto_lend: Option<bool>,
47 #[serde(skip_serializing_if = "Option::is_none")]
48 pub auto_repay_borrows: Option<bool>,
49 #[serde(skip_serializing_if = "Option::is_none")]
50 pub leverage_limit: Option<Decimal>,
51}
52
53#[derive(Debug, Clone, Serialize, Deserialize, Default)]
54#[serde(rename_all = "camelCase")]
55pub struct ConvertDustPayload {
56 #[serde(skip_serializing_if = "Option::is_none")]
57 pub symbol: Option<String>,
58}
59
60#[derive(Debug, Clone, Serialize, Deserialize)]
61#[serde(rename_all = "camelCase")]
62pub struct AccountMaxOrder {
63 pub max_order_quantity: Decimal,
64 pub symbol: String,
65 pub side: Side,
66 #[serde(skip_serializing_if = "Option::is_none")]
67 pub price: Option<Decimal>,
68 #[serde(skip_serializing_if = "Option::is_none")]
69 pub reduce_only: Option<bool>,
70 #[serde(skip_serializing_if = "Option::is_none")]
71 pub auto_borrow: Option<bool>,
72 #[serde(skip_serializing_if = "Option::is_none")]
73 pub auto_borrow_repay: Option<bool>,
74 #[serde(skip_serializing_if = "Option::is_none")]
75 pub auto_lend_redeem: Option<bool>,
76}
77
78#[derive(Debug, Clone, Serialize, Deserialize)]
80#[serde(rename_all = "camelCase")]
81pub struct MaxOrderQuery {
82 symbol: String,
83 side: Side,
84 #[serde(skip_serializing_if = "Option::is_none")]
85 price: Option<Decimal>,
86 #[serde(skip_serializing_if = "Option::is_none")]
87 reduce_only: Option<bool>,
88 #[serde(skip_serializing_if = "Option::is_none")]
89 auto_borrow: Option<bool>,
90 #[serde(skip_serializing_if = "Option::is_none")]
91 auto_borrow_repay: Option<bool>,
92 #[serde(skip_serializing_if = "Option::is_none")]
93 auto_lend_redeem: Option<bool>,
94}
95
96impl MaxOrderQuery {
97 pub fn new<S: Into<String>>(symbol: S, side: Side) -> Self {
98 Self {
99 symbol: symbol.into(),
100 side,
101 price: None,
102 reduce_only: None,
103 auto_borrow: None,
104 auto_borrow_repay: None,
105 auto_lend_redeem: None,
106 }
107 }
108
109 pub fn with_price(mut self, price: Decimal) -> Self {
110 self.price = Some(price);
111 self
112 }
113
114 pub fn with_reduce_only(mut self, reduce_only: bool) -> Self {
115 self.reduce_only = Some(reduce_only);
116 self
117 }
118
119 pub fn with_auto_borrow(mut self, auto_borrow: bool) -> Self {
120 self.auto_borrow = Some(auto_borrow);
121 self
122 }
123
124 pub fn with_auto_borrow_repay(mut self, auto_borrow_repay: bool) -> Self {
125 self.auto_borrow_repay = Some(auto_borrow_repay);
126 self
127 }
128
129 pub fn with_auto_lend_redeem(mut self, auto_lend_redeem: bool) -> Self {
130 self.auto_lend_redeem = Some(auto_lend_redeem);
131 self
132 }
133}