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

Function register

crates/pyopenquant/src/volatility.rs:46–55  ·  view source on GitHub ↗
(py: Python<'_>, parent: &Bound<'_, PyModule>)

Source from the content-addressed store, hash-verified

44#[pyfunction(name = "get_daily_vol")]
45fn 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected