pub struct BestBidAsk {
pub instrument_id: InstrumentId,
pub bid_price: Decimal,
pub bid_size: Decimal,
pub ask_price: Decimal,
pub ask_size: Decimal,
pub exchange_timestamp_ns: u64,
pub local_timestamp_ns: u64,
}Expand description
Best bid and ask prices (top-of-book quote)
Represents the current best bid and ask prices available in the market. This is the most basic market data structure, showing the tightest spread.
Fields§
§instrument_id: InstrumentIdThe instrument this quote is for
bid_price: DecimalBest bid price (highest buy price)
bid_size: DecimalBest bid size
ask_price: DecimalBest ask price (lowest sell price)
ask_size: DecimalBest ask size
exchange_timestamp_ns: u64Exchange timestamp (nanoseconds)
local_timestamp_ns: u64Local receive timestamp (nanoseconds)
Implementations§
Source§impl BestBidAsk
impl BestBidAsk
Sourcepub const fn new(
instrument_id: InstrumentId,
bid_price: Decimal,
bid_size: Decimal,
ask_price: Decimal,
ask_size: Decimal,
exchange_timestamp_ns: u64,
local_timestamp_ns: u64,
) -> Self
pub const fn new( instrument_id: InstrumentId, bid_price: Decimal, bid_size: Decimal, ask_price: Decimal, ask_size: Decimal, exchange_timestamp_ns: u64, local_timestamp_ns: u64, ) -> Self
Create a new best bid/ask quote
Sourcepub fn spread_percentage(&self) -> Option<Decimal>
pub fn spread_percentage(&self) -> Option<Decimal>
Calculate the spread as a percentage of mid price
Trait Implementations§
Source§impl Clone for BestBidAsk
impl Clone for BestBidAsk
Source§fn clone(&self) -> BestBidAsk
fn clone(&self) -> BestBidAsk
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BestBidAsk
impl Debug for BestBidAsk
Source§impl Hash for BestBidAsk
impl Hash for BestBidAsk
Source§impl PartialEq for BestBidAsk
impl PartialEq for BestBidAsk
impl Eq for BestBidAsk
impl StructuralPartialEq for BestBidAsk
Auto Trait Implementations§
impl Freeze for BestBidAsk
impl RefUnwindSafe for BestBidAsk
impl Send for BestBidAsk
impl Sync for BestBidAsk
impl Unpin for BestBidAsk
impl UnwindSafe for BestBidAsk
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.