-2

How to code Second derivatives Greek in R language especially Vanna and Volga for Black Scholes Model. I am only able to get the code under First derivatives i.e. delta gamma theta vega under the library of foptions library.

1 Answers1

1

You can do it with the greeks package: https://code.google.com/p/rgreeks/

Here is the example from ?greeks

greeks(51.03, # underlying price
       55,    # strike
       0,     # dividend rate
       0,     # risk-free rate
       25/360,# time remaining
       0.5)   # volatility estimate

List of 2
 $ call:List of 15
  ..$ value     : num 1.24
  ..$ delta     : num 0.308
  ..$ gamma     : num 0.0523
  ..$ vega      : num 4.73
  ..$ theta     : num -17
  ..$ rho       : num 1
  ..$ vanna     : num 0.446
  ..$ charm     : num 1.61
  ..$ zomma     : num -0.0712
  ..$ speed     : num 0.00288
  ..$ colour    : num -0.256
  ..$ DvegaDtime: num -44.9
  ..$ vomma     : num 3.02
  ..$ dualdelta : num -0.263
  ..$ dualgamma : num 0.045
 $ put :List of 15
  ..$ value     : num 5.21
  ..$ delta     : num -0.692
  ..$ gamma     : num 0.0523
  ..$ vega      : num 4.73
  ..$ theta     : num -17
  ..$ rho       : num -2.82
  ..$ vanna     : num 0.446
  ..$ charm     : num 1.61
  ..$ zomma     : num -0.0712
  ..$ speed     : num 0.00288
  ..$ colour    : num -0.256
  ..$ DvegaDtime: num -44.9
  ..$ vomma     : num 3.02
  ..$ dualdelta : num 0.737
  ..$ dualgamma : num 0.045
GSee
  • 48,880
  • 13
  • 125
  • 145
  • I am using R version 3.1.1..Just took your advice and tried installing rgreeks package but got an error as"rgreeks" is not available for this 3.1.1. version – user3581330 Jul 29 '14 at 11:40
  • You have to [check it out](https://code.google.com/p/rgreeks/source/checkout) and build/install it yourself. See http://stackoverflow.com/questions/11105131/cannot-install-r-forge-package-using-install-packages – GSee Jul 29 '14 at 11:41
  • Thanks. I am a naive R programmer so a bit difficult but I will give a try. – user3581330 Jul 30 '14 at 11:17
  • @user3581330 You don't have to install the package. You can browse the source code online: https://code.google.com/p/rgreeks/source/browse/trunk/pkg/R/greeks.R – GSee Jul 30 '14 at 12:13
  • I believe the Charm here has an incorrect sign. This is an OTM call and ITM put, so the sign should be negative for both: ["Charm values range from -1.0 to +1.0. In the money (ITM) calls and out of the money (OTM) puts have positive charms, while ITM puts and OTM calls have negative charms."](https://www.investopedia.com/terms/c/charm.asp). Also Veta (DvegaDtime) should be negative: ["DvegaDtime is expressed as negative partial derivative"](https://fincyclopedia.net/derivatives/d/dvegadtime). – haydenr4 Jan 09 '23 at 02:02