pub struct Trade {
pub price: f64,
pub size: f64,
pub side: Side,
pub timestamp: i64,
}Expand description
A single executed trade with an aggressor side.
Fields§
§price: f64Execution price (strictly positive).
size: f64Executed size / quantity (non-negative).
side: SideAggressor side.
timestamp: i64Trade timestamp (caller-defined epoch / resolution).
Implementations§
Source§impl Trade
impl Trade
Sourcepub fn new(price: f64, size: f64, side: Side, timestamp: i64) -> Result<Self>
pub fn new(price: f64, size: f64, side: Side, timestamp: i64) -> Result<Self>
Construct a trade, validating that price is finite and strictly
positive and size is finite and non-negative.
§Errors
Returns Error::InvalidTrade if the price is not a finite positive
number, or the size is not a finite non-negative number.
Trait Implementations§
impl Copy for Trade
impl StructuralPartialEq for Trade
Auto Trait Implementations§
impl Freeze for Trade
impl RefUnwindSafe for Trade
impl Send for Trade
impl Sync for Trade
impl Unpin for Trade
impl UnsafeUnpin for Trade
impl UnwindSafe for Trade
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