April 2019
Intermediate to advanced
426 pages
11h 13m
English
In Python, let's create a class named TrinomialLattice for the trinomial lattice implementation that inherits from the TrinomialTreeOption class.
Just as we did for the BinomialCRRLattice class, the setup_parameters, init_stock_price_tree, init_payoffs_tree, and check_early_exercise methods are overwritten, without having to take into account the payoffs at odd nodes:
In [ ]: import numpy as np """ Price an option by the trinomial lattice """ class TrinomialLattice(TrinomialTreeOption): def setup_parameters(self): super(TrinomialLattice, self).setup_parameters() self.M = 2*self.N + 1 def init_stock_price_tree(self): self.STs = np.zeros(self.M) self.STs[0] = self.S0 * self.u**self.N ...
Read now
Unlock full access