[][src]Struct tdb_core::postprocessing::orderbook::Orderbook

pub struct Orderbook {
    pub price_decimals: u8,
    pub bids: BTreeMap<u64, f64>,
    pub asks: BTreeMap<u64, f64>,
}

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]

impl PartialEq<Orderbook> for Orderbook[src]

impl Serialize for Orderbook[src]

impl StructuralPartialEq for Orderbook[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,