风险期限核对
原能力
把观察窗口和投资期限对齐,登记期限变化对风险尺度的影响。(细化版 p.16–17)
首选项目
Empyrical(Apache-2.0)。 Empyrical
匹配范围
风险统计按指定时间窗口重算波动和回撤。
源码
Empyrical · def max_drawdown(
empyrical/stats.py · 352–365 行。 在 GitHub 查看源码 · 许可证与声明
源码片段
def max_drawdown(returns, out=None):
"""
Determines the maximum drawdown of a strategy.
Parameters
----------
returns : pd.Series or np.ndarray
Daily returns of the strategy, noncumulative.
- See full explanation in :func:`~empyrical.stats.cum_returns`.
out : array-like, optional
Array to use as output buffer.
If not passed, a new array will be created.
Returns
- # Copyright 2016 Quantopian, Inc.
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.
实现与验收要点
持有期、交易日历、频率及风险外推核验。