use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Period {
Annual,
Quarter,
}
impl Period {
pub fn as_str(&self) -> &'static str {
match self {
Self::Annual => "annual",
Self::Quarter => "quarter",
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct FmpQuote {
pub symbol: String,
pub name: Option<String>,
pub price: Option<f64>,
pub change: Option<f64>,
#[serde(rename = "changesPercentage")]
pub changes_percentage: Option<f64>,
#[serde(rename = "dayLow")]
pub day_low: Option<f64>,
#[serde(rename = "dayHigh")]
pub day_high: Option<f64>,
#[serde(rename = "yearLow")]
pub year_low: Option<f64>,
#[serde(rename = "yearHigh")]
pub year_high: Option<f64>,
#[serde(rename = "marketCap")]
pub market_cap: Option<f64>,
pub volume: Option<f64>,
#[serde(rename = "avgVolume")]
pub avg_volume: Option<f64>,
pub open: Option<f64>,
#[serde(rename = "previousClose")]
pub previous_close: Option<f64>,
pub eps: Option<f64>,
pub pe: Option<f64>,
pub timestamp: Option<i64>,
pub exchange: Option<String>,
#[serde(rename = "earningsAnnouncement")]
pub earnings_announcement: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct HistoricalPrice {
pub date: Option<String>,
pub open: Option<f64>,
pub high: Option<f64>,
pub low: Option<f64>,
pub close: Option<f64>,
#[serde(rename = "adjClose")]
pub adj_close: Option<f64>,
pub volume: Option<f64>,
#[serde(rename = "unadjustedVolume")]
pub unadjusted_volume: Option<f64>,
pub change: Option<f64>,
#[serde(rename = "changePercent")]
pub change_percent: Option<f64>,
pub vwap: Option<f64>,
pub label: Option<String>,
#[serde(rename = "changeOverTime")]
pub change_over_time: Option<f64>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct HistoricalPriceResponse {
pub symbol: Option<String>,
pub historical: Vec<HistoricalPrice>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
#[non_exhaustive]
pub struct IntradayPrice {
pub date: Option<String>,
pub open: Option<f64>,
pub high: Option<f64>,
pub low: Option<f64>,
pub close: Option<f64>,
pub volume: Option<f64>,
}