MCPcopy Create free account
hub / github.com/Open-Quant/openquant / first_col

Function first_col

crates/openquant/src/risk_metrics.rs:130–135  ·  view source on GitHub ↗
(m: &DMatrix<f64>)

Source from the content-addressed store, hash-verified

128 /// use openquant::risk_metrics::RiskMetrics;
129 ///
130 /// let returns = [-0.08, -0.03, -0.01, 0.0, 0.01, 0.01, 0.02, 0.02, 0.03, 0.04];
131 /// assert_eq!(RiskMetrics.calculate_value_at_risk(&returns, 0.25).unwrap(), 0.0);
132 /// assert_eq!(RiskMetrics.calculate_value_at_risk(&returns, 0.0).unwrap(), -0.08);
133 /// ```
134 pub fn calculate_value_at_risk(
135 &self,
136 returns: &[f64],
137 confidence_level: f64,
138 ) -> Result<f64, RiskMetricsError> {

Calls

no outgoing calls

Tested by

no test coverage detected