public override void Visit(VasicekModel model) { // Price a put or call using Jamshidian (1989) if (type == OptionType.Call) { price = CallPrice(model); // implements Jamshidian 1989 } else { price = PutPrice(model); // implements Jamshidian 1989 } }
private double PutPrice(VasicekModel model) { double nu = 0.5 * model.vol * model.vol * (1.0 - Exp(-2.0 * model.kappa * (T - t))) / model.kappa; nu = Sqrt(nu); double sigP = nu * (1.0 - Exp(-model.kappa * (s - T))) / model.kappa; double d1 = (Log(model.P(t, s) / (model.P(t, T) * K)) / sigP) + 0.5 * sigP; double d2 = d1 - sigP; return(K * model.P(t, T) * N(-d2) - model.P(t, s) * N(-d1)); }