波动与方向指标
原能力
实现波动和方向指标,保留参数、单位、计算路径和失效条件。(合同附件 R7 9.3)
首选项目
Qlib(MIT)。 Qlib
匹配范围
滚动 Std 以及风险统计可复算部分指标。
源码
Qlib · class Std(
qlib/data/ops.py · 867–880 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
class Std(Rolling):
"""Rolling Std
Parameters
----------
feature : Expression
feature instance
N : int
rolling window size
Returns
----------
Expression
a feature instance with rolling std
- # Copyright (c) Microsoft Corporation.
Empyrical · def annual_volatility(
empyrical/stats.py · 487–500 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
def annual_volatility(returns,
period=DAILY,
alpha=2.0,
annualization=None,
out=None):
"""
Determines the annual volatility of a strategy.
Parameters
----------
returns : pd.Series or np.ndarray
Periodic returns of the strategy, noncumulative.
- See full explanation in :func:`~empyrical.stats.cum_returns`.
period : str, optional
- # Copyright 2016 Quantopian, Inc.
实现与验收要点
方向指标、单位、参数、序列口径和失效条件。