# How to obtain the discount curve under Vasicek interest rate for discounting cash flow?

Suppose that the spot rate is governed by a Vasicek model. We know that there is an analytical solution for the zero-coupon bond.

I guess the discount curve is constructed by the Yield curve in which we have that

$$$$y(t, T) = -\frac{lnP(t, T)}{(T-t)}$$$$
where $$P(t, T)$$ represents the zero-coupon bond price with maturity time $$T$$. By the way, the solution for the zero-coupon bond price takes the following form: $$$$P(t, T) = exp\{A(t, T)-B(t, T)r(t)\}$$$$ where $$A(.,.)$$ and $$B(.,.)$$ are deterministic functions. We thus have $$$$y(t, T) = -\frac{A(t, T)}{(T-t)} + \frac{B(t, T)}{(T-t)}r(t)$$$$

My problem is when I try to plot the yield curve for different maturity times it seems there is something wrong. Here are my R codes and the output. I do not know if I am thinking right about the discounting curve.

r0<- 0.03

theta<- 0.10546209

kappa<- 0.04802047

sigma<- 0.29051285

T<- seq(0, 1, by= 1/252 )

g<- function(kappa, theta, sigma, t, T){

B<- (1-exp(-kappa*(T-t)))/(kappa)

A<- (theta-  ((sigma^2)/(2*kappa^2))  )*(  B- T+t   ) - ( (sigma^2)/(4*kappa) )*B^2

h<- -(A/(T-t))+(B/(T-t))*r0

return(h)

}

y<- numeric(length(T))

for(i in 1:length(y) ){

y[i]<- g(kappa, theta, sigma, 0, T[i])

}
plot(T,y, type="l")


• Looks ok to me. Some parameter combinations will result in ‚strange‘ yield curves. Jul 14 at 17:37
• Thank you for your answer. so, you believe the discount curve is in fact the Yield curve and not the zero-coupon price? Because I wanted to discount my cash flow. Jul 14 at 18:08
• I was able to replicate your zero coupon yield curve; hopefully we‘re not both wrong ;) Jul 14 at 18:44
• Thank you, my friend. Jul 14 at 19:02