pub struct TradeQuote {
pub trade: Trade,
pub mid: f64,
}Expand description
A trade paired with the mid-price prevailing at execution.
This is the input for spread- and price-impact measures (effective spread, realized spread, Kyle’s lambda), which relate an executed trade to the quote it traded against.
Fields§
§trade: TradeThe executed trade.
mid: f64The mid-price prevailing at execution (strictly positive).
Implementations§
Source§impl TradeQuote
impl TradeQuote
Sourcepub fn new(trade: Trade, mid: f64) -> Result<Self>
pub fn new(trade: Trade, mid: f64) -> Result<Self>
Construct a trade-quote, validating that mid is finite and strictly
positive. The trade is assumed already valid.
§Errors
Returns Error::InvalidTrade if mid is not a finite positive
number.
Sourcepub const fn new_unchecked(trade: Trade, mid: f64) -> Self
pub const fn new_unchecked(trade: Trade, mid: f64) -> Self
Construct a trade-quote without validation. The caller asserts that
mid is finite and positive.
Trait Implementations§
Source§impl Clone for TradeQuote
impl Clone for TradeQuote
Source§fn clone(&self) -> TradeQuote
fn clone(&self) -> TradeQuote
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TradeQuote
impl Debug for TradeQuote
Source§impl PartialEq for TradeQuote
impl PartialEq for TradeQuote
Source§fn eq(&self, other: &TradeQuote) -> bool
fn eq(&self, other: &TradeQuote) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for TradeQuote
impl StructuralPartialEq for TradeQuote
Auto Trait Implementations§
impl Freeze for TradeQuote
impl RefUnwindSafe for TradeQuote
impl Send for TradeQuote
impl Sync for TradeQuote
impl Unpin for TradeQuote
impl UnsafeUnpin for TradeQuote
impl UnwindSafe for TradeQuote
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,
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