#[non_exhaustive]pub struct Price<F: Format = Both> {Show 40 fields
pub max_age: Option<i64>,
pub pre_market_change_percent: Option<F::Value<f64>>,
pub pre_market_change: Option<F::Value<f64>>,
pub pre_market_time: Option<i64>,
pub pre_market_price: Option<F::Value<f64>>,
pub pre_market_source: Option<String>,
pub post_market_change_percent: Option<F::Value<f64>>,
pub post_market_change: Option<F::Value<f64>>,
pub post_market_time: Option<i64>,
pub post_market_price: Option<F::Value<f64>>,
pub post_market_source: Option<String>,
pub regular_market_change_percent: Option<F::Value<f64>>,
pub regular_market_change: Option<F::Value<f64>>,
pub regular_market_time: Option<i64>,
pub price_hint: Option<F::Value<i64>>,
pub regular_market_price: Option<F::Value<f64>>,
pub regular_market_day_high: Option<F::Value<f64>>,
pub regular_market_day_low: Option<F::Value<f64>>,
pub regular_market_volume: Option<F::Value<i64>>,
pub average_daily_volume10_day: Option<F::Value<i64>>,
pub average_daily_volume3_month: Option<F::Value<i64>>,
pub regular_market_previous_close: Option<F::Value<f64>>,
pub regular_market_source: Option<String>,
pub regular_market_open: Option<F::Value<f64>>,
pub exchange: Option<String>,
pub exchange_name: Option<String>,
pub exchange_data_delayed_by: Option<i32>,
pub market_state: Option<String>,
pub quote_type: Option<String>,
pub symbol: Option<String>,
pub underlying_symbol: Option<String>,
pub short_name: Option<String>,
pub long_name: Option<String>,
pub currency: Option<String>,
pub quote_source_name: Option<String>,
pub currency_symbol: Option<String>,
pub from_currency: Option<String>,
pub to_currency: Option<String>,
pub last_market: Option<String>,
pub market_cap: Option<F::Value<i64>>,
}Expand description
Detailed pricing data for a stock
Includes current price, pre/post market data, volume, market cap, and exchange information.
The type parameter F controls how numeric fields are represented:
Price/Price<Both>— default; fields holdFormattedValue<T>Price<Raw>— fields holdTdirectly (e.g.Option<f64>)Price<Pretty>— fields holdOption<String>(human-readable)
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_age: Option<i64>Maximum age of the data in seconds
pre_market_change_percent: Option<F::Value<f64>>Pre-market change percentage
pre_market_change: Option<F::Value<f64>>Pre-market change value
pre_market_time: Option<i64>Pre-market time as Unix timestamp
pre_market_price: Option<F::Value<f64>>Pre-market price
pre_market_source: Option<String>Pre-market data source
post_market_change_percent: Option<F::Value<f64>>Post-market change percentage
post_market_change: Option<F::Value<f64>>Post-market change value
post_market_time: Option<i64>Post-market time as Unix timestamp
post_market_price: Option<F::Value<f64>>Post-market price
post_market_source: Option<String>Post-market data source
regular_market_change_percent: Option<F::Value<f64>>Regular market change percentage
regular_market_change: Option<F::Value<f64>>Regular market change value
regular_market_time: Option<i64>Regular market time as Unix timestamp
price_hint: Option<F::Value<i64>>Price hint for decimal places
regular_market_price: Option<F::Value<f64>>Current regular market price
regular_market_day_high: Option<F::Value<f64>>Regular market day high
regular_market_day_low: Option<F::Value<f64>>Regular market day low
regular_market_volume: Option<F::Value<i64>>Regular market volume
average_daily_volume10_day: Option<F::Value<i64>>Average daily volume over 10 days
average_daily_volume3_month: Option<F::Value<i64>>Average daily volume over 3 months
regular_market_previous_close: Option<F::Value<f64>>Regular market previous close
regular_market_source: Option<String>Regular market data source
regular_market_open: Option<F::Value<f64>>Regular market open price
exchange: Option<String>Exchange code (e.g., “NMS” for NASDAQ)
exchange_name: Option<String>Exchange name (e.g., “NasdaqGS”)
exchange_data_delayed_by: Option<i32>Exchange data delay in seconds
market_state: Option<String>Current market state (e.g., “REGULAR”, “POST”, “PRE”)
quote_type: Option<String>Quote type (e.g., “EQUITY”, “ETF”, “MUTUALFUND”)
symbol: Option<String>Stock symbol
underlying_symbol: Option<String>Underlying symbol (for derivatives)
short_name: Option<String>Short name of the security
long_name: Option<String>Long name of the security
currency: Option<String>Currency code (e.g., “USD”)
quote_source_name: Option<String>Quote source name
currency_symbol: Option<String>Currency symbol (e.g., “$”)
from_currency: Option<String>From currency (for currency pairs)
to_currency: Option<String>To currency (for currency pairs)
last_market: Option<String>Last market
market_cap: Option<F::Value<i64>>Market capitalization
Implementations§
Source§impl Price<Both>
impl Price<Both>
Source§impl Price<Both>
impl Price<Both>
Sourcepub fn current_price(&self) -> Option<f64>
pub fn current_price(&self) -> Option<f64>
Returns the current price (regular market price)
Sourcepub fn day_change(&self) -> Option<f64>
pub fn day_change(&self) -> Option<f64>
Returns the day’s change in price
Sourcepub fn day_change_percent(&self) -> Option<f64>
pub fn day_change_percent(&self) -> Option<f64>
Returns the day’s change as a percentage
Sourcepub fn is_market_open(&self) -> bool
pub fn is_market_open(&self) -> bool
Returns whether the market is currently open
Sourcepub fn is_pre_market(&self) -> bool
pub fn is_pre_market(&self) -> bool
Returns whether this is in pre-market trading
Sourcepub fn is_post_market(&self) -> bool
pub fn is_post_market(&self) -> bool
Returns whether this is in post-market trading
Sourcepub fn live_price(&self) -> Option<f64>
pub fn live_price(&self) -> Option<f64>
Returns the most relevant current price based on market state
Returns post-market price if in post-market, pre-market price if in pre-market, otherwise regular market price.
Trait Implementations§
Source§impl<'de, F: Format> Deserialize<'de> for Price<F>
impl<'de, F: Format> Deserialize<'de> for Price<F>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<F: PartialEq + Format> StructuralPartialEq for Price<F>
Source§impl<F: Format> Translatable for Price<F>
impl<F: Format> Translatable for Price<F>
Source§fn visit_translatable(&mut self, visit: &mut dyn FnMut(&mut String))
fn visit_translatable(&mut self, visit: &mut dyn FnMut(&mut String))
Source§fn after_translate(&mut self)
fn after_translate(&mut self)
Auto Trait Implementations§
impl<F> Freeze for Price<F>
impl<F> RefUnwindSafe for Price<F>where
Option<<F as Format>::Value<f64>>: RefUnwindSafe,
Option<<F as Format>::Value<i64>>: RefUnwindSafe,
impl<F> Send for Price<F>
impl<F> Sync for Price<F>
impl<F> Unpin for Price<F>
impl<F> UnsafeUnpin for Price<F>where
Option<<F as Format>::Value<f64>>: UnsafeUnpin,
Option<<F as Format>::Value<i64>>: UnsafeUnpin,
impl<F> UnwindSafe for Price<F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more