summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2023-06-14 10:56:02 -0400
committerGuillaume Horel <guillaume.horel@gmail.com>2023-06-14 10:56:02 -0400
commit9adda33ccf0c330e49ada82b43483345128d79ae (patch)
treedc166a1136f3eb3c57ccbac94444ece7ea8cf074
parentdb21c183b06a09a417a8fa777fbe54d8d1e1cab7 (diff)
downloadpyisda-9adda33ccf0c330e49ada82b43483345128d79ae.tar.gz
do additive shock, multiplicative is too tricky to get right
-rw-r--r--pyisda/curve.pyx6
1 files 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 = <double*>malloc(sizeof(double) * n1)
t = <int*>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