求助~
R做欧式看涨期权定价的程序~
题目为
[size=13.3333px]S0=20 ,[size=13.3333px]
miu=r=0.04 ,sigma=0.5,dt=1/52。[size=13.3333px]之后风险中性定价公式为
[size=13.3333px]
[size=13.3333px]
[size=13.3333px]
1.题目要求为
[size=13.3333px]1. Simulating weekly prices of the stock.
[size=13.3333px]2. Suppose that you want to determine the price of a European call option maturing in 1-year with strike
[size=13.3333px]price K = 12. Use simulation techniques to estimate this price.
[size=13.3333px]3. Compare your result with the one obtained from the Black-Scholes formula. Are they similar?
[size=13.3333px]First generate n independent values of S1(T)... Sn(T).
[size=13.3333px]
[size=13.3333px]我基本的代码都会,目前卡在了第一问那个 定价循环上,就是
[size=13.3333px]svals=S*exp(v*dt+sigma*sqrt(dt)*epsilon)
[size=13.3333px]y=matrix(svals,52,1000)(生成矩阵保存,不过这个似乎明显不对)
不知道怎么写循环,以及下面的条件语句,求大神科普一下
这三道题目的代码~ 求一下完整的~
thx ~
小生来世涌泉相报~