interestRate.hpp
Go to the documentation of this file.
1 #ifndef JULIAN_INTERESTRATE_HPP
2 #define JULIAN_INTERESTRATE_HPP
3 
5 #include <cmath>
6 #include <dates/_all_dates.hpp>
7 #include <utils/smartPointer.hpp>
9 
10 namespace julian {
11 
25  class InterestRate {
26  public:
27  InterestRate();
28  InterestRate(const SmartPointer<Compounding>& compounding,const SmartPointer< YearFraction>& year_fraction);
29 
30  double capitalization(Date date1,Date date2, double interest_rate) const;
31  double DF(Date date1,Date date2, double interest_rate) const;
32  double coupon(Date date1,Date date2,double interest_rate) const;
33  double fwdRate(Date date1,Date date2,double df1, double df2) const;
34  double zcRate(Date date1,Date date2, double df) const;
35  double yf(Date date1,Date date2) const;
36 
37  InterestRate* clone() const;
38  ~InterestRate(){};
39 
40  friend std::ostream& operator<<(std::ostream& s, InterestRate& r);
41  friend class boost::serialization::access;
42 
45  template<class Archive>
46  void serialize(Archive & ar, const unsigned int) {
47  ar & BOOST_SERIALIZATION_NVP(year_fraction_);
48  ar & BOOST_SERIALIZATION_NVP(compounding_);
49  }
50  private:
52 
55 
56 };
57 }
58 #endif
double coupon(Date date1, Date date2, double interest_rate) const
Calculates coupon.
Definition: interestRate.cpp:52
File contains template of deep-coping smart pointer.
Contains headers of all files with definitions of classes gathered in dates calendar and holidays mod...
File contains interface of interest rate compounding concept.
File contains interface for year fractions.
InterestRate()
Constructor.
Definition: interestRate.cpp:12
double fwdRate(Date date1, Date date2, double df1, double df2) const
Calculates forward rate.
Definition: interestRate.cpp:63
Definition: cadHoliday.cpp:3
SmartPointer< YearFraction > year_fraction_
Attribute maintaining year fraction convention.
Definition: interestRate.hpp:54
Template of deep-coping smart pointer.
Definition: smartPointer.hpp:14
void serialize(Archive &ar, const unsigned int)
interface used by Boost serialization library
Definition: interestRate.hpp:46
double capitalization(Date date1, Date date2, double interest_rate) const
Calculates capitalization.
Definition: interestRate.cpp:31
SmartPointer< Compounding > compounding_
Attribute maintaining compounding convention.
Definition: interestRate.hpp:51
double zcRate(Date date1, Date date2, double df) const
Calculates zero coupon rate.
Definition: interestRate.cpp:75
friend std::ostream & operator<<(std::ostream &s, InterestRate &r)
Overloads stream operator.
Definition: interestRate.cpp:100
double yf(Date date1, Date date2) const
Calculates year fraction.
Definition: interestRate.cpp:84
InterestRate * clone() const
Virtual copy constructor.
Definition: interestRate.cpp:92
Class implements a date object.
Definition: date.hpp:27
The class implements the concept of interest rate.
Definition: interestRate.hpp:25
double DF(Date date1, Date date2, double interest_rate) const
Calculates discount factor.
Definition: interestRate.cpp:42