pub struct Trade {
pub perpetual_id: PerpetualId,
pub taker_account_id: AccountId,
pub taker_request_id: RequestId,
pub taker_side: OrderSide,
pub taker_fee: UD64,
pub taker_builder: Option<BuilderAttribution>,
pub taker_builder_fee: UD64,
pub maker_fills: Vec<MakerFill>,
}Expand description
A complete trade event: one taker matched against one or more makers.
Each TakerTrade represents a single taker order execution that may have
matched against multiple maker orders. The maker_fills vector contains
all individual maker fills that occurred as part of this trade.
Fields§
§perpetual_id: PerpetualIdPerpetual contract ID.
taker_account_id: AccountIdTaker account ID.
taker_request_id: RequestIdTaker request ID.
taker_side: OrderSideTaker side (Bid = buying, Ask = selling).
taker_fee: UD64Taker fee paid (normalized decimal, in collateral token).
taker_builder: Option<BuilderAttribution>Builder the taker order is attributed to, with the fee rate it charges, if any.
taker_builder_fee: UD64Builder fee earned on the taker side (normalized decimal, in collateral token).
Included in Self::taker_fee, so consumers must not add it on top.
maker_fills: Vec<MakerFill>All maker fills matched by this taker order.
Implementations§
Source§impl Trade
impl Trade
Sourcepub fn total_size(&self) -> UD64
pub fn total_size(&self) -> UD64
Total size filled across all makers.
Sourcepub fn avg_price(&self) -> Option<UD64>
pub fn avg_price(&self) -> Option<UD64>
Volume-weighted average price across all maker fills.
Returns None if there are no fills.
Sourcepub fn total_maker_fees(&self) -> UD64
pub fn total_maker_fees(&self) -> UD64
Total maker fees paid across all fills.
Sourcepub fn total_builder_fees(&self) -> UD64
pub fn total_builder_fees(&self) -> UD64
Total builder fees earned on this trade, taker and maker sides combined.
Part of Self::taker_fee and the maker fees, not additional to them.
Sourcepub fn builder_total(&self, builder_id: BuilderId) -> UD64
pub fn builder_total(&self, builder_id: BuilderId) -> UD64
Total builder fees earned by a specific builder on this trade.
Trait Implementations§
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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