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 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
/*
Copyright (C) 2004, 2005 StatPro Italia srl
This file is part of QuantLib, a free-software/open-source library
for financial quantitative analysts and developers - http://quantlib.org/
QuantLib is free software: you can redistribute it and/or modify it
under the terms of the QuantLib license. You should have received a
copy of the license along with this program; if not, please email
<quantlib-dev@lists.sf.net>. The license is also available online at
<http://quantlib.org/license.shtml>.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the license for more details.
*/
#ifndef quantlib_interest_rate_i
#define quantlib_interest_rate_i
%include common.i
%include types.i
%include daycounters.i
%{
using QuantLib::Compounding;
using QuantLib::Simple;
using QuantLib::Compounded;
using QuantLib::Continuous;
using QuantLib::SimpleThenCompounded;
%}
enum Compounding {
Simple,
Compounded,
Continuous,
SimpleThenCompounded
};
%{
using QuantLib::InterestRate;
%}
class InterestRate {
#if defined(SWIGMZSCHEME) || defined(SWIGGUILE)
%rename("day-counter") dayCounter;
%rename("discount-factor") discountFactor;
%rename("compound-factor") compoundFactor;
%rename("implied-rate") impliedRate;
%rename("implied-interest-rate") impliedInterestRate;
%rename("equivalent-rate") equivalentRate;
%rename("equivalent-interest-rate") equivalentInterestRate;
#endif
public:
InterestRate();
InterestRate(Rate r,
const DayCounter& dc,
Compounding comp,
Frequency freq = Annual);
Rate rate() const;
DayCounter dayCounter() const;
Compounding compounding() const;
Frequency frequency() const;
DiscountFactor discountFactor(Time t) const;
DiscountFactor discountFactor(Date d1, Date d2) const;
Real compoundFactor(Time t) const;
Real compoundFactor(Date d1, Date d2) const;
static InterestRate impliedRate(Real compound,
Time t,
const DayCounter& resultDC,
Compounding comp,
Frequency freq = Annual);
static InterestRate impliedRate(Real compound,
const Date& d1,
const Date& d2,
const DayCounter& resultDC,
Compounding comp,
Frequency freq = Annual);
InterestRate equivalentRate(Time t,
Compounding comp,
Frequency freq = Annual) const;
InterestRate equivalentRate(const Date& d1,
const Date& d2,
const DayCounter& resultDayCounter,
Compounding comp,
Frequency freq = Annual) const;
%extend {
std::string __str__() {
std::ostringstream out;
out << *self;
return out.str();
}
}
};
#endif
|