Skip to main content

finance_query/models/chart/
candle.rs

1/// Candle module
2///
3/// Contains the OHLCV candle/bar structure.
4use serde::{Deserialize, Serialize};
5
6/// A single OHLCV candle/bar
7///
8/// Note: This struct cannot be manually constructed - obtain via `Ticker::chart()`.
9#[non_exhaustive]
10#[derive(Debug, Clone, Serialize, Deserialize)]
11#[serde(rename_all = "camelCase")]
12#[cfg_attr(feature = "dataframe", derive(crate::ToDataFrame))]
13pub struct Candle {
14    /// Timestamp (Unix)
15    pub timestamp: i64,
16    /// Open price
17    pub open: f64,
18    /// High price
19    pub high: f64,
20    /// Low price
21    pub low: f64,
22    /// Close price
23    pub close: f64,
24    /// Volume
25    pub volume: i64,
26    /// Adjusted close (if available)
27    pub adj_close: Option<f64>,
28}