diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2019-01-17 18:03:53 -0500 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2019-01-17 18:03:53 -0500 |
| commit | 85b4668fbac96b880fcb4c25d3f058fe62c4f171 (patch) | |
| tree | d0789446af7eeb989044b85fb55089958fd0dc0f | |
| parent | bbd8ae7cb78fba1dc7d3d0cd6996e127a824ca9f (diff) | |
| download | pyisda-85b4668fbac96b880fcb4c25d3f058fe62c4f171.tar.gz | |
wider bracket
| -rw-r--r-- | c_layer/cdsbootstrap.c | 2 | ||||
| -rw-r--r-- | pyisda/optim.pyx | 6 |
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 = ¶ms_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, |
