The zerorate calculation of the svensson discount function has an error:
109 Real zeroRate = x[0] + (x[1] + x[2])*
110 (1.0 - std::exp(-kappa*t))/
111 ((kappa+QL_EPSILON)*(t+QL_EPSILON)) -
112 (x[2])*std::exp(-kappa*t) +
113 x[3]* (((1.0 - std::exp(-kappa*t))/((kappa_1+QL_EPSILON)*(t+QL_EPSILON)))- std::exp(-kappa_1*t));
in line 113 kappa is used instead of kappa_1
correct is this:
109 Real zeroRate = x[0] + (x[1] + x[2])*
110 (1.0 - std::exp(-kappa*t))/
111 ((kappa+QL_EPSILON)*(t+QL_EPSILON)) -
112 (x[2])*std::exp(-kappa*t) +
113 x[3]* (((1.0 - std::exp(-kappa_1*t))/((kappa_1+QL_EPSILON)*(t+QL_EPSILON)))- std::exp(-kappa_1*t));
The bug is now fixed in the Subversion repository.
Thank you for the report.