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?

有帮助吗?

解决方案

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.

其他提示

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")
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top