pub fn precise_up(
value: Decimal,
step: Decimal,
) -> Result<Decimal, PrecisionError>Expand description
Rounds a value up to the step grid.
Typical for a sell price: never sell below the computed value.
§Errors
The same as value_to_steps_nearest.
§Examples
use brokapi_bcs_protocol::utils::precision::precise_up;
use rust_decimal::Decimal;
let step = Decimal::new(5, 2);
assert_eq!(precise_up(Decimal::new(10103, 2), step)?, Decimal::new(10105, 2));
// already on the grid: unchanged
assert_eq!(precise_up(Decimal::new(10105, 2), step)?, Decimal::new(10105, 2));