#[non_exhaustive]pub struct Quote {
pub last: f64,
pub prev_close: f64,
pub time: DateTime<Utc>,
pub volume: Option<f64>,
pub bid: Option<f64>,
pub ask: Option<f64>,
pub extended: Option<ExtendedHoursQuote>,
}Expand description
The quote of one symbol: its last price and change from the previous close, the session’s
volume, the best bid and ask, and the latest extended-hours trade. Fields the host does not
know stay None.
use egui_charts::model::Quote;
let quote = Quote::new(105.0, 100.0, chrono::Utc::now()).with_bid_ask(104.99, 105.01);
assert_eq!((quote.change(), quote.change_percent()), (5.0, 5.0));Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.last: f64Last traded price of the regular session.
prev_close: f64Close of the previous regular session.
time: DateTime<Utc>When the quote last changed.
volume: Option<f64>Volume traded in the current session.
bid: Option<f64>Best bid.
ask: Option<f64>Best ask.
extended: Option<ExtendedHoursQuote>The latest trade before or after the regular session.
Implementations§
Source§impl Quote
impl Quote
Sourcepub fn new(last: f64, prev_close: f64, time: DateTime<Utc>) -> Self
pub fn new(last: f64, prev_close: f64, time: DateTime<Utc>) -> Self
A quote of last, changed from prev_close, at time.
Sourcepub fn with_volume(self, volume: f64) -> Self
pub fn with_volume(self, volume: f64) -> Self
Sets volume.
Sourcepub fn with_extended(self, extended: ExtendedHoursQuote) -> Self
pub fn with_extended(self, extended: ExtendedHoursQuote) -> Self
Sets extended.
Sourcepub fn change_percent(&self) -> f64
pub fn change_percent(&self) -> f64
The change divided by the absolute previous close, times 100; NaN when the previous close is 0.
Trait Implementations§
impl StructuralPartialEq for Quote
Auto Trait Implementations§
impl Freeze for Quote
impl RefUnwindSafe for Quote
impl Send for Quote
impl Sync for Quote
impl Unpin for Quote
impl UnsafeUnpin for Quote
impl UnwindSafe for Quote
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
Mutably borrows from an owned value. Read more
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,
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> ⓘ
Converts
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> ⓘ
Converts
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