Skip to main content

clamp_price_to_precision

Function clamp_price_to_precision 

Source
pub fn clamp_price_to_precision(
    price: Decimal,
    decimals: u8,
    is_buy: bool,
) -> Decimal
Expand description

Clamp a price to the instrument’s decimal precision, rounding in the direction that preserves the slippage buffer.