rquantlib icon indicating copy to clipboard operation
rquantlib copied to clipboard

Greek calculation with "CrankNicolson"

Open matthewgson opened this issue 4 years ago • 6 comments

Hi,

I'm new to this package, and I was wondering if I'm missing something to see the full estimate of greeks in AmericanOption() function. Documentation says When “CrankNicolson” is selected, then at least delta, gamma and vega are available., but when I run the example given in the documentation, I only see value, delta and gamma.

> AmericanOption("put", strike=100, volatility=0.4, 100, 0.02, 0.03, 0.5, engine="CrankNicolson")
Concise summary of valuation for AmericanOption 
  value   delta   gamma    vega   theta     rho  divRho 
10.9168 -0.4358  0.0140      NA      NA      NA      NA 
> AmericanOption("call", strike=100, volatility=0.4, 100, 0.02, 0.03, 0.5, engine="CrankNicolson")
Concise summary of valuation for AmericanOption 
  value   delta   gamma    vega   theta     rho  divRho 
11.3597  0.5580  0.0138      NA      NA      NA      NA 

I'm wondering what causes the vega missing, and what specifications should add to see full estimates of greeks.

matthewgson avatar Sep 20 '21 20:09 matthewgson

Howdy. It a galaxy far way and many moons ago this had values there (under at least some engine). Then QL changed and I never 'shrunk' the display. I think your best bet now is numerical approximations.

And we had discussions about this ... but I am also unsure where. Maybe the old mailing list? Maybe here in old tickets?

eddelbuettel avatar Sep 20 '21 21:09 eddelbuettel

I'm doing great, and thanks for your prompt answer. Haha - surprised that it was that old.. Good thing that it still provides delta and gamma. Thank you for suggestion, and I'd like to be consistent with the package when I do approximation. Do you mind if I ask which incremental value was used for delta, gamma? like, plus and minus h=0.01?

matthewgson avatar Sep 20 '21 21:09 matthewgson

Vega is pretty well behaved in these products except at short time to expiration. You can use any size you want because it goes into the denominator and scales with the output of the valuation, but a vol point wide is usually pretty good (ie +/- .005).

tleitch avatar Sep 20 '21 21:09 tleitch

@tleitch @eddelbuettel Thank you for your suggestion. Should this be closed then?

matthewgson avatar Sep 20 '21 22:09 matthewgson

I'll fix vega calc this weekend and update docs. Have to rebuild my environment first. Will need to add flag to avoid calc as optional as it will slow everything down.

tleitch avatar Sep 23 '21 15:09 tleitch

Greatly appreciated -! Mind if I ask if you are planning to incorporate other greeks as well?

On Sep 23, 2021, at 11:38 AM, Terry Leitch @.***> wrote:

 I'll fix vega calc this weekend and update docs. Have to rebuild my environment first. Will need to add flag to avoid calc as optional as it will slow everything down.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

matthewgson avatar Sep 23 '21 16:09 matthewgson