【代码】Asian arithmetic Option
对算术平均亚式期权Matlab代码的阅读;
Payoff of Asian arithmetic’s is
输入参数
- r = risk free rate
- u , d : $S_1(up)=S_0u, S_1(down)=S_0d$
- strike = strike price (K)
- s0 = $S_0$
- imax = T or periods
1 |
|
初始化
- rnp = $\frac{1+r-d}{u-d}$ , risk neutral probability
- SS : 初始化价格树,因为不同于欧式需要记录每一步,即$S_0ud$和$S_0du$的平均价格不等,因此需要$2^{imax}$种情况
1 |
|
output:
SS = (2^imax,imax+1)
建立up-down组合表
- matr : 将所有可能排成$2^{imax}$行
1 |
|
output:
matr = (2^imax,imax)
补充价格树
- 按照matr的组合对SS进行补充
1 |
|
output:
SS = (2^imax,imax+1)
计算收益
- 按照公式计算收益
1 |
|
output:
payoff = (2^imax,1)
计算每个up-down组合up的次数
1 |
|
output:
pp = (1,2^imax)
计算期望值
- rnp_payoff = $rnp ^{pp}*(1-rnp)^{imax-pp}$
- option_price = $\frac{E_{rnp}[payoff]}{(1+r)^{imax}}$
1 |
|
output:
rnp_payoff = (1,2^imax)
rnp_payoff = (1,1)
【代码】Asian arithmetic Option
http://achlier.github.io/2021/02/17/Asian_arithmetic_Option_With_MatlabCode/