Skip to main content

finance_query/models/futures/
mod.rs

1//! Futures market data models.
2//!
3//! Canonical public types for futures contracts and quotes,
4//! shared across Yahoo, Polygon, and other futures data providers.
5
6use serde::{Deserialize, Serialize};
7
8/// Commitments of Traders weekly positioning models (CFTC).
9#[cfg(feature = "cftc")]
10pub mod cot;
11
12/// A futures contract quote.
13///
14/// Obtain via [`Providers::futures`](crate::Providers::futures)`(symbol).quote()`.
15#[derive(Debug, Clone, Serialize, Deserialize)]
16#[non_exhaustive]
17pub struct FuturesQuote {
18    /// Contract ticker symbol (e.g., `"ESM26"` for E-mini S&P June 2026)
19    pub symbol: String,
20    /// Human-readable contract name
21    pub name: Option<String>,
22    /// Underlying asset (e.g., `"S&P 500"`, `"Crude Oil"`)
23    pub underlying: Option<String>,
24    /// Exchange where the contract trades
25    pub exchange: Option<String>,
26    /// Contract expiration date as YYYY-MM-DD
27    pub expiration_date: Option<String>,
28    /// Current contract price
29    pub price: Option<f64>,
30    /// Price change
31    pub change: Option<f64>,
32    /// Price change as a percentage (e.g. `9.62` for 9.62%)
33    pub change_percent: Option<f64>,
34    /// Open interest (number of outstanding contracts)
35    pub open_interest: Option<u64>,
36    /// Session volume in contracts
37    pub volume: Option<u64>,
38    /// Unix timestamp of the last update, in **seconds**
39    pub timestamp: Option<i64>,
40}