pub struct AllocationDiff {
pub symbol: String,
pub current_percent: Decimal,
pub desired_percent: Decimal,
pub diff_percent: Decimal,
pub current_value: Decimal,
pub desired_value: Decimal,
pub diff_value: Decimal,
}Expand description
Represents the difference between current and desired allocation for a symbol.
Fields§
§symbol: StringThe trading symbol.
current_percent: DecimalCurrent percentage allocation (0-100).
desired_percent: DecimalDesired percentage allocation (0-100).
diff_percent: DecimalDifference (desired - current).
current_value: DecimalCurrent value in base currency.
desired_value: DecimalDesired value in base currency.
diff_value: DecimalValue difference (desired - current).
Implementations§
Source§impl AllocationDiff
impl AllocationDiff
Sourcepub fn needs_sell(&self) -> bool
pub fn needs_sell(&self) -> bool
Returns true if we need to sell this asset.
Sourcepub fn abs_diff_value(&self) -> Decimal
pub fn abs_diff_value(&self) -> Decimal
Returns the absolute value difference.
Sourcepub fn abs_diff_percent(&self) -> Decimal
pub fn abs_diff_percent(&self) -> Decimal
Returns the absolute percentage difference.
Trait Implementations§
Source§impl Clone for AllocationDiff
impl Clone for AllocationDiff
Source§impl Debug for AllocationDiff
impl Debug for AllocationDiff
Source§impl<'de> Deserialize<'de> for AllocationDiff
impl<'de> Deserialize<'de> for AllocationDiff
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for AllocationDiff
impl PartialEq for AllocationDiff
Source§impl Serialize for AllocationDiff
impl Serialize for AllocationDiff
impl StructuralPartialEq for AllocationDiff
Auto Trait Implementations§
impl Forget for AllocationDiff
impl Freeze for AllocationDiff
impl Move for AllocationDiff
impl RefUnwindSafe for AllocationDiff
impl Send for AllocationDiff
impl Sync for AllocationDiff
impl Unpin for AllocationDiff
impl UnsafeUnpin for AllocationDiff
impl UnwindSafe for AllocationDiff
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