和顺 / 衡律 返回所属 Agent
14.5

尾部风险约束下的资产配置

原能力

实现限定尾部风险约束配置,保留样本、损失口径和求解证据。(合同附件 R7 14.5)

首选项目

PyPortfolioOpt(MIT)。 PyPortfolioOpt

匹配范围

EfficientCVaR 与凸约束表达尾部风险配置。

源码

PyPortfolioOpt · def efficient_risk(

pypfopt/efficient_frontier/efficient_cvar.py · 201–214 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
    def efficient_risk(self, target_cvar, market_neutral=False):
        """
        Maximise return for a target CVaR.
        The resulting portfolio will have a CVaR less than the target
        (but not guaranteed to be equal).

        Parameters
        ----------
        target_cvar : float
            the desired conditional value at risk of the resulting portfolio.
        market_neutral : bool, optional
            whether the portfolio should be market neutral (weights sum to zero),
            defaults to False. Requires negative lower weight bound.

PyPortfolioOpt · class EfficientCVaR

pypfopt/efficient_frontier/efficient_cvar.py · 15–28 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
class EfficientCVaR(EfficientFrontier):
    """
    The EfficientCVaR class allows for optimization along the mean-CVaR frontier, using the
    formulation of Rockafellar and Ursayev (2001).

    Instance variables:

    - Inputs:

        - ``n_assets`` - int
        - ``tickers`` - str list
        - ``bounds`` - float tuple OR (float tuple) list
        - ``returns`` - pd.DataFrame
        - ``expected_returns`` - np.ndarray
接口用法示意
portfolio = EfficientCVaR(expected_returns, returns); portfolio.efficient_risk(target_cvar)

实现与验收要点

冻结原情景、置信度及缺失、边界和资格。