-
Notifications
You must be signed in to change notification settings - Fork 435
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
117 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# 金融衍生工具 | ||
|
||
金融衍生工具是指以金融资产为标的资产的衍生工具,如利率期货股票期权、货币互换等。 | ||
|
||
## 下载 | ||
|
||
[点击链接,下载文件夹内所有内容](https://xovee.github.io/gitzip/?https://github.com/Xovee/uestc-course/tree/main/课程目录/金融衍生工具) | ||
|
||
<h1>资源贡献</h1><br>希望大家能多多贡献资源,促进仓库良性发展,帮助更多的同学考个好成绩! | ||
|
||
仓库地址:[https://github.com/Xovee/uestc-course](https://github.com/Xovee/uestc-course) <br><br>国内访问GitHub不太稳定,有时候需要特殊手段。有问题可以邮件联系我:xovee at live.com | ||
|
||
## 复习提示 | ||
|
||
金融衍生工具这门课平时上课因为有较多数学公式推导,加上课后没有及时弄懂,可能在复习时有一些无从下手(啥也不会的感觉😭) | ||
|
||
我的建议是首先跟着复习提纲看(如果老师有提供提纲,看你们老师给的。如果没有可以看复习资料中的提纲),如果在提纲中,有不清楚的地方就在教材中找到对应的章节阅读。原书的难度如果有一定金融学的基础还是比较容易理解的。 | ||
|
||
然后一定一定要弄清楚作业,我整理在了复习重点题中。大题都是在里面的原题,所以一定要都搞清楚。最后考试前再过一遍复习大纲,概念要弄清楚。像期货分析、期权定价、组合构造、二叉树等都是选择题常考的,而且不会出原题,需要你自己理解概念和计算方法。 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import math | ||
import matplotlib.pyplot as plt | ||
import scipy.special | ||
from scipy import linalg | ||
import numpy as np | ||
|
||
|
||
def CalculateGoldPrice(OldPrice, r=0.03, dt=1/252, sigma=0.2315, ran=0): | ||
return OldPrice + r*OldPrice * \ | ||
dt+sigma*OldPrice*ran*math.sqrt(dt) | ||
|
||
|
||
def MonteCarlo(N_path=1000, Gp=200, sigma=0.2315, r=0.03, nr=0.035, F=10000, dt=1/252): | ||
plt.rc("font", family='YouYuan') # 显示中文 | ||
FT = np.full(N_path*2+1, F) # 初始证券价格 | ||
gpath = np.arange(1, N_path*2+1, 1).tolist() | ||
# print(FT) | ||
for num in range(1, N_path+1): # 路径个数 | ||
|
||
np.random.seed(num*2+1) # 设置随机数种子 | ||
|
||
gold_price = np.zeros(252*3+1) | ||
gold_price_2 = np.zeros(252*3+1) | ||
gold_price[1] = Gp # 黄金基准价格 | ||
gold_price_2[1] = Gp | ||
day = np.arange(1, 252*3+1, 1).tolist() | ||
payoff = nr*F*(math.exp(-r) + math.exp(-r*2) + | ||
math.exp(-r*3)) + F * math.exp(-r*3) # 三年利息的现值 + 本金的现值 | ||
for k in range(1, 252*3): | ||
ran = np.random.randn(1) | ||
ran_2 = -ran # 获得对偶因子 | ||
# 离散形式模拟金价 | ||
gold_price[k+1] = CalculateGoldPrice(gold_price[k], ran=ran) | ||
gold_price_2[k+1] = CalculateGoldPrice(gold_price_2[k], ran=ran_2) | ||
if(k == 252*3-1): | ||
limit_1 = (1+nr)*gold_price[1] | ||
limit_2 = (1+0.6)*gold_price[1] | ||
if(gold_price[k+1] <= limit_1): | ||
FT[num] = payoff + limit_1*math.exp(-r*3) | ||
if(limit_1 < gold_price[k+1] and gold_price[k+1] < limit_2): | ||
FT[num] = payoff + limit_1*math.exp(-r*3) + 0.3 * \ | ||
(gold_price[k+1]-limit_1)*math.exp(-r*3) | ||
if(limit_2 <= gold_price[k+1]): | ||
FT[num] = payoff + limit_1 * \ | ||
math.exp(-r*3) + 0.3*(limit_2 - limit_1)*math.exp(-r*3) | ||
# 计算路径2 | ||
if(gold_price_2[k+1] <= limit_1): | ||
FT[num+N_path] = payoff + limit_1*math.exp(-r*3) | ||
if(limit_1 < gold_price_2[k+1] and gold_price_2[k+1] < limit_2): | ||
FT[num+N_path] = payoff + limit_1*math.exp(-r*3) + 0.3 * \ | ||
(gold_price_2[k+1]-limit_1)*math.exp(-r*3) | ||
if(limit_2 <= gold_price_2[k+1]): | ||
FT[num+N_path] = payoff + limit_1*math.exp(-r*3) + 0.3 * \ | ||
(limit_2 - limit_1)*math.exp(-r*3) | ||
plt.plot(day, gold_price[1:]) | ||
plt.plot(day, gold_price_2[1:]) | ||
plt.title('黄金价格模拟路径') | ||
plt.grid(True) | ||
plt.xlabel('时间') | ||
plt.ylabel('黄金价格') | ||
plt.show() | ||
### | ||
plt.title('债券价值分布') | ||
plt.grid(True) | ||
plt.xlabel('样本路径') | ||
plt.ylabel('债券价值') | ||
plt.plot(gpath, FT[1:], 'xk') | ||
plt.show() | ||
### | ||
x = np.arange(10315, 10350, 0.5).tolist() | ||
plt.title('债券价值频率') | ||
plt.grid(True) | ||
plt.xlabel('债券价值区间') | ||
plt.ylabel('个数') | ||
plt.hist(FT, x) | ||
plt.show() | ||
return | ||
|
||
|
||
if __name__ == '__main__': | ||
MonteCarlo(N_path=1000) |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# 作业 | ||
|
||
| 文件名 | 作业类型 | 文件类型 | 文件大小 | 备注 | | ||
| ------------------------------------- | -------- | -------- | -------- | --------------------------------------- | | ||
| 2023春-实验-黄金联结债券产品设计-报告 | 实验报告 | PDF | 752KB | | | ||
| 2023春-实验-黄金联结债券产品设计-代码 | 实验代码 | py | 4KB | | | ||
| 2023春-实验-基金保险策略-报告 | 实验报告 | PDF | 1073KB | | | ||
| 2023春-实验-基金保险策略-计算 | 实验 | XLSX | 37KB | 通过随机(更改ε列)多次,获取实验结果。 | | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# 复习资料 | ||
|
||
| 文件名 | 作者 | 文件类型 | 文件大小 | 最近更新时间 | 备注 | | ||
| -------------------------------------------------- | ------- | -------- | -------- | ------------- | ---- | | ||
| 复习提纲 | AntiO2 | PDF | 1014KB | 2023年6月29日 | | ||
| 复习重点题 | AntiO2 | PDF | 3982KB | 2023年7月6日 | | ||
| 赫尔 期权、期货及其他衍生产品 第十版 课后习题答案 | unknown | PDF | 8027KB | 2023年7月7日 | | ||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.