Skip to main content

value_to_steps_down

Function value_to_steps_down 

Source
pub fn value_to_steps_down(
    value: Decimal,
    step: Decimal,
) -> Result<i64, PrecisionError>
Expand description

Converts a value to a whole number of steps, rounding down (towards negative infinity).

§Errors

The same as value_to_steps_nearest.

§Examples

use brokapi_bcs_protocol::utils::precision::value_to_steps_down;
use rust_decimal::Decimal;

assert_eq!(value_to_steps_down(Decimal::new(10103, 2), Decimal::new(5, 2))?, 2020);