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

Function resample_prices

crates/openquant/src/portfolio_optimization.rs:79–97  ·  view source on GitHub ↗
(prices: &DMatrix<f64>, step: usize)

Source from the content-addressed store, hash-verified

77//! assert!(matches!(
78//! allocate_from_inputs(&mu, &cov, "min_volatility", &impossible),
79//! Err(AllocError::InfeasibleBounds { .. })
80//! ));
81//! # Ok(())
82//! # }
83//! ```
84
85use nalgebra::{DMatrix, DVector};
86
87use crate::util::qp::{solve_qp, QpError};
88use crate::util::resample::{freq_step, resample_prices};
89use crate::util::stats;
90use std::collections::HashMap;
91
92/// Errors returned by the allocation functions.
93#[derive(Debug, PartialEq, thiserror::Error)]
94pub enum AllocError {
95 /// The price matrix has fewer than two rows (after resampling), so no return can be formed.
96 #[error("no data: supply asset prices, or expected returns and a covariance matrix")]
97 NoData,
98 /// `solution` is not one of `"inverse_variance"`, `"min_volatility"`, `"max_sharpe"`,
99 /// `"efficient_risk"`.
100 #[error("unknown solution: {0}")]

Callers 1

returns_and_meansFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected