fmp_rs/models/
quote.rs

1//! Quote data models.
2
3use serde::{Deserialize, Serialize};
4
5/// Full stock quote
6#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
7#[serde(rename_all = "camelCase")]
8pub struct StockQuote {
9    pub symbol: String,
10    pub name: String,
11    pub price: f64,
12    pub changes_percentage: f64,
13    pub change: f64,
14    pub day_low: f64,
15    pub day_high: f64,
16    pub year_high: f64,
17    pub year_low: f64,
18    pub market_cap: Option<i64>,
19    pub price_avg50: f64,
20    pub price_avg200: f64,
21    pub exchange: String,
22    pub volume: i64,
23    pub avg_volume: i64,
24    pub open: f64,
25    pub previous_close: f64,
26    pub eps: Option<f64>,
27    pub pe: Option<f64>,
28    pub earnings_announcement: Option<String>,
29    pub shares_outstanding: Option<i64>,
30    pub timestamp: i64,
31}
32
33/// Short-form quote with essential information
34#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
35pub struct ShortQuote {
36    pub symbol: String,
37    pub price: f64,
38    pub volume: i64,
39}
40
41/// Price change data
42#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
43#[serde(rename_all = "camelCase")]
44pub struct PriceChange {
45    pub symbol: String,
46    #[serde(rename = "1D")]
47    pub one_day: Option<f64>,
48    #[serde(rename = "5D")]
49    pub five_day: Option<f64>,
50    #[serde(rename = "1M")]
51    pub one_month: Option<f64>,
52    #[serde(rename = "3M")]
53    pub three_month: Option<f64>,
54    #[serde(rename = "6M")]
55    pub six_month: Option<f64>,
56    #[serde(rename = "ytd")]
57    pub year_to_date: Option<f64>,
58    #[serde(rename = "1Y")]
59    pub one_year: Option<f64>,
60    #[serde(rename = "3Y")]
61    pub three_year: Option<f64>,
62    #[serde(rename = "5Y")]
63    pub five_year: Option<f64>,
64    #[serde(rename = "10Y")]
65    pub ten_year: Option<f64>,
66    #[serde(rename = "max")]
67    pub max: Option<f64>,
68}