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

Function resample_prices

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

Source from the content-addressed store, hash-verified

343 return Err(ClaError::NoData);
344 }
345 self._initialise(prices, resample_by, expected_asset_returns, covariance_matrix)?;
346 }
347 None => {
348 let (Some(exp), Some(cov)) = (expected_asset_returns, covariance_matrix) else {
349 return Err(ClaError::MissingInputs);
350 };
351 self.expected_returns = normalize_expected_returns(exp)?;
352 self.cov_matrix = cov.clone_owned();
353 let bounds = build_bounds(self.expected_returns.nrows(), &self.weight_bounds)?;
354 self.lower_bounds = bounds.iter().map(|b| b.0).collect();
355 self.upper_bounds = bounds.iter().map(|b| b.1).collect();
356 }
357 }
358 let n = self.expected_returns.nrows();
359 if self.cov_matrix.nrows() != n || self.cov_matrix.ncols() != n {
360 return Err(ClaError::DimensionMismatch);
361 }
362 let bounds: Vec<(f64, f64)> =
363 self.lower_bounds.iter().copied().zip(self.upper_bounds.iter().copied()).collect();
364 check_bounds_feasible(&bounds)?;
365
366 let mean: Vec<f64> = self.expected_returns.column(0).iter().copied().collect();

Callers 1

returns_and_frequencyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected