diff options
| -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, |
