So far, we have used the Vasicek model in our short-rate process to model a zero-coupon bond. We can undergo policy iteration by finite differences to check for early-exercise conditions and their effect on other nodes. We will use the implicit method of finite differences for the numerical pricing procedure, as discussed in Chapter 4, Numerical Procedures for Pricing Options.
Let's create a class named VasicekCZCB, which will incorporate all the methods used to implement the pricing of callable zero-coupon bonds by the Vasicek model. The class with its constructor definition is given as follows:
import mathimport numpy as npimport scipy.stats as stclass VasicekCZCB: def __init__(self): self.norminv ...