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

Function pct_change

crates/openquant/src/cla.rs:379–396  ·  view source on GitHub ↗
(prices: &DMatrix<f64>)

Source from the content-addressed store, hash-verified

377 }
378 self.efficient_frontier_means.clear();
379 self.efficient_frontier_sigma.clear();
380
381 // `lambdas`, `gammas` and `free_weights` always describe the turning points. `weights`
382 // holds the requested solution, which for "cla_turning_points" is those same points.
383 let turning_points = self.weights.clone();
384 match solution.unwrap_or("cla_turning_points") {
385 "cla_turning_points" => {}
386 "min_volatility" => {
387 let best = turning_points
388 .iter()
389 .min_by(|a, b| {
390 quad_risk(&self.cov_matrix, a).total_cmp(&quad_risk(&self.cov_matrix, b))
391 })
392 .ok_or(ClaError::NoTurningPoints)?;
393 self.weights = vec![best.clone()];
394 }
395 "max_sharpe" => {
396 self.weights =
397 vec![max_sharpe_on_frontier(&turning_points, &mean, &self.cov_matrix)?];
398 }
399 "efficient_frontier" => {

Callers 1

returns_and_frequencyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected