pub struct SimulationPath {
pub time: Vec<f64>,
pub values: Vec<f64>,
pub metadata: PathMetadata,
}Expand description
A single simulation path with time points and values
Fields§
§time: Vec<f64>Time points
values: Vec<f64>Values at each time point
metadata: PathMetadataMetadata about this path
Implementations§
Source§impl SimulationPath
impl SimulationPath
Sourcepub fn new(time: Vec<f64>, values: Vec<f64>, metadata: PathMetadata) -> Self
pub fn new(time: Vec<f64>, values: Vec<f64>, metadata: PathMetadata) -> Self
Create a new simulation path
Sourcepub fn final_value(&self) -> Option<f64>
pub fn final_value(&self) -> Option<f64>
Get the final value of the path
Sourcepub fn initial_value(&self) -> Option<f64>
pub fn initial_value(&self) -> Option<f64>
Get the initial value of the path
Sourcepub fn total_return(&self) -> Option<f64>
pub fn total_return(&self) -> Option<f64>
Calculate total return
Sourcepub fn period_returns(&self) -> Vec<f64>
pub fn period_returns(&self) -> Vec<f64>
Calculate period-over-period returns
Sourcepub fn log_returns(&self) -> Vec<f64>
pub fn log_returns(&self) -> Vec<f64>
Calculate log returns
Trait Implementations§
Source§impl Clone for SimulationPath
impl Clone for SimulationPath
Source§fn clone(&self) -> SimulationPath
fn clone(&self) -> SimulationPath
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SimulationPath
impl RefUnwindSafe for SimulationPath
impl Send for SimulationPath
impl Sync for SimulationPath
impl Unpin for SimulationPath
impl UnsafeUnpin for SimulationPath
impl UnwindSafe for SimulationPath
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more