pub struct PositionsSummary {
pub total_pnl: f64,
pub total_m2m: f64,
pub total_unrealised: f64,
pub total_realised: f64,
pub positions_count: usize,
pub profitable_positions: usize,
pub loss_positions: usize,
}
Expand description
Positions summary
Fields§
§total_pnl: f64
Total P&L across all positions
total_m2m: f64
Total M2M across all positions
total_unrealised: f64
Total unrealised P&L
total_realised: f64
Total realised P&L
positions_count: usize
Number of positions
profitable_positions: usize
Number of profitable positions
loss_positions: usize
Number of loss positions
Implementations§
Source§impl PositionsSummary
impl PositionsSummary
Sourcepub fn from_positions(positions: &[Position]) -> Self
pub fn from_positions(positions: &[Position]) -> Self
Calculate from a list of positions
Sourcepub fn is_profitable(&self) -> bool
pub fn is_profitable(&self) -> bool
Check if the overall portfolio is profitable
Trait Implementations§
Source§impl Clone for PositionsSummary
impl Clone for PositionsSummary
Source§fn clone(&self) -> PositionsSummary
fn clone(&self) -> PositionsSummary
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for PositionsSummary
impl Debug for PositionsSummary
Source§impl<'de> Deserialize<'de> for PositionsSummary
impl<'de> Deserialize<'de> for PositionsSummary
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
Auto Trait Implementations§
impl Freeze for PositionsSummary
impl RefUnwindSafe for PositionsSummary
impl Send for PositionsSummary
impl Sync for PositionsSummary
impl Unpin for PositionsSummary
impl UnwindSafe for PositionsSummary
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