fmp_rs/models/
indexes.rs

1//! Models for indexes endpoints
2
3use serde::{Deserialize, Serialize};
4
5/// Market index symbol information
6#[derive(Debug, Clone, Serialize, Deserialize)]
7#[serde(rename_all = "camelCase")]
8pub struct IndexSymbol {
9    /// Symbol (e.g., "^GSPC", "^DJI", "^IXIC")
10    pub symbol: String,
11    /// Index name
12    pub name: Option<String>,
13    /// Currency
14    pub currency: Option<String>,
15    /// Stock exchange
16    pub stock_exchange: Option<String>,
17    /// Exchange short name
18    pub exchange_short_name: Option<String>,
19}
20
21/// Market index quote
22#[derive(Debug, Clone, Serialize, Deserialize)]
23#[serde(rename_all = "camelCase")]
24pub struct IndexQuote {
25    /// Symbol
26    pub symbol: String,
27    /// Name
28    pub name: Option<String>,
29    /// Current price/level
30    pub price: Option<f64>,
31    /// Price change
32    pub change: Option<f64>,
33    /// Percent change
34    pub changes_percentage: Option<f64>,
35    /// Day low
36    pub day_low: Option<f64>,
37    /// Day high
38    pub day_high: Option<f64>,
39    /// Year low
40    pub year_low: Option<f64>,
41    /// Year high
42    pub year_high: Option<f64>,
43    /// Open price
44    pub open: Option<f64>,
45    /// Previous close
46    pub previous_close: Option<f64>,
47    /// Timestamp
48    pub timestamp: Option<i64>,
49}
50
51/// Historical index data
52#[derive(Debug, Clone, Serialize, Deserialize)]
53#[serde(rename_all = "camelCase")]
54pub struct IndexHistorical {
55    /// Date
56    pub date: String,
57    /// Open level
58    pub open: f64,
59    /// High level
60    pub high: f64,
61    /// Low level
62    pub low: f64,
63    /// Close level
64    pub close: f64,
65    /// Adjusted close
66    pub adj_close: Option<f64>,
67    /// Volume (if applicable)
68    pub volume: Option<f64>,
69}
70
71/// Index constituent (component stock)
72#[derive(Debug, Clone, Serialize, Deserialize)]
73#[serde(rename_all = "camelCase")]
74pub struct IndexConstituent {
75    /// Stock symbol
76    pub symbol: String,
77    /// Company name
78    pub name: Option<String>,
79    /// Sector
80    pub sector: Option<String>,
81    /// Sub-sector
82    pub sub_sector: Option<String>,
83    /// Headquarters location
84    pub headquarters_location: Option<String>,
85    /// Date first added
86    pub date_first_added: Option<String>,
87    /// CIK number
88    pub cik: Option<String>,
89    /// Date founded
90    pub founded: Option<String>,
91}