rust_okx/api/account/requests/
settings.rs1use std::borrow::Cow;
2
3use serde::Serialize;
4
5#[derive(Debug, Clone, Serialize)]
7pub struct SetPositionModeRequest<'a> {
8 #[serde(rename = "posMode")]
9 pos_mode: Cow<'a, str>,
10}
11
12impl<'a> SetPositionModeRequest<'a> {
13 pub fn new(pos_mode: impl Into<Cow<'a, str>>) -> Self {
15 Self {
16 pos_mode: pos_mode.into(),
17 }
18 }
19}
20
21#[derive(Debug, Clone, Serialize)]
23pub struct SetGreeksRequest<'a> {
24 #[serde(rename = "greeksType")]
25 greeks_type: Cow<'a, str>,
26}
27
28impl<'a> SetGreeksRequest<'a> {
29 pub fn new(greeks_type: impl Into<Cow<'a, str>>) -> Self {
31 Self {
32 greeks_type: greeks_type.into(),
33 }
34 }
35}
36
37#[derive(Debug, Clone, Serialize)]
39pub struct SetIsolatedModeRequest<'a> {
40 #[serde(rename = "isoMode")]
41 iso_mode: Cow<'a, str>,
42 #[serde(rename = "type")]
43 mode_type: Cow<'a, str>,
44}
45
46impl<'a> SetIsolatedModeRequest<'a> {
47 pub fn new(iso_mode: impl Into<Cow<'a, str>>, mode_type: impl Into<Cow<'a, str>>) -> Self {
49 Self {
50 iso_mode: iso_mode.into(),
51 mode_type: mode_type.into(),
52 }
53 }
54}
55
56#[derive(Debug, Clone, Serialize)]
58pub struct SetAutoLoanRequest {
59 #[serde(rename = "autoLoan")]
60 auto_loan: bool,
61}
62
63impl SetAutoLoanRequest {
64 pub fn new(auto_loan: bool) -> Self {
66 Self { auto_loan }
67 }
68}
69
70#[derive(Debug, Clone, Serialize)]
72pub struct SetAccountLevelRequest<'a> {
73 #[serde(rename = "acctLv")]
74 acct_lv: Cow<'a, str>,
75}
76
77impl<'a> SetAccountLevelRequest<'a> {
78 pub fn new(acct_lv: impl Into<Cow<'a, str>>) -> Self {
80 Self {
81 acct_lv: acct_lv.into(),
82 }
83 }
84}