April 2019
Intermediate to advanced
426 pages
11h 13m
English
The Python implementation of the LR tree is given in the following BinomialLROption class. Similar to the BinomialCRROption class, we simply inherit the BinomialTreeOption class and override the variables in the setup_parameters method with those of the LR tree model:
In [ ]: import math """ Price an option by the Leisen-Reimer tree """ class BinomialLROption(BinomialTreeOption): def setup_parameters(self): odd_N = self.N if (self.N%2 == 0) else (self.N+1) d1 = (math.log(self.S0/self.K) + ((self.r-self.div) + (self.sigma**2)/2.)*self.T)/\ (self.sigma*math.sqrt(self.T)) d2 = (math.log(self.S0/self.K) + ((self.r-self.div) - (self.sigma**2)/2.)*self.T)/\ (self.sigma * math.sqrt(self.T)) ...
Read now
Unlock full access