-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathinterestrate.i
85 lines (78 loc) · 2.81 KB
/
interestrate.i
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#ifndef quantlib_interest_rate_i
#define quantlib_interest_rate_i
%include common.i
%include types.i
%include daycounters.i
%include stl.i
%{
using QuantLib::Compounding;
using QuantLib::Simple;
using QuantLib::Compounded;
using QuantLib::Continuous;
using QuantLib::SimpleThenCompounded;
using QuantLib::CompoundedThenSimple;
%}
enum Compounding {
Simple,
Compounded,
Continuous,
SimpleThenCompounded,
CompoundedThenSimple
};
%{
using QuantLib::InterestRate;
%}
class InterestRate {
public:
InterestRate();
InterestRate(Rate r,
const DayCounter& dc,
Compounding comp,
Frequency freq);
Rate rate() const;
DayCounter dayCounter() const;
Compounding compounding() const;
Frequency frequency() const;
DiscountFactor discountFactor(Time t) const;
DiscountFactor discountFactor(const Date& d1, const Date& d2,
const Date& refStart = Date(),
const Date& refEnd = Date()) const;
Real compoundFactor(Time t) const;
Real compoundFactor(const Date& d1, const Date& d2,
const Date& refStart = Date(),
const Date& refEnd = Date()) const;
static InterestRate impliedRate(Real compound,
const DayCounter& resultDC,
Compounding comp,
Frequency freq,
Time t);
static InterestRate impliedRate(Real compound,
const DayCounter& resultDC,
Compounding comp,
Frequency freq,
const Date& d1,
const Date& d2,
const Date& refStart = Date(),
const Date& refEnd = Date());
InterestRate equivalentRate(Compounding comp,
Frequency freq,
Time t) const;
InterestRate equivalentRate(const DayCounter& resultDayCounter,
Compounding comp,
Frequency freq,
const Date& d1,
const Date& d2,
const Date& refStart = Date(),
const Date& refEnd = Date()) const;
%extend {
std::string __str__() {
std::ostringstream out;
out << *self;
return out.str();
}
}
};
namespace std {
%template(InterestRateVector) vector<InterestRate>;
}
#endif //quantlib_interest_rate_i