Re: [Quantlib-users] Binomial Engines - Greeks

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [Quantlib-users] Binomial Engines - Greeks

Joe Byers-2
Luigi,

Several of the greeks from a tree can be calculated from the current tree in memory.  The Delta and Gamma are calculated using numerical differencing of the next two time steps.  Theta requires the suggetion you provided below.  If you also calculated the delta and gamma off your time shifted tree, you are calculating the d theta-ddelta and d theta-dgamma or second order derivatives.  Vega and rho require also require a new tree calculation and a numerical differenceing using sigma+h or rate+h where h is a small increment but all other parameters are constant.

Good Luck
Joe


1. Re: Binomial Engines - Greeks (Luigi Ballabio)
2. Re: Path dependent interest rate instruments? (Luigi Ballabio)
From: Luigi Ballabio <[hidden email]>
CC: [hidden email], [hidden email]
To: "Toyin Akin" <[hidden email]>
Date: Sat, 15 Jul 2006 11:51:41 +0200
Subject: Re: [Quantlib-users] Binomial Engines - Greeks


On Jun 21, 2006, at 4:22 PM, Toyin Akin wrote:
> Normally pricing American options is done accurately via a tree and
> it's hard to believe that Quantlib (well I think this is the case)
> does not provide greeks for this common option type.
>
> Any ideas or suggestions on the best way of enabling the
> BinomialEngine class to ouput the greek results?

Toyin,
apologies for the delay. Usually we tend not to provide numerical
greeks, as the user can bump parameters himself---and moreover, he
could bump them of the quantity he likes instead of the one we though
sensible.

Instead, I think an often used trick for calculating Greeks on trees is
to move the tree origin a bit back in time so that the tree has three
nodes at today's date, the central one corresponding to the spot value.
Delta and Gamma can then be calculated by a difference formula. This is
an approach I'd like to have in the library if someone contributed it
(hint, hint...)

Later,
Luigi



From: Luigi Ballabio <[hidden email]>
CC: [hidden email]
To: "Giorgio Pazmandi" <[hidden email]>
Date: Sat, 15 Jul 2006 11:59:47 +0200
Subject: Re: [Quantlib-users] Path dependent interest rate instruments?


On Jul 12, 2006, at 10:47 AM, Giorgio Pazmandi wrote:
> I'm going to deal with IR Path Dependent instruments (like TARN,
> Snowball
> ecc).
>
> Has anybody developed or tested some of this instruments?

Not the instruments themselves. However, an implementation of the Libor
market model is available and another one is underway. You might try
starting from this.

Later,
Luigi




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users



A man is not the center of his universe, rather those he loves are. So his focus should always be on them for they will provide him with love and happiness all of his life - Anonymous


Talk is cheap. Use Yahoo! Messenger to make PC-to-Phone calls. Great rates starting at 1¢/min.
Reply | Threaded
Open this post in threaded view
|

Re: [Quantlib-users] Binomial Engines - Greeks

Krishna Kumar-2
Here is an R implementation of the  Pelseer/Vorst method for computing
greeks on the tree as in the paper
"The Binomial Model and the Greeks." /Journal of Derivatives/, Spring
1994, 45-49


Best,
Kris


greek.binomial<- function(imod=1, TypeFlag="ce", S=100, X=110, r=0.05, q=0, tyr=1, sigma=0.3, nstep=100)
{
# greek.binomial(imod=1,TypeFlag= "pa", S = 50, X = 50, tyr=5/12, r = 0.1, q = 0, sigma = 0.4, nstep = 50)
# the extended CRR tree with node extensions!.
   if (imod == 2)   nstep <- nstep + nstep%%2
    mstep<-nstep+2
    TypeFlag = TypeFlag[1]
   
    z = NA
   
    if (TypeFlag == "ce" || TypeFlag == "ca")
        z <- +1
    if (TypeFlag == "pe" || TypeFlag == "pa")
        z <- -1
    if (is.na(z)) stop("TypeFlag misspecified: ce|ca|pe|pa")
   dtval = tyr/nstep
   udpvec <- BinTreeParams(imod, S, X, r, q, tyr, sigma, nstep)
   u <- udpvec[1]
   d <- udpvec[2]
   p <- udpvec[3]
   Df = exp(-r * dtval)
   OptionValue = z * (S * u^(0:mstep) * d^(mstep:0) - X)
   OptionValue = (abs(OptionValue) + OptionValue)/2
    if (TypeFlag == "ce" || TypeFlag == "pe") {
        for (j in seq(from = mstep - 1, to = 2, by = -1))
                for (i in 0:j)
                {
        { OptionValue[i + 1] = (p * OptionValue[i + 2] + (1 - p) * OptionValue[i +
            1]) * Df }
                        }
    }
    if (TypeFlag == "ca" || TypeFlag == "pa") {
        for (j in seq(from = mstep - 1, to = 2, by = -1)) for (i in 0:j) OptionValue[i +
            1] = max((z * (S * u^i * d^(abs(i - j)) - X)), (p *
            OptionValue[i + 2] + (1 - p) * OptionValue[i + 1]) *
            Df)
    }
#cat(OptionValue[1]," ", OptionValue[3]," ",OptionValue[2],"\n")
    greek.binomial<-(OptionValue[1]-OptionValue[3])/(S*u^2-S*d^2)


}