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

Function load_series

crates/openquant/tests/codependence.rs:14–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12}
13
14fn load_series() -> (Vec<f64>, Vec<f64>, Vec<f64>) {
15 let fixture_path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
16 .join("../../tests/fixtures/codependence/random_state_42.csv");
17 let mut reader = csv::Reader::from_path(fixture_path).expect("fixture csv");
18 let mut x = Vec::new();
19 let mut y_1 = Vec::new();
20 let mut y_2 = Vec::new();
21
22 for result in reader.deserialize::<CodependenceRow>() {
23 let row = result.expect("valid row");
24 x.push(row.x);
25 y_1.push(row.y_1);
26 y_2.push(row.y_2);
27 }
28
29 (x, y_1, y_2)
30}
31
32fn corrcoef(x: &[f64], y: &[f64]) -> f64 {
33 let n = x.len() as f64;

Callers 3

test_correlationsFunction · 0.85
test_information_metricsFunction · 0.85
test_number_of_binsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected