Skip to main content

quantity_from_decimal

Function quantity_from_decimal 

Source
pub fn quantity_from_decimal(value: Decimal, precision: u8) -> Result<Quantity>
Expand description

Converts a [Decimal] into a non-negative Nautilus [Quantity] at the requested precision.

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

ยงErrors

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