Skip to main content

Quote

Struct Quote 

Source
#[non_exhaustive]
pub struct Quote { pub mark: Option<Price>, pub bid: Option<Price>, pub ask: Option<Price>, }
Expand description

Current market snapshot for an instrument.

Every field is optional: producers publish only the fields they actually have. How a Quote interacts with the slot’s previously stored value is chosen by the publisher when calling the service:

  • MarketDataService::push replaces the entire snapshot - any field left as None in the new quote is cleared from the slot.
  • MarketDataService::push_patch merges the new quote into the existing snapshot - None fields preserve the prior value, Some fields overwrite it.

In either case the slot’s publish instant is bumped to the current time.

#[non_exhaustive] keeps the door open for further optional fields in future releases.

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.
§mark: Option<Price>

Mark price.

§bid: Option<Price>

Best-bid price.

§ask: Option<Price>

Best-ask price.

Implementations§

Source§

impl Quote

Source

pub fn new() -> Self

Creates an empty quote with all fields unset.

Source

pub fn with_mark(self, mark: Price) -> Self

Sets the mark price.

Source

pub fn with_bid(self, bid: Price) -> Self

Sets the best-bid price.

Source

pub fn with_ask(self, ask: Price) -> Self

Sets the best-ask price.

Trait Implementations§

Source§

impl Clone for Quote

Source§

fn clone(&self) -> Quote

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Quote

Source§

impl Debug for Quote

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Quote

Source§

fn default() -> Quote

Returns the “default value” for a type. Read more
Source§

impl Eq for Quote

Source§

impl PartialEq for Quote

Source§

fn eq(&self, other: &Quote) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.