As we explained in the introductory part of this chapter, Greeks are partial derivatives. Some important Greeks are as follows:
In some simple cases, these partial derivatives can be found analytically. For example, the fOptions
package includes the GBSGreeks
function that gives the Greeks for vanillas.
Analytical Greeks are convenient; however, there are two problems with them. The first problem is that market-traded parameters are not changing in infinitesimal small increments. For example, on the New York Stock Exchange, the smallest possible change in the stock price is one cent. The stock price either changes at least one cent or there is no change at all. On the OTC (over-the-counter), FX market traders are quoting volatility as an integer multiple of 0.0005. The second problem with analytical Greeks comes from the fact that for many exotics, we have no closed formula. We still need to know the Greeks anyway, because we would like to sum them up to get the Greeks for the portfolio. Adding up analytical Greeks and numerical ones can lead to errors, so using numerical Greeks is a much safer way.
The GetGreeks
function calculates any Greeks for any pricing function:
GetGreeks <- function(FUN, arg, epsilon,...) { all_args1 <- all_args2 <- list(...) all_args1[[arg]] <- as.numeric(all_args1[[arg]] + epsilon) all_args2[[arg]] <- as.numeric(all_args2[[arg]] - epsilon) (do.call(FUN, all_args1)@price - do.call(FUN, all_args2)@price) / (2 * epsilon) }
OTC market makers do not quote FX volatility in any quantities, but normally, as an integer multiple of 0.0005, a typical quote for AUDUSD at-the-money volatility is 5.95 percent/6.05 percent. Of course, for exchange-traded derivatives that are quoted in price instead of volatility, the price-change-implied volatility change could be smaller than 0.0005.
So when we calculate vega numerically, we should set epsilon to 0.0005 as a market consistent smallest possible change; for example, to calculate a delta of an AUDUSD option, we can set epsilon as 0.0001 (one pip), or for a stock, we can set epsilon as 0.01 (one cent). It is also useful to adjust epsilon to 1/365 (one day) for theta, and to 0.0001 (one basis point) for rho.
The following code plots the delta, vega theta, and rho for a FloatingStrikeLookbackOption
:
x <- seq(10, 200, length = 200) delta <- vega <- theta <- rho <- rep(0, 200) for(i in 1:200){ delta[i] <- GetGreeks(FUN = FloatingStrikeLookbackOption, arg = 2, epsilon = 0.01, "p", x[i], 100, 1, 0.02, -0.02, 0.2) vega[i] <- GetGreeks(FUN = FloatingStrikeLookbackOption, arg = 7, epsilon = 0.0005, "p", x[i], 100, 1, 0.02, -0.02, 0.2) theta[i] <- GetGreeks(FUN = FloatingStrikeLookbackOption, arg = 4, epsilon = 1/365, "p", x[i], 100, 1, 0.02, -0.02, 0.2) rho[i] <- GetGreeks(FUN = FloatingStrikeLookbackOption, arg = 5, epsilon = 0.0001, "p", x[i], 100, 1, 0.02, -0.02, 0.2) } par(mfrow = c(2, 2)) plot(x, delta, type = "l", xlab = "S", ylab = "", main = "Delta") plot(x, vega, type = "l", xlab = "S", ylab = "", main = "Vega") plot(x, theta, type = "l", xlab = "S", ylab = "", main = "Theta") plot(x, rho, type = "l", xlab = "S", ylab = "", main = "Rho")
The preceding code gives the following output:
3.22.181.81