bybit/models/
open_interest.rs

1use crate::prelude::*;
2
3/// Represents a single open interest record.
4///
5/// Each record provides the open interest (total outstanding contracts) for a specific time interval in a perpetual futures contract. Bots use this to assess market sentiment, as rising open interest may indicate new positions and potential price momentum, while declining open interest may signal position unwinding.
6#[derive(Serialize, Deserialize, Clone, Debug)]
7#[serde(rename_all = "camelCase")]
8pub struct OpenInterest {
9    /// The open interest quantity (in base asset).
10    ///
11    /// The total number of outstanding contracts in the base asset (e.g., BTC in `BTCUSDT`). Bots use this to gauge market participation, as high open interest suggests strong liquidity and potential for larger price moves in perpetual futures. Parse to `f64` for calculations.
12    #[serde(with = "string_to_float")]
13    pub open_interest: f64,
14
15    /// The timestamp of the open interest record (Unix timestamp in milliseconds).
16    ///
17    /// Indicates when the open interest was recorded. Bots use this to align open interest data with price or trade data for time-series analysis and to track changes over time.
18    #[serde(with = "string_to_u64")]
19    pub timestamp: u64,
20}