Skip to main content

parse_quantity

Function parse_quantity 

Source
pub fn parse_quantity(value: &str, precision: u8) -> Result<Quantity>
Expand description

Converts a decimal string into a non-negative Nautilus [Quantity].

Zero is allowed because Lighter sends zero-size book levels to delete existing orders.

ยงErrors

Returns an error if the string is not a decimal, if precision exceeds MAX_DECIMALS, if the value is negative, or if the resulting quantity is out of range.