From 9adda33ccf0c330e49ada82b43483345128d79ae Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Wed, 14 Jun 2023 10:56:02 -0400 Subject: do additive shock, multiplicative is too tricky to get right --- pyisda/curve.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pyisda/curve.pyx b/pyisda/curve.pyx index e467d9e..1eadc2e 100644 --- a/pyisda/curve.pyx +++ b/pyisda/curve.pyx @@ -658,7 +658,7 @@ cdef class YieldCurve(Curve): i = 0 j = 0 while i < n1 and j < n2: - cs.s.push_back(f1[i] / f2[j] - 1) + cs.s.push_back(f1[i] - f2[j]) if t1[i] < t2[j]: cs.t.push_back(t1[i]) i += 1 @@ -694,12 +694,12 @@ cdef class YieldCurve(Curve): n1 = curve.fNumItems f = malloc(sizeof(double) * n1) t = malloc(sizeof(int) * n1) - forward_rates(curve.fArray, curve.fBaseDate, n1, f, t) + forward_rates(curve.fBasis, curve.fArray, curve.fBaseDate, n1, f, t) i = 0 j = 0 while i < n1 and j < shock.t.size(): - f_shocked.push_back(f[i] * (1 + shock.s[j])) + f_shocked.push_back(f[i] + shock.s[j]) if t[i] < shock.t[j]: t_shocked.push_back(t[i]) i += 1 -- cgit v1.2.3-70-g09d2