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 [`Providers::forex`](crate::Providers::forex) then
11/// [`.quote()`](crate::domains::ForexPair::quote).
12#[derive(Debug, Clone, Serialize, Deserialize)]
13#[non_exhaustive]
14pub struct ForexQuote {
15 /// Currency pair symbol (e.g., `"EURUSD"`, `"BTCUSD"`)
16 pub symbol: String,
17 /// Base currency code (e.g., `"EUR"`)
18 pub base_currency: Option<String>,
19 /// Quote currency code (e.g., `"USD"`)
20 pub quote_currency: Option<String>,
21 /// Current exchange rate (bid)
22 pub bid: Option<f64>,
23 /// Ask price
24 pub ask: Option<f64>,
25 /// Midpoint or last traded price
26 pub price: Option<f64>,
27 /// Price change
28 pub change: Option<f64>,
29 /// Price change percentage
30 pub change_percent: Option<f64>,
31 /// Unix timestamp of the last update
32 pub timestamp: Option<i64>,
33}