apple_quant_algorithmic/instrument/spec/decimal.rs
1use rust_decimal::Decimal;
2
3use super::XSpec;
4
5pub trait AsDecimal<XS: XSpec> {
6 fn as_decimal(&self) -> Decimal;
7}
8
9pub trait FromDecimal<XS: XSpec> {
10 fn from_decimal(decimal: Decimal) -> Self;
11}
12
13pub trait AddDecimal {
14 fn add_decimal(
15 &mut self,
16 decimal: &Decimal,
17 );
18}
19
20pub trait SubDecimal {
21 fn sub_decimal(
22 &mut self,
23 decimal: &Decimal,
24 );
25}