开始使用免费开始使用

GEV 风险估计

假设在 2010 年 1 月 1 日,您持有 € 1,000,000 的 GE 股票。您希望基于 2008—2009 年这两年的可用数据,覆盖接下来一周内可能发生的"预期"最大损失。您假设 GE 的每周最大损失服从广义极值分布(Generalized Extreme Value,GEV)。

为了对预期损失建模,您将估计 GEV 分布在 99% 置信水平下的 CVaR,并用它来计算在 2010 年 1 月需要预留的金额,以覆盖预期的每周最大损失。

scipy.stats 中的 genextreme 分布已经在您的工作空间可用,同时还提供了 GE 在 2008—2009 年期间的 losses

本练习是课程的一部分

Python 中的定量风险管理

查看课程

练习说明

  • 以 1 周为区间,找到 GE 资产价格的一周区间内的最大值。
  • 将 GEV 分布 genextreme 拟合到 weekly_maxima 数据。
  • 计算 99% VaR,并据此求出 99% CVaR 的估计值。
  • 计算覆盖预期每周最大损失所需的准备金。

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Compute the weekly block maxima for GE's stock
weekly_maxima = losses.____("W").____()

# Fit the GEV distribution to the maxima
p = genextreme.____(____)

# Compute the 99% VaR (needed for the CVaR computation)
VaR_99 = genextreme.____(____, *p)

# Compute the 99% CVaR estimate
CVaR_99 = (1 / (1 - 0.99)) * genextreme.____(lambda x: x, 
           args=(p[0],), loc = p[1], scale = p[2], lb = ____)

# Display the covering loss amount
print("Reserve amount: ", 1000000 * CVaR_99)
编辑并运行代码