Skip to main content

rust_okx/api/account/requests/
settings.rs

1use serde::Serialize;
2
3/// Request for [`set_position_mode`](crate::api::account::Account::set_position_mode).
4#[derive(Debug, Clone, Serialize)]
5pub struct SetPositionModeRequest<'a> {
6    /// Position mode: `"long_short_mode"` or `"net_mode"`.
7    #[serde(rename = "posMode")]
8    pub pos_mode: &'a str,
9}
10
11/// Request for [`set_greeks`](crate::api::account::Account::set_greeks).
12#[derive(Debug, Clone, Serialize)]
13pub struct SetGreeksRequest<'a> {
14    /// Greeks display type: `"PA"` (coin) or `"BS"` (Black-Scholes).
15    #[serde(rename = "greeksType")]
16    pub greeks_type: &'a str,
17}
18
19/// Request for [`set_isolated_mode`](crate::api::account::Account::set_isolated_mode).
20#[derive(Debug, Clone, Serialize)]
21pub struct SetIsolatedModeRequest<'a> {
22    /// Isolated margin mode: `"automatic"` or `"autonomy"`.
23    #[serde(rename = "isoMode")]
24    pub iso_mode: &'a str,
25    /// Instrument type scope: `"MARGIN"` or `"CONTRACTS"`.
26    #[serde(rename = "type")]
27    pub mode_type: &'a str,
28}
29
30/// Request for [`set_auto_loan`](crate::api::account::Account::set_auto_loan).
31#[derive(Debug, Clone, Serialize)]
32pub struct SetAutoLoanRequest {
33    /// `true` to enable automatic borrowing; `false` to disable.
34    #[serde(rename = "autoLoan")]
35    pub auto_loan: bool,
36}
37
38/// Request for [`set_account_level`](crate::api::account::Account::set_account_level).
39#[derive(Debug, Clone, Serialize)]
40pub struct SetAccountLevelRequest<'a> {
41    /// Target account level, e.g. `"1"` (simple), `"2"` (single-currency margin), etc.
42    #[serde(rename = "acctLv")]
43    pub acct_lv: &'a str,
44}