#[repr(align(64))]pub struct MarketTrade {
pub timestamp: Instant,
pub exchange_time_ns: u64,
pub price: Decimal,
pub quantity: Decimal,
pub direction: OrderSide,
pub instrument_id: InstrumentId,
}Expand description
Represents a single executed trade in the market
Cache-aligned structure for optimal memory access patterns in HFT systems. Contains all essential information about a market trade/transaction.
Fields§
§timestamp: InstantHigh-resolution timestamp using quanta.
exchange_time_ns: u64Exchange-provided timestamp (nanoseconds).
price: DecimalTrade price.
quantity: DecimalTrade quantity.
direction: OrderSideBuy or Sell side.
instrument_id: InstrumentIdReference to the traded instrument.
Implementations§
Source§impl MarketTrade
impl MarketTrade
Sourcepub fn new(
price: Decimal,
quantity: Decimal,
direction: OrderSide,
instrument_id: InstrumentId,
clock: &Clock,
exchange_time_ns: u64,
) -> Self
pub fn new( price: Decimal, quantity: Decimal, direction: OrderSide, instrument_id: InstrumentId, clock: &Clock, exchange_time_ns: u64, ) -> Self
Creates a new trade with current timestamp
Sourcepub fn latency(&self) -> Option<u64>
pub fn latency(&self) -> Option<u64>
Get the latency between exchange time and local time (in nanoseconds)
Sourcepub fn notional_value(&self) -> Decimal
pub fn notional_value(&self) -> Decimal
Get the notional value (price * quantity) of this trade
Trait Implementations§
Source§impl Clone for MarketTrade
impl Clone for MarketTrade
Source§fn clone(&self) -> MarketTrade
fn clone(&self) -> MarketTrade
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 MarketTrade
impl Debug for MarketTrade
Source§impl PartialEq for MarketTrade
impl PartialEq for MarketTrade
impl Eq for MarketTrade
impl StructuralPartialEq for MarketTrade
Auto Trait Implementations§
impl Freeze for MarketTrade
impl RefUnwindSafe for MarketTrade
impl Send for MarketTrade
impl Sync for MarketTrade
impl Unpin for MarketTrade
impl UnwindSafe for MarketTrade
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.