pub struct Price(pub D128);Expand description
A type-safe price wrapper for financial instruments.
Prices use high-precision Dec19x19 decimal representation to avoid floating-point inaccuracies in financial calculations.
§Example
use clob_sync::order::Price;
use fastnum::D128 as Dec;
use fastnum::decimal::Context;
use std::str::FromStr;
let price = Price::try_from("50000.50").unwrap();
assert_eq!(price.to_string(), "50000.50");A type-safe price wrapper for financial instruments.
Prices use high-precision Dec19x19 decimal representation to avoid floating-point inaccuracies in financial calculations.
§Example
use clob_sync::order::Price;
use fastnum::D128 as Dec;
use fastnum::decimal::Context;
use std::str::FromStr;
let price = Price::try_from("50000.50").unwrap();
assert_eq!(price.to_string(), "50000.50");Tuple Fields§
§0: D128Implementations§
Trait Implementations§
impl Copy for Price
impl Eq for Price
Source§impl Ord for Price
impl Ord for Price
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Price
impl PartialOrd for Price
impl StructuralPartialEq for Price
Auto Trait Implementations§
impl Freeze for Price
impl RefUnwindSafe for Price
impl Send for Price
impl Sync for Price
impl Unpin for Price
impl UnsafeUnpin for Price
impl UnwindSafe for Price
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more