bybit/http/
spot_margin_trade.rs1use rust_decimal::Decimal;
2use serde::{Deserialize, Serialize};
3
4use crate::SpotMarginMode;
5
6#[derive(Debug, Serialize, Clone)]
14#[serde(rename_all = "camelCase")]
15pub struct SwitchSpotMarginModeRequest {
16 pub spot_margin_mode: SpotMarginMode,
17}
18
19impl SwitchSpotMarginModeRequest {
20 pub fn enable() -> Self {
21 Self {
22 spot_margin_mode: SpotMarginMode::Enabled,
23 }
24 }
25
26 pub fn disable() -> Self {
27 Self {
28 spot_margin_mode: SpotMarginMode::Disabled,
29 }
30 }
31}
32
33#[derive(Debug, Deserialize, PartialEq)]
34#[serde(rename_all = "camelCase")]
35pub struct SwitchSpotMarginModeResult {
36 pub spot_margin_mode: SpotMarginMode,
37}
38
39#[derive(Debug, Serialize, Clone)]
47#[serde(rename_all = "camelCase")]
48pub struct SetSpotMarginLeverageRequest {
49 pub leverage: Decimal,
51 #[serde(skip_serializing_if = "Option::is_none")]
53 pub currency: Option<String>,
54}
55
56impl SetSpotMarginLeverageRequest {
57 pub fn new(leverage: Decimal) -> Self {
58 Self {
59 leverage,
60 currency: None,
61 }
62 }
63
64 pub fn with_currency(mut self, v: String) -> Self {
65 self.currency = Some(v);
66 self
67 }
68}