summaryrefslogtreecommitdiffstats
path: root/c_layer
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@serenitascapital.com>2016-11-15 09:54:46 -0500
committerGuillaume Horel <guillaume.horel@serenitascapital.com>2016-11-15 09:54:46 -0500
commita5025ce33baad083ead22f3cff92fc88d0e2687a (patch)
tree3ed471f05100a5745828cb8d7a8688ab220d1439 /c_layer
parent76064859c2d24ea1c44aa9839e09bfdada284000 (diff)
downloadpyisda-gsl.tar.gz
Use gsl brent solvergsl
slower than the jpm's one
Diffstat (limited to 'c_layer')
-rw-r--r--c_layer/cdsbootstrap.c13
-rw-r--r--c_layer/cdsbootstrap.h5
2 files changed, 4 insertions, 14 deletions
diff --git a/c_layer/cdsbootstrap.c b/c_layer/cdsbootstrap.c
index f3ae975..6b0a4cd 100644
--- a/c_layer/cdsbootstrap.c
+++ b/c_layer/cdsbootstrap.c
@@ -1,12 +1,6 @@
#include "cdsbootstrap.h"
-int cdsBootstrapPointFunction
-(double hazardRate,
- void *data,
- double *pv)
-{
- int status = FAILURE;
-
+double cdsBootstrapPointFunction(double hazardRate, void *data) {
cds_bootstrap_ctx *context = (cds_bootstrap_ctx*)data;
TCurve *discountCurve = context->discountCurve;
@@ -27,7 +21,6 @@ int cdsBootstrapPointFunction
cdsCurve,
context->recoveryRate,
&pvC) != SUCCESS)
- goto done;
if (JpmcdsFeeLegPV(context->fl,
cdsBaseDate,
@@ -37,10 +30,8 @@ int cdsBootstrapPointFunction
cdsCurve,
1,
&pvF) != SUCCESS)
- goto done;
/* Note: price is discounted to cdsBaseDate */
- *pv = pvC - context->spread * pvF;
- status = SUCCESS;
+ return pvC - context->spread * pvF;
done:
diff --git a/c_layer/cdsbootstrap.h b/c_layer/cdsbootstrap.h
index 2e19189..5a50962 100644
--- a/c_layer/cdsbootstrap.h
+++ b/c_layer/cdsbootstrap.h
@@ -21,6 +21,5 @@ typedef struct
} cds_bootstrap_ctx;
-int cdsBootstrapPointFunction(double hazardRate,
- void *data,
- double *pv);
+double cdsBootstrapPointFunction(double hazardRate,
+ void *data);