case study1
https://zhuanlan.zhihu.com/p/139262608#
利率衍生品定价的基础内容回顾
Q1(Effective return)
info
two ways to calculate the average of return
1)arithmetic average
2) geometric average
![](https://i-blog.csdnimg.cn/blog_migrate/fb7c1c98dc800cf79dccb7e8c3c5a022.png)
![](https://i-blog.csdnimg.cn/blog_migrate/89908e1fdeb6f42f824c7c7b80e41ec8.png)
Head:
Tom and Amy both bought a 20-year pension with different return schemes. Tom’s pension has first year interest rate of 3% and will increase by 0.5% every year whilst Amy’s pension has a continuous interest rate of 7%. Both pension pays the interest annually. Compare the benefits of the two pensions by computing their effective rates of return.
%% Solution:
InterestR_Tom=[3:0.5:12.5]/100;
EffectiveR_Tom=(prod(1+[3:0.5:12.5]/100))^(1/20)-1;% 用平均来算
EffectiveR_Tom=prod(
EffectiveR_AMY=exp(0.07)-1;
if EffectiveR_Tom>EffectiveR_AMY
disp('The pension of Tom has higher effective rate')
elseif EffectiveR_Tom<EffectiveR_AMY
disp('The pension of Amy has higher effective rate')
else
disp('The effective rates are equal')
end
Q2(Duration and convexity)
info
wirte a user_defined matlab-code and call it
function [Price,duration,convexity] = DurationConvexity(Face,Coupon,Maturity,yield)
% BondPrice, Duration and Convexity
Time=0.5:0.5:Maturity; % time for payments
C = 0.5*Coupon*Face; % one coupon payment
Price = sum(C*exp(-yield*Time)) + Face*exp(-yield*Maturity);
duration= sum( (C* Time.* exp(-yield*Time) )/ Price )+Face*Maturity*exp(-yield*Maturity)/Price;
convexity = sum( (C.* (Time.