Risk Disclosure
Disclosure
Oracle Security
EMA and Spot Price
Assets Risk
Market Risk
//
def parkinson_vol(high: np.ndarray, low: np.ndarray) -> float:
"""
Parkinson's volatility (per your formula):
sqrt( (1/N) * sum_i [ ln(Hi / Li) ]^2 )
"""
high = np.asarray(high, dtype=float)
low = np.asarray(low, dtype=float)
if high.shape != low.shape:
raise ValueError("high and low must have the same shape")
if np.any(low <= 0) or np.any(high <= 0):
raise ValueError("prices must be positive")
log_hl = np.log(high / low)
return np.sqrt(np.mean(log_hl ** 2))
Last updated

