(py: Python<'_>, parent: &Bound<'_, PyModule>)
| 44 | #[pyfunction(name = "get_daily_vol")] |
| 45 | fn volatility_get_daily_vol( |
| 46 | close_timestamps: Vec<String>, |
| 47 | close_prices: Vec<f64>, |
| 48 | lookback: usize, |
| 49 | ) -> PyResult<Vec<(String, f64)>> { |
| 50 | let close = |
| 51 | pair_timestamps_values(close_timestamps, close_prices, "close_timestamps", "close_prices")?; |
| 52 | let result = openquant::util::volatility::get_daily_vol(&close, lookback); |
| 53 | Ok(result.into_iter().map(|(ts, v)| (format_naive_datetime(&ts), v)).collect()) |
| 54 | } |
| 55 | |
| 56 | /// Parkinson high-low volatility over a rolling window. |
| 57 | /// |
| 58 | /// Each output is `sqrt(mean(ln(high / low)^2) / (4 ln 2))` over the last `window` bars, per |
nothing calls this directly
no outgoing calls
no test coverage detected