Pregunta

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?

¿Fue útil?

Solución

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.

Otros consejos

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")
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top