Skip to main content

OrderBookUnits

Trait OrderBookUnits 

Source
pub trait OrderBookUnits {
    // Required methods
    fn lot_size(&self) -> u64;
    fn tick_size(&self) -> u64;

    // Provided methods
    fn size_to_ifixed(&self, size: u64) -> IFixed { ... }
    fn price_to_ifixed(&self, price: u64) -> IFixed { ... }
    fn ifixed_to_price(&self, ifixed: IFixed) -> Result<u64, Error> { ... }
    fn ifixed_to_size(&self, ifixed: IFixed) -> Result<u64, Error> { ... }
}
Expand description

Convenience trait to convert to/from units used in the orderbook.

Required Methods§

Source

fn lot_size(&self) -> u64

Source

fn tick_size(&self) -> u64

Provided Methods§

Source

fn size_to_ifixed(&self, size: u64) -> IFixed

Size in the balance9 adjusted for market’s lot size to fixed-point number.

§Panics

If self.lot_size() == 0

Source

fn price_to_ifixed(&self, price: u64) -> IFixed

Price in the balance9 adjusted for market’s tick size to fixed-point number.

§Panics

If self.tick_size() == 0

Source

fn ifixed_to_price(&self, ifixed: IFixed) -> Result<u64, Error>

The price in balance9 closest to the desired value, adjusted for tick_size.

Source

fn ifixed_to_size(&self, ifixed: IFixed) -> Result<u64, Error>

Implementors§