April 2019
Intermediate to advanced
426 pages
11h 13m
English
Let's create a TrinomialTreeOption class, inheriting from the BinomialTreeOption class.
The methods for the TrinomialTreeOption are provided as follows:
def setup_parameters(self): """ Required calculations for the model """ self.u = math.exp(self.sigma*math.sqrt(2.*self.dt)) self.d = 1/self.u self.m = 1 self.qu = ((math.exp((self.r-self.div) * self.dt/2.) - math.exp(-self.sigma * math.sqrt(self.dt/2.))) / (math.exp(self.sigma * math.sqrt(self.dt/2.)) - math.exp(-self.sigma * math.sqrt(self.dt/2.))))**2 self.qd = ((math.exp(self.sigma * math.sqrt(self.dt/2.)) - math.exp((self.r-self.div) ...