In the binomial tree pricing models that we have covered so far, we traversed up and down the tree at each point in time to determine the node values. From the information at each node, we can reuse these computed values easily. One such use is the computation of Greeks.
The Greeks measures the sensitivities of the price of derivatives such as options with respect to changes in parameters of its underlying asset, often represented by Greek letters. In mathematical finance, the common names associated with Greeks include: alpha, beta, delta, gamma, vega, theta, and rho.
Two particularly useful Greeks for options are delta and gamma. Delta measures the sensitivity of the option price with respect to the underlying asset price. Gamma measures the rate of change in delta with respect to the underlying price.
As shown in the following figure, an additional layer of nodes is added around our original two-step tree to make it a four-step tree, which extends two steps backward in time. Even with additional terminal payoff nodes, all nodes will contain the same information as our original two-step tree. Our option value of interest is now located in the middle of the tree at t=0:
Notice that at t=0 there exists two additional nodes' worth of information that we can use to compute the delta formula as follows:
The delta formula states that the difference in the option prices in the up and down state is represented as a unit of the difference between the respective stock prices at time t=0.
Conversely, the gamma formula can be computed as follows:
The gamma formula states that the difference of deltas between the option prices in the up node and the down node against the initial node value are computed as a unit of the differences in price of the stock at the respective states.
To illustrate the computation of Greeks with the LR tree, let's create a new class named BinomialLRWithGreeks
that inherits the BinomialLROption
class with our own implementation of the price
method.
In the price
method, we will start by calling the _setup_parameters_
method of the parent class to initialize all variables required by the LR tree. However, this time we will also call the __new_stock_price_tree__
method, which is a new private method specially used to create an extra layer of nodes around the original tree.
The __begin_tree_traversal__
method is called to perform the usual LR tree implementation in the parent class. The returned NumPy array object now contains the information on the three nodes at t=0, where the middle node is the option price. The payoffs in the up and down states at t=0 are in the first and last index of the array respectively.
With this information, the price
method computes and returns the option price, and the delta and the gamma values together:
""" Compute option price, delta and gamma by the LR tree """ from BinomialLROption import BinomialLROption import numpy as np class BinomialLRWithGreeks(BinomialLROption): def __new_stock_price_tree__(self): """ Create additional layer of nodes to our original stock price tree """ self.STs = [np.array([self.S0*self.u/self.d, self.S0, self.S0*self.d/self.u])] for i in range(self.N): prev_branches = self.STs[-1] st = np.concatenate((prev_branches * self.u, [prev_branches[-1] * self.d])) self.STs.append(st) def price(self): self._setup_parameters_() self.__new_stock_price_tree__() payoffs = self.__begin_tree_traversal__() """ Option value is now in the middle node at t=0""" option_value = payoffs[len(payoffs)/2] payoff_up = payoffs[0] payoff_down = payoffs[-1] S_up = self.STs[0][0] S_down = self.STs[0][-1] dS_up = S_up - self.S0 dS_down = self.S0 - S_down """ Get delta value """ dS = S_up - S_down dV = payoff_up - payoff_down delta = dV/dS """ Get gamma value """ gamma = ((payoff_up-option_value)/dS_up - (option_value-payoff_down)/dS_down) / ((self.S0+S_up)/2. - (self.S0+S_down)/2.) return option_value, delta, gamma
Using the same example from the LR tree, we can compute the option values and Greeks for an European call and put option with 300 time steps:
>>> from BinomialLRWithGreeks import BinomialLRWithGreeks >>> eu_call = BinomialLRWithGreeks( ... 50, 50, 0.05, 0.5, 300, {"sigma": 0.3, "is_call": True}) >>> results = eu_call.price() >>> print "European call values" >>> print "Price: %s Delta: %s Gamma: %s" % results European call values Price: 4.80386465741 Delta: 0.588801522182 Gamma: 0.0367367823884 >>> eu_put = BinomialLRWithGreeks( ... 50, 50, 0.05, 0.5, 300, {"sigma":0.3, "is_call": False}) >>> results = eu_put.price() >>> print "European put values" >>> print "Price: %s Delta: %s Gamma: %s" % results European put values Price: 3.56936025883 Delta: -0.411198477818 Gamma: 0.0367367823884
As shown from the price
method and results, we managed to obtain additional information on Greeks from the modified binomial tree without any extra overhead in computational complexity.