pub fn quotation_to_decimal(q: &Quotation) -> DecimalExpand description
Converts a Quotation (a price or a quantity in pieces) to a [Decimal], exactly.
Both parts are added with their own signs, so a negative value works as expected.
§Examples
use rust_decimal::Decimal;
use brokapi_tbank_protocol::money::quotation_to_decimal;
use brokapi_tbank_protocol::v1::Quotation;
assert_eq!(quotation_to_decimal(&Quotation { units: 114, nano: 250_000_000 }), Decimal::new(11425, 2));
assert_eq!(quotation_to_decimal(&Quotation { units: 0, nano: -10_000_000 }), Decimal::new(-1, 2));