finance_query/models/forex/mod.rs
1//! Forex (foreign exchange) market data models.
2//!
3//! Canonical public types for currency pair quotes and exchange rates,
4//! shared across Polygon, FMP, and Alpha Vantage providers.
5
6use serde::{Deserialize, Serialize};
7
8/// A forex currency pair quote (e.g., EUR/USD).
9///
10/// Obtain via [`Ticker::forex_quote`](crate::Ticker::forex_quote).
11#[derive(Debug, Clone, Serialize, Deserialize)]
12#[non_exhaustive]
13pub struct ForexQuote {
14 /// Currency pair symbol (e.g., `"EURUSD"`, `"BTCUSD"`)
15 pub symbol: String,
16 /// Base currency code (e.g., `"EUR"`)
17 pub base_currency: Option<String>,
18 /// Quote currency code (e.g., `"USD"`)
19 pub quote_currency: Option<String>,
20 /// Current exchange rate (bid)
21 pub bid: Option<f64>,
22 /// Ask price
23 pub ask: Option<f64>,
24 /// Midpoint or last traded price
25 pub price: Option<f64>,
26 /// Price change
27 pub change: Option<f64>,
28 /// Price change percentage
29 pub change_percent: Option<f64>,
30 /// Unix timestamp of the last update
31 pub timestamp: Option<i64>,
32}