# Bond pricing with HJM simulation

I'm using Glasserman 3.16 and 3.17 algorithm to price bonds. The algorithms evaluates the forward rates and the discount factor $B(0,t_j)$.

My question is: How can I price bonds in a future time? I want to calculate $B(t_i,t_j)$ bond prices at time $t_i>0$.

My idea was to use the basic discrete bond price formula:

$B(t_i,t_j)=\exp\left(-\sum_{l=i}^{j-1}f(t_i,t_l)(t_{l+1}-t_l)\right)$

while I'm using the forward rates that I calculated from algorithm 3.17. But I'm not sure if it's correct.

For example my time-grid is $0=t_0<t_1=0.25<t_2=0.5<\dots<t_M$. I calculate bond price $B(0.25,0.5)=0.990605$ (which is same as $B(0,0.25)$ evaluated from my initial forward rates), but if I calculate $B(0.25,0.5)$ from my yield data matrix, I get $B(0.25,0.5)=0.9938$ (I assume that at time $0$, $B(0.25,0.5)$ should be close to $B(0,0.25)$ at time $0.25$.)

More details: I have my initial forward rates $f(0,t_1),\dots,f(0,t_M)$

I calculate $f(t_1,t_1)$ with $f(t_1,t_1)\leftarrow f(0,t_1)+\mu(0,t_1)*\sum_{k=1}^{d}\sigma_k(t_0,t_1)*Z_i$, where $Z_i \sim N(0,\sqrt{t_1-t_0})$.

From my bond price formula: $B(t_1,t_2)=\exp\left(-\sum_{l=1}^{1}f(t_1,t_l)(t_{l+1}-t_l)\right)=\exp(-f(t_1,t_1)(t_2-t_1))$