Skip to main content

bybit/models/
collateral_info.rs

1use crate::prelude::*;
2
3/// Represents collateral information for a single coin.
4///
5/// Details the collateral eligibility, borrowing limits, and rates for a specific coin. Bots use this to determine which coins to use as collateral and manage borrowing costs.
6#[derive(Debug, Serialize, Deserialize, Clone)]
7#[serde(rename_all = "camelCase")]
8pub struct CollateralInfo {
9    /// The amount available to borrow for the coin.
10    ///
11    /// The total borrowing capacity for the coin, in the coin’s units. Bots use this to assess borrowing potential for margin trading.
12    pub available_to_borrow: String,
13
14    /// The free borrowing amount available.
15    ///
16    /// The portion of the borrowing capacity that is interest-free, if any. Bots use this to optimize borrowing by prioritizing free borrowing.
17    #[serde(with = "string_to_float")]
18    pub free_borrowing_amount: f64,
19
20    /// The free borrow amount limit.
21    ///
22    /// The maximum interest-free borrowing limit for the coin. Bots use this to plan borrowing strategies within free limits.
23    #[serde(with = "string_to_float")]
24    pub free_borrow_amount: f64,
25
26    /// The maximum borrowing amount for the coin.
27    ///
28    /// The total borrowing limit for the coin, including interest-bearing amounts. Bots use this to ensure borrowing stays within account limits.
29    #[serde(with = "string_to_float")]
30    pub max_borrowing_amount: f64,
31
32    /// The hourly borrow rate for the coin.
33    ///
34    /// The interest rate applied to borrowed amounts per hour, as a decimal (e.g., 0.0001 for 0.01%). Bots use this to calculate borrowing costs.
35    #[serde(with = "string_to_float")]
36    pub hourly_borrow_rate: f64,
37
38    /// The borrow usage rate.
39    ///
40    /// The percentage of the borrowing limit currently utilized. Bots use this to monitor borrowing capacity and avoid over-leveraging.
41    #[serde(with = "string_to_float")]
42    pub borrow_usage_rate: f64,
43
44    /// Whether the coin is enabled as collateral.
45    ///
46    /// `true` if the coin can be used as collateral for margin trading, `false` otherwise. Bots use this to select appropriate collateral assets.
47    pub collateral_switch: bool,
48
49    /// The current borrowed amount for the coin.
50    ///
51    /// The total amount of the coin currently borrowed. Bots use this to track liabilities and calculate interest costs.
52    #[serde(with = "string_to_float")]
53    pub borrow_amount: f64,
54
55    /// Whether the coin is borrowable.
56    ///
57    /// `true` if the coin can be borrowed for margin trading, `false` otherwise. Bots use this to determine borrowing eligibility.
58    pub borrowable: bool,
59
60    /// The currency of the coin (e.g., "USDT").
61    ///
62    /// Specifies the coin type. Bots should verify this matches the expected currency for their margin type.
63    pub currency: String,
64
65    /// Whether the coin is used as margin collateral.
66    ///
67    /// `true` if the coin is actively used as collateral, `false` otherwise. Bots use this to confirm collateral allocation.
68    pub margin_collateral: bool,
69
70    /// The free borrowing limit as a string.
71    ///
72    /// The maximum interest-free borrowing limit for the coin, represented as a string. Bots can use this for precise borrowing calculations.
73    pub free_borrowing_limit: String,
74
75    /// The collateral ratio for the coin.
76    ///
77    /// The ratio at which the coin contributes to margin requirements (e.g., "0.9" for 90%). Bots use this to calculate effective collateral value.
78    pub collateral_ratio: String,
79}