summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2019-01-17 18:03:53 -0500
committerGuillaume Horel <guillaume.horel@gmail.com>2019-01-17 18:03:53 -0500
commit85b4668fbac96b880fcb4c25d3f058fe62c4f171 (patch)
treed0789446af7eeb989044b85fb55089958fd0dc0f
parentbbd8ae7cb78fba1dc7d3d0cd6996e127a824ca9f (diff)
downloadpyisda-85b4668fbac96b880fcb4c25d3f058fe62c4f171.tar.gz
wider bracket
-rw-r--r--c_layer/cdsbootstrap.c2
-rw-r--r--pyisda/optim.pyx6
2 files changed, 4 insertions, 4 deletions
diff --git a/c_layer/cdsbootstrap.c b/c_layer/cdsbootstrap.c
index f3ae975..b0aa004 100644
--- a/c_layer/cdsbootstrap.c
+++ b/c_layer/cdsbootstrap.c
@@ -45,6 +45,6 @@ int cdsBootstrapPointFunction
done:
if (status != SUCCESS)
- printf("Something went wrong");
+ printf("Something went wrong: %f\n", hazardRate);
return status;
}
diff --git a/pyisda/optim.pyx b/pyisda/optim.pyx
index a3a4143..bb1f722 100644
--- a/pyisda/optim.pyx
+++ b/pyisda/optim.pyx
@@ -107,7 +107,7 @@ def init_context(YieldCurve yc not None, trade_date, value_date, start_date,
@cython.cdivision(True)
-cdef api double pv(double Z, void* ctx):
+cdef api double pv(double Z, void* ctx) nogil:
cdef:
my_ctx* params_ext = <my_ctx*>ctx
cds_bootstrap_ctx* params = &params_ext.params
@@ -115,7 +115,7 @@ cdef api double pv(double Z, void* ctx):
double S = params_ext.S0 * exp(-0.5 * sigmaT * sigmaT + sigmaT * Z)
double guess = S / ( 1 - params.recoveryRate) * 365. / 360.
double lo = guess * 0.9
- double hi = guess * 1.1
+ double hi = guess * 1.5
double h
double coupon_leg_pv
params.spread = S
@@ -169,7 +169,7 @@ def expected_pv(double[:] tilt, double[:] w, double S0, object ctx):
S = S0 * tilt[i] * 1e-4
guess = S / ( 1 - params.recoveryRate) * 365. / 360.
lo = guess * 0.9
- hi = guess * 1.1
+ hi = guess * 1.5
params.spread = S
if JpmcdsRootFindBrent(<TObjectFunc>cdsBootstrapPointFunction,
<void*>params,