Skip to main content

price_from_decimal

Function price_from_decimal 

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

Converts a [Decimal] into a Nautilus [Price] at the requested precision.

Use this when the wire value has already been deserialized as a [Decimal] (the standard pattern for model fields tagged with deserialize_decimal).

ยงErrors

Returns an error if precision exceeds MAX_DECIMALS or if the value is out of [Price] range.