FixedCashFlow.hpp
Go to the documentation of this file.
1 #ifndef JULIAN_FIXEDCASHFLOW_HPP
2 #define JULIAN_FIXEDCASHFLOW_HPP
3 
5 
6 namespace julian {
7 
21  class FixedCashFlow : public CashFlow {
22  public:
23  FixedCashFlow(){};
24  FixedCashFlow(Date start, Date end ,Date payment, double amount,
25  double notional, bool notional_is_paid);
26  FixedCashFlow(Date start, Date end, Date payment, double q,
27  double notional, InterestRate rate, bool notional_is_paid);
28 
29  virtual double price(const SmartPointer<ir::Curve>& disc) override;
30  double value(const SmartPointer<ir::Curve>& disc) override;
31  virtual Date getDate() const override;
32  virtual double getNotional() const override;
33  virtual double getCF() const override;
34 
35  void setCashFlow(double amount) override;
36  void setCashFlow(double quote, const InterestRate& rate) override;
37  void setCashFlow(const SmartPointer<ir::Curve>&) override {};
38 
39  virtual void addToCashFlow(double amount);
40  virtual void addToCashFlow(double quote, InterestRate rate);
41 
42  virtual FixedCashFlow* clone() const;
43  virtual ~FixedCashFlow(){};
44 
45  friend std::ostream& operator<<(std::ostream&, FixedCashFlow&);
46  friend class boost::serialization::access;
47 
48  private:
49 
52  template<class Archive>
53  void serialize(Archive & ar, const unsigned int);
54 
58  double notional_;
59  double amount_;
62  };
63 
64  template<class Archive>
65  void FixedCashFlow::serialize(Archive & ar, const unsigned int){
66  boost::serialization::base_object<CashFlow>(*this);
67  ar & BOOST_SERIALIZATION_NVP(accrual_start_);
68  ar & BOOST_SERIALIZATION_NVP(accrual_end_);
69  ar & BOOST_SERIALIZATION_NVP(payment_date_);
70  ar & BOOST_SERIALIZATION_NVP(notional_);
71  ar & BOOST_SERIALIZATION_NVP(amount_);
72  ar & BOOST_SERIALIZATION_NVP(notional_is_paid_);
73  }
74 } // namespace julian
75 
76 #endif /* FIXEDCASHFLOW_HPP */
virtual Date getDate() const override
returns payment date
Definition: FixedCashFlow.cpp:51
Class implements the general concept of CF understand as certain amount paid on predefined date...
Definition: CashFlow.hpp:22
void serialize(Archive &ar, const unsigned int)
interface used by Boost serialization library
Definition: FixedCashFlow.hpp:65
File contains definition of cash flow class.
friend std::ostream & operator<<(std::ostream &, FixedCashFlow &)
Overloads stream operator.
Definition: FixedCashFlow.cpp:114
Definition: cadHoliday.cpp:3
double value(const SmartPointer< ir::Curve > &disc) override
prints discounted the cashflow
Definition: FixedCashFlow.cpp:68
virtual double getCF() const override
returns CF
Definition: FixedCashFlow.cpp:57
Date accrual_end_
Date determining the end of accrual period.
Definition: FixedCashFlow.hpp:56
Date payment_date_
Date on which the CF is paid.
Definition: FixedCashFlow.hpp:57
virtual FixedCashFlow * clone() const
virtual copy constructor
Definition: FixedCashFlow.cpp:45
Date accrual_start_
Date determining the beginning of accrual period.
Definition: FixedCashFlow.hpp:55
virtual void addToCashFlow(double amount)
Increases CF by provided amount.
Definition: FixedCashFlow.cpp:94
double notional_
Notional of the CF.
Definition: FixedCashFlow.hpp:58
double amount_
Amount paid on payment_date_.
Definition: FixedCashFlow.hpp:59
virtual double price(const SmartPointer< ir::Curve > &disc) override
discounts the cashflow
Definition: FixedCashFlow.cpp:39
Class implements a date object.
Definition: date.hpp:27
void setCashFlow(const SmartPointer< ir::Curve > &) override
sets new CF value basing on interest rate curve
Definition: FixedCashFlow.hpp:37
The class implements the concept of interest rate.
Definition: interestRate.hpp:25
Class implements the concept of fixed cash flow.
Definition: FixedCashFlow.hpp:21
bool notional_is_paid_
If true notional of CF is paid on payment date with accrued amount.
Definition: FixedCashFlow.hpp:61
virtual double getNotional() const override
returns notional
Definition: FixedCashFlow.cpp:106
void setCashFlow(double amount) override
sets new CF value
Definition: FixedCashFlow.cpp:88