summaryrefslogtreecommitdiffstats
path: root/c_layer/curve.hpp
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2019-02-22 17:11:42 -0500
committerGuillaume Horel <guillaume.horel@gmail.com>2019-02-22 17:11:42 -0500
commitea4ca5a28b9bf9c8eec3d727dc35b6863c1f5d01 (patch)
tree81616f79a1b5dcf4a1fe0b9cededd22542fc144c /c_layer/curve.hpp
parenta0e798113024114c3002e3eee1e09ae194dbf3f4 (diff)
downloadpyisda-ea4ca5a28b9bf9c8eec3d727dc35b6863c1f5d01.tar.gz
bugfixesmore_cpp
Diffstat (limited to 'c_layer/curve.hpp')
-rw-r--r--c_layer/curve.hpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/c_layer/curve.hpp b/c_layer/curve.hpp
index 5cc796a..39fdce9 100644
--- a/c_layer/curve.hpp
+++ b/c_layer/curve.hpp
@@ -5,6 +5,7 @@
#include "isda/bastypes.h"
#include "isda/cdate.h"
#include "isda/tcurve.h"
+#include <iostream>
namespace pyisda {
class Curve {
@@ -17,7 +18,7 @@ namespace pyisda {
~Curve() {
JpmcdsFreeTCurve(ptr);
}
- explicit operator TCurve*() const { return ptr; }
+ TCurve* get_TCurve() const {return ptr; }
unsigned char* serialize(unsigned char* buf);
double zeroPrice(const TDate date);
double zeroPrice(const TDate date1, const TDate date2);
@@ -36,7 +37,7 @@ namespace pyisda {
public:
YieldCurve(TCurve* const curve, const std::vector<TDate>& dates) :
Curve(curve),
- dates(dates) {};
+ dates(std::move(dates)) {};
YieldCurve(const YieldCurve &curve2) :
Curve(curve2),
dates(std::move(curve2.dates)) {};
@@ -47,18 +48,29 @@ namespace pyisda {
class SpreadCurve : public Curve {
public:
+ enum Seniority {
+ Senior,
+ Subordinated
+ };
+
SpreadCurve(TCurve* const curve, const std::vector<double>& recovery_rates,
- const std::string& ticker) :
+ const std::string& ticker, TDate event_date = -1,
+ Seniority sen = Senior) :
Curve(curve),
recovery_rates(recovery_rates),
- ticker(ticker) {};
+ ticker(ticker),
+ event_date(event_date),
+ seniority(sen) {};
SpreadCurve(const SpreadCurve &curve2) :
Curve(curve2),
recovery_rates(std::move(curve2.recovery_rates)),
- ticker(std::move(curve2.ticker)) {};
-
+ ticker(std::move(curve2.ticker)),
+ event_date(curve2.event_date),
+ seniority(curve2.seniority) {};
std::vector<double> recovery_rates;
std::string ticker;
+ TDate event_date;
+ SpreadCurve::Seniority seniority;
size_t size();
unsigned char* serialize(unsigned char* buf);
};