pub struct LocalOrderbook {
pub orderbook_id: String,
/* private fields */
}Expand description
Local orderbook state
Fields§
§orderbook_id: StringOrderbook identifier
Implementations§
Source§impl LocalOrderbook
impl LocalOrderbook
Sourcepub fn apply_snapshot(&mut self, update: &BookUpdateData)
pub fn apply_snapshot(&mut self, update: &BookUpdateData)
Apply a snapshot (full orderbook state)
Sourcepub fn apply_delta(
&mut self,
update: &BookUpdateData,
) -> Result<(), WebSocketError>
pub fn apply_delta( &mut self, update: &BookUpdateData, ) -> Result<(), WebSocketError>
Apply a delta update
Returns an error if a sequence gap is detected.
Sourcepub fn apply_update(
&mut self,
update: &BookUpdateData,
) -> Result<(), WebSocketError>
pub fn apply_update( &mut self, update: &BookUpdateData, ) -> Result<(), WebSocketError>
Apply an update (snapshot or delta)
Sourcepub fn get_bids(&self) -> Vec<PriceLevel>
pub fn get_bids(&self) -> Vec<PriceLevel>
Get all bid levels sorted by price (descending - highest first)
Sourcepub fn get_asks(&self) -> Vec<PriceLevel>
pub fn get_asks(&self) -> Vec<PriceLevel>
Get all ask levels sorted by price (ascending - lowest first)
Sourcepub fn get_top_bids(&self, n: usize) -> Vec<PriceLevel>
pub fn get_top_bids(&self, n: usize) -> Vec<PriceLevel>
Get top N bid levels (highest prices first)
Sourcepub fn get_top_asks(&self, n: usize) -> Vec<PriceLevel>
pub fn get_top_asks(&self, n: usize) -> Vec<PriceLevel>
Get top N ask levels (lowest prices first)
Sourcepub fn best_bid(&self) -> Option<(String, String)>
pub fn best_bid(&self) -> Option<(String, String)>
Get the best bid (highest bid price) as (price_string, size_string)
Sourcepub fn best_ask(&self) -> Option<(String, String)>
pub fn best_ask(&self) -> Option<(String, String)>
Get the best ask (lowest ask price) as (price_string, size_string)
Sourcepub fn spread(&self) -> Option<String>
pub fn spread(&self) -> Option<String>
Get the spread as a string (best_ask - best_bid) Uses Decimal for precise calculation to preserve backend precision.
Sourcepub fn midpoint(&self) -> Option<String>
pub fn midpoint(&self) -> Option<String>
Get the midpoint price as a string Uses Decimal for precise calculation to preserve backend precision.
Sourcepub fn bid_size_at(&self, price: &str) -> Option<String>
pub fn bid_size_at(&self, price: &str) -> Option<String>
Get size at a specific bid price
Sourcepub fn ask_size_at(&self, price: &str) -> Option<String>
pub fn ask_size_at(&self, price: &str) -> Option<String>
Get size at a specific ask price
Sourcepub fn total_bid_depth(&self) -> Decimal
pub fn total_bid_depth(&self) -> Decimal
Get total bid depth (sum of all bid sizes) Uses Decimal for precise calculation to preserve backend precision.
Sourcepub fn total_ask_depth(&self) -> Decimal
pub fn total_ask_depth(&self) -> Decimal
Get total ask depth (sum of all ask sizes) Uses Decimal for precise calculation to preserve backend precision.
Sourcepub fn has_snapshot(&self) -> bool
pub fn has_snapshot(&self) -> bool
Whether the orderbook has received its initial snapshot
Sourcepub fn expected_sequence(&self) -> u64
pub fn expected_sequence(&self) -> u64
Current expected sequence number
Sourcepub fn last_timestamp(&self) -> Option<&str>
pub fn last_timestamp(&self) -> Option<&str>
Last update timestamp
Trait Implementations§
Source§impl Clone for LocalOrderbook
impl Clone for LocalOrderbook
Source§fn clone(&self) -> LocalOrderbook
fn clone(&self) -> LocalOrderbook
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for LocalOrderbook
impl RefUnwindSafe for LocalOrderbook
impl Send for LocalOrderbook
impl Sync for LocalOrderbook
impl Unpin for LocalOrderbook
impl UnwindSafe for LocalOrderbook
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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