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

Function rolling_max

crates/openquant/src/microstructural_features.rs:53–67  ·  view source on GitHub ↗
(arr: &[f64], window: usize)

Source from the content-addressed store, hash-verified

51}
52
53fn rolling_max(arr: &[f64], window: usize) -> Vec<f64> {
54 let mut out = vec![NAN; arr.len()];
55 if window == 0 {
56 return out;
57 }
58 for i in 0..arr.len() {
59 if i + 1 < window {
60 continue;
61 }
62 let start = i + 1 - window;
63 let max_v = arr[start..=i].iter().fold(f64::NEG_INFINITY, |m, v| m.max(*v));
64 out[i] = max_v;
65 }
66 out
67}
68
69fn rolling_min(arr: &[f64], window: usize) -> Vec<f64> {
70 let mut out = vec![NAN; arr.len()];

Callers 1

_get_gammaFunction · 0.85

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected