Another way to get the greeks besides Jeff's excellent package could be with AD tools in R.

I just noticed that there was a GSOC to add automatic differentiation in R and

the package radx on github looks promising. One could to automagically compute

greeks on the fly for free.

Here is a little code snippet that computes the option price and magically gives you the delta for free!

>>>>

#require(devtools) #make sure we have devtools installed

#install_github("radx","quantumelixir") #install radx from github

rm(list=ls())

require(radx)

FT<-1.35

X<-1.32

Time<-1/4

rate<-0.01

vol<-0.12

putcall<-"C"

#Simple blackscholesmerton pricer for options

bspricer <- function(putcall,vol,FT,X,Time,rate)

{

d1 <- (log(FT/X)+(rate+0.5*(vol*vol))*Time)/(vol*sqrt(Time))

d2 <- d1-vol*sqrt(Time)

FT=radx(FT,1) # this is where all the magic happens

if(putcall=="C") {

return((FT*pnorm(d1)-X*exp(-rate*Time)*pnorm(d2)))

} else {

return((X*exp(-rate*Time)*pnorm(-d2)-FT*pnorm(-d1)))

}

}

#Calling this function below

>bspricer(putcall,vol,FT,X,Time,rate)

Value : 0.05128281

Coefficients:[1] 0.6722788

Derivatives :[1] 0.6722788

Order : 1

Directions : 1

>>>>>>>

So no more worries around the appropriate shift in finite difference methods, roundoff errors from machine

precision issues (IEEE 754) or knowing the exact analytical formula for the greeks.

Cheers

Krishna

On Aug 25, 2013, at 11:14 AM, Jeff Ryan wrote:

> Hi John,

>

> I have a package that isn't quite 'complete' that might be of use.

>

>

https://code.google.com/p/rgreeks/>

> I'm intending on pushing what is complete to CRAN this week.

>

> I also gave a lightning talk at R/Finance this year as a quick 5 min

> overview:

>

>

http://www.rinfinance.com/agenda/2013/talk/JeffRyan.pdf>

> HTH

> Jeff

>

>

> On Fri, Aug 23, 2013 at 4:32 PM, BBands <

[hidden email]> wrote:

>

>> The options solution I have used forever no longer works well, so I am

>> looking for a new option analysis solution. My needs are rather

>> simple, really all I want are nice P&L graphs for option positions

>> with a number of legs. Flexibility is key. I was thinking about

>> Hoadley, which I have used on and off, but I am no longer a fan of

>> analytics in Excel. So I thought that this might be a chance to expand

>> my R skills. I've seen a couple of ideas and there must be a ton of R

>> solutions that I am not aware of. This is one that I have found:

>>

http://www.r-bloggers.com/scenario-analysis-and-trading-options-using-r/>> Do you know of any that are particularly elegant or that you like well?

>>

>> Thanks,

>>

>> John

>> --

>> John Bollinger

>> www.BollingerBands.com

>>

>> _______________________________________________

>>

[hidden email] mailing list

>>

https://stat.ethz.ch/mailman/listinfo/r-sig-finance>> -- Subscriber-posting only. If you want to post, subscribe first.

>> -- Also note that this is not the r-help list where general R questions

>> should go.

>>

>

>

>

> --

> Jeffrey Ryan

>

[hidden email]
>

> www.lemnica.com

>

> [[alternative HTML version deleted]]

>

> _______________________________________________

>

[hidden email] mailing list

>

https://stat.ethz.ch/mailman/listinfo/r-sig-finance> -- Subscriber-posting only. If you want to post, subscribe first.

> -- Also note that this is not the r-help list where general R questions should go.

[[alternative HTML version deleted]]

_______________________________________________

[hidden email] mailing list

https://stat.ethz.ch/mailman/listinfo/r-sig-finance-- Subscriber-posting only. If you want to post, subscribe first.

-- Also note that this is not the r-help list where general R questions should go.