ForwardCurve.hpp
Go to the documentation of this file.
1 #ifndef JULIAN_FORWARDCURVE_HPP
2 #define JULIAN_FORWARDCURVE_HPP
3 
4 #include <vector>
5 #include <utils/SmartPointer.hpp>
7 #include <dates/date.hpp>
9 #include <utils/utils.hpp>
10 #include <boost/serialization/export.hpp>
11 namespace julian {
12 
27  class ForwardCurve {
28  public:
29  ForwardCurve();
30  ForwardCurve(const Date as_of_date, const SmartPointer<Interpolation>& interpolation,const SmartPointer<YearFraction>& yf, const std::vector<Date>& dates, const std::vector<double>& prices);
31 
32  double getForwardPrice(Date d);
33 
34  std::vector<Date> getDates();
35 
36  friend std::ostream& operator<<(std::ostream&, ForwardCurve&);
37  friend class boost::serialization::access;
38  private:
39  template<class Archive>
40  void serialize(Archive & ar, const unsigned int);
41 
45  std::vector<Date> dates_;
46  std::vector<double> time_;
47  std::vector<double> prices_;
48  };
49 
52  template<class Archive>
53  void ForwardCurve::serialize(Archive & ar, const unsigned int){
54  ar & BOOST_SERIALIZATION_NVP( as_of_date_);
55  ar & BOOST_SERIALIZATION_NVP(interpolation_);
56  ar & BOOST_SERIALIZATION_NVP(yf_);
57  ar & BOOST_SERIALIZATION_NVP(dates_);
58  ar & BOOST_SERIALIZATION_NVP(prices_);
59  }
60 }
61 
62 #endif /* FORWARDEQUITYCURVE_HPP */
ForwardCurve()
default constructor
Definition: ForwardCurve.cpp:9
std::vector< Date > dates_
Grid dates.
Definition: ForwardCurve.hpp:45
File contains template of deep-coping smart pointer.
File contains interface for year fractions.
friend std::ostream & operator<<(std::ostream &, ForwardCurve &)
Overloads stream operator.
Definition: ForwardCurve.cpp:45
Definition: cadHoliday.cpp:3
Date as_of_date_
date on which the curve is valid.
Definition: ForwardCurve.hpp:42
Template of deep-coping smart pointer.
Definition: smartPointer.hpp:14
File contains definition of date class.
File contains interface of interpolation methods.
File contains small programming tools.
SmartPointer< YearFraction > yf_
Year fraction convention changes dates into continuous time.
Definition: ForwardCurve.hpp:44
double getForwardPrice(Date d)
calculates the forward for a given date
Definition: ForwardCurve.cpp:30
std::vector< Date > getDates()
returns grid dates
Definition: ForwardCurve.cpp:37
void serialize(Archive &ar, const unsigned int)
interface used by Boost serialization library
Definition: ForwardCurve.hpp:53
The class implements the forward curve.
Definition: ForwardCurve.hpp:27
Class implements a date object.
Definition: date.hpp:27
std::vector< double > time_
Continuous time calculated on basis of grid dates.
Definition: ForwardCurve.hpp:46
std::vector< double > prices_
Forward prices associated with dates.
Definition: ForwardCurve.hpp:47
SmartPointer< Interpolation > interpolation_
Interpolation method.
Definition: ForwardCurve.hpp:43