pub struct ReturnsVolatility { /* private fields */ }Expand description
Calculates the annualized volatility (standard deviation) of portfolio returns.
Volatility is calculated as the standard deviation of returns, annualized by
multiplying the daily standard deviation by the square root of the period:
Standard Deviation * sqrt(period)
Uses Bessel’s correction (ddof=1) for sample standard deviation. This provides a measure of the portfolio’s risk or uncertainty of returns.
§References
- CFA Institute Level I Curriculum: Quantitative Methods
- Hull, J. C. (2018). Options, Futures, and Other Derivatives (10th ed.). Pearson.
- Fabozzi, F. J., et al. (2002). The Handbook of Financial Instruments. Wiley.
Implementations§
Source§impl ReturnsVolatility
impl ReturnsVolatility
Sourcepub fn new(period: Option<usize>) -> Self
pub fn new(period: Option<usize>) -> Self
Creates a new ReturnsVolatility instance.
Trait Implementations§
Source§impl Clone for ReturnsVolatility
impl Clone for ReturnsVolatility
Source§fn clone(&self) -> ReturnsVolatility
fn clone(&self) -> ReturnsVolatility
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ReturnsVolatility
impl Debug for ReturnsVolatility
Source§impl Display for ReturnsVolatility
impl Display for ReturnsVolatility
Source§impl PortfolioStatistic for ReturnsVolatility
impl PortfolioStatistic for ReturnsVolatility
type Item = f64
Source§fn name(&self) -> String
fn name(&self) -> String
Returns the name of this statistic for display and identification purposes.
Source§fn calculate_from_returns(&self, raw_returns: &Returns) -> Option<Self::Item>
fn calculate_from_returns(&self, raw_returns: &Returns) -> Option<Self::Item>
Calculates the statistic from time-indexed returns data. Read more
Source§fn calculate_from_realized_pnls(
&self,
_realized_pnls: &[f64],
) -> Option<Self::Item>
fn calculate_from_realized_pnls( &self, _realized_pnls: &[f64], ) -> Option<Self::Item>
Calculates the statistic from realized profit and loss values. Read more
Source§fn calculate_from_positions(
&self,
_positions: &[Position],
) -> Option<Self::Item>
fn calculate_from_positions( &self, _positions: &[Position], ) -> Option<Self::Item>
Calculates the statistic from position data. Read more
Source§fn calculate_from_orders(
&self,
orders: Vec<Box<dyn Order>>,
) -> Option<Self::Item>
fn calculate_from_orders( &self, orders: Vec<Box<dyn Order>>, ) -> Option<Self::Item>
Calculates the statistic from order data. Read more
Source§fn calculate_from_returns_with_benchmark(
&self,
returns: &Returns,
benchmark: &Returns,
) -> Option<Self::Item>
fn calculate_from_returns_with_benchmark( &self, returns: &Returns, benchmark: &Returns, ) -> Option<Self::Item>
Calculates the statistic from time-indexed strategy returns relative to a benchmark. Read more
Source§fn align_returns(&self, a: &Returns, b: &Returns) -> (Vec<f64>, Vec<f64>)
fn align_returns(&self, a: &Returns, b: &Returns) -> (Vec<f64>, Vec<f64>)
Aligns two returns series onto a common daily grid. Read more
Source§fn check_valid_returns(&self, returns: &Returns) -> bool
fn check_valid_returns(&self, returns: &Returns) -> bool
Validates that returns data is not empty.
Source§fn downsample_to_daily_bins(&self, returns: &Returns) -> Returns
fn downsample_to_daily_bins(&self, returns: &Returns) -> Returns
Downsamples high-frequency returns to daily bins by geometric compounding. Read more
Source§fn calculate_std(&self, returns: &Returns) -> f64
fn calculate_std(&self, returns: &Returns) -> f64
Calculates the standard deviation of returns with Bessel’s correction.
Auto Trait Implementations§
impl Freeze for ReturnsVolatility
impl RefUnwindSafe for ReturnsVolatility
impl Send for ReturnsVolatility
impl Sync for ReturnsVolatility
impl Unpin for ReturnsVolatility
impl UnsafeUnpin for ReturnsVolatility
impl UnwindSafe for ReturnsVolatility
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