Skip to main content

bybit/models/
reason_object.rs

1use crate::prelude::*;
2
3/// Represents a single reason for a margin mode change outcome.
4///
5/// Part of the `MarginModeResult`, this struct details a specific reason for the success or failure of the margin mode change. Bots use this for error handling and debugging.
6#[derive(Debug, Serialize, Deserialize, Clone)]
7#[serde(rename_all = "camelCase")]
8pub struct ReasonObject {
9    /// The reason code for the outcome.
10    ///
11    /// A code indicating the specific reason for success or failure (e.g., "10001" for invalid settings). Bots use this to implement targeted error handling.
12    pub reason_code: String,
13
14    /// A human-readable message describing the reason.
15    ///
16    /// Provides context for the `reason_code`, such as `"Cannot change mode with open positions"`. Bots should log this for debugging and user feedback.
17    pub reason_msg: String,
18}