volatility_yz_rv
Estimates Yang-Zhang realized volatility using high, low, open, and close prices. Provides a robust volatility measure accounting for overnight gaps and intraday price fluctuations.
Instructions
波动率-已实现波动率-Yang-Zhang 已实现波动率(Yang-Zhang Realized Volatility) https://github.com/hugogobato/Yang-Zhang-s-Realized-Volatility-Automated-Estimation-in-Python 论文地址:https://www.jstor.org/stable/10.1086/209650 基于以下公式计算: RV^2 = Vo + k*Vc + (1-k)*Vrs 其中:
Vo: 隔夜波动率, Vo = 1/(n-1)*sum(Oi-Obar)^2 Oi为标准化开盘价, Obar为标准化开盘价均值
Vc: 收盘波动率, Vc = 1/(n-1)*sum(ci-Cbar)^2 ci为标准化收盘价, Cbar为标准化收盘价均值
k: 权重系数, k = 0.34/(1.34+(n+1)/(n-1)) n为样本数量
Vrs: Rogers-Satchell波动率代理, Vrs = ui(ui-ci)+di(di-ci) ui = ln(Hi/Oi), ci = ln(Ci/Oi), di = ln(Li/Oi), oi = ln(Oi/Ci-1) Hi/Li/Ci/Oi分别为最高价/最低价/收盘价/开盘价
:param data: 包含 OHLC(开高低收) 价格的 pandas.DataFrame :type data: pandas.DataFrame :return: 包含 Yang-Zhang 实现波动率的 pandas.DataFrame :rtype: pandas.DataFrame
要求输入数据包含以下列:
Open: 开盘价
High: 最高价
Low: 最低价
Close: 收盘价
yang_zhang_rv formula is give as:
RV^2 = Vo + k*Vc + (1-k)*Vrs
where Vo = 1/(n-1)*sum(Oi-Obar)^2
with oi = normalized opening price at time t and Obar = mean of normalized opening prices
Vc = = 1/(n-1)*sum(ci-Cbar)^2
with ci = normalized close price at time t and Cbar = mean of normalized close prices
k = 0.34/(1.34+(n+1)/(n-1))
with n = total number of days or time periods considered
Vrs (Rogers & Satchell RV proxy) = ui(ui-ci)+di(di-ci)
with ui = ln(Hi/Oi), ci = ln(Ci/Oi), di=(Li/Oi), oi = ln(Oi/Ci-1)
where Hi = high price at time t and Li = low price at time t
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes |