pub struct OrderBook {
pub pair: String,
pub bids: Vec<OrderBookLevel>,
pub asks: Vec<OrderBookLevel>,
}Expand description
Full order book snapshot with bids and asks.
Fields§
§pair: StringTrading pair label (e.g., “PUSD/USDT”).
bids: Vec<OrderBookLevel>Bids sorted by price descending (best bid first).
asks: Vec<OrderBookLevel>Asks sorted by price ascending (best ask first).
Implementations§
Source§impl OrderBook
impl OrderBook
Sourcepub fn estimate_buy_execution(
&self,
notional_usdt: f64,
) -> Option<ExecutionEstimate>
pub fn estimate_buy_execution( &self, notional_usdt: f64, ) -> Option<ExecutionEstimate>
Estimate slippage for buying a given USDT notional by walking the ask side. Returns (vwap, slippage_bps) if fillable, or None if insufficient liquidity.
Sourcepub fn estimate_sell_execution(
&self,
notional_usdt: f64,
) -> Option<ExecutionEstimate>
pub fn estimate_sell_execution( &self, notional_usdt: f64, ) -> Option<ExecutionEstimate>
Estimate slippage for selling (hitting bids) a given USDT notional.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OrderBook
impl RefUnwindSafe for OrderBook
impl Send for OrderBook
impl Sync for OrderBook
impl Unpin for OrderBook
impl UnwindSafe for OrderBook
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> 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>
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