[−][src]Struct tdb_core::postprocessing::orderbook::Orderbook
data structure for orderbook
Fields
price_decimals: u8
precision of price
bids: BTreeMap<u64, f64>
bids side of the orderbook
asks: BTreeMap<u64, f64>
asks side of the orderbook
Methods
impl Orderbook
[src]
pub fn discretize(&self, p: f32) -> u64
[src]
convert price from f32 to u64
pub fn undiscretize(&self, p: u64) -> f32
[src]
convert price from u64 to f32
pub fn with_precision(price_decimals: u8) -> Orderbook
[src]
Create empty orderbook
pub fn process_update(&mut self, up: &Update)
[src]
process depth update and clear empty price levels
pub fn clear(&mut self)
[src]
reset orderbook
pub fn clean(&mut self)
[src]
Remove zero levels from books
pub fn top(&self) -> Option<((f32, f64), (f32, f64))>
[src]
get top of the book, max bid, min ask
pub fn best_bid_raw(&self) -> Option<u64>
[src]
get discretized best bid price
pub fn best_ask_raw(&self) -> Option<u64>
[src]
get discretized best ask price
pub fn midprice_raw(&self) -> Option<u64>
[src]
get discretized best ask price
pub fn best_bid(&self) -> Option<f32>
[src]
get undiscretized best bid price
pub fn best_ask(&self) -> Option<f32>
[src]
get undiscretized best ask price
pub fn midprice(&self) -> Option<f32>
[src]
get midprice which is (bb + ba)/2
Trait Implementations
impl Clone for Orderbook
[src]
impl Debug for Orderbook
[src]
impl<'de> Deserialize<'de> for Orderbook
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialEq<Orderbook> for Orderbook
[src]
impl Serialize for Orderbook
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for Orderbook
[src]
Auto Trait Implementations
impl RefUnwindSafe for Orderbook
impl Send for Orderbook
impl Sync for Orderbook
impl Unpin for Orderbook
impl UnwindSafe for Orderbook
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,