R : RQuantLib not calculating greeks

不打扰是莪最后的温柔 提交于 2020-01-03 03:52:09

问题


I'm trying to use the RQuantLib package to calculate greeks for some options but getting NAs for all the output values except price.

I'm getting the same results when I copy the examples from the package user manual:

> AmericanOption("put", strike=100, volatility=0.4, 100, 0.02, 0.03, 0.5)
Concise summary of valuation for AmericanOption 
  value   delta   gamma    vega   theta     rho  divRho 
10.9174      NA      NA      NA      NA      NA      NA 
> AmericanOption("call", 100, 100, 0.02, 0.03, 0.5, 0.4)
Concise summary of valuation for AmericanOption 
  value   delta   gamma    vega   theta     rho  divRho 
11.3648      NA      NA      NA      NA      NA      NA 

Any suggestions?


回答1:


That has been discussed before e.g. in this thread on the r-sig-finance mailing list: the stubs are there because QL used to provided (numerical) greeks for American options, but stopped doing so many years ago.

So you have to approximate them numerically by shifting inputs; see the post referenced above for details. Consider subscribing to r-sig-finance as well.




回答2:


All you have to do is to include the engine CrankNicolson as follows:

# simple call with unnamed parameters, using Crank-Nicolons
AmericanOption("put", strike=100, volatility=0.4, 100, 0.02, 0.03, 0.5, engine="CrankNicolson")


来源:https://stackoverflow.com/questions/10074480/r-rquantlib-not-calculating-greeks

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!