和顺 / 知衡 返回所属 Agent
ZH-10.01

结果归因

原能力

把后续变化对照当时证据、假设和风险预算,标记无法辨识的归因。(细化版 p.16–17)

首选项目

Empyrical(Apache-2.0)。 Empyrical

匹配范围

收益风险指标与因果反驳方法提供对照部件。

源码

Empyrical · def cum_returns(

empyrical/stats.py · 219–232 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
def cum_returns(returns, starting_value=0, out=None):
    """
    Compute cumulative returns from simple returns.

    Parameters
    ----------
    returns : pd.Series, np.ndarray, or pd.DataFrame
        Returns of the strategy as a percentage, noncumulative.
         - Time series with decimal returns.
         - Example::

            2015-07-16   -0.012143
            2015-07-17    0.045350
            2015-07-20    0.030957
  • # Copyright 2016 Quantopian, Inc.

Empyrical · def alpha_beta(

empyrical/stats.py · 1004–1017 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
def alpha_beta(returns,
               factor_returns,
               risk_free=0.0,
               period=DAILY,
               annualization=None,
               out=None):
    """Calculates annualized alpha and beta.

    Parameters
    ----------
    returns : pd.Series
        Daily returns of the strategy, noncumulative.
        - See full explanation in :func:`~empyrical.stats.cum_returns`.
    factor_returns : pd.Series
  • # Copyright 2016 Quantopian, Inc.

实现与验收要点

冻结当时估值/市场证据,区分相关、可辨识和未明原因。