FloatingCashFlow.hpp
Go to the documentation of this file.
1 #ifndef JULIAN_FLOATINGCASHFLOW_HPP
2 #define JULIAN_FLOATINGCASHFLOW_HPP
3 
5 
6 namespace julian {
7 
24  class FloatingCashFlow : public CashFlow {
25  public:
26  FloatingCashFlow(){};
27  FloatingCashFlow(Date acc_start, Date acc_end, Date fix_start, Date fix_end, Date payment, double n, double additive_margin, double multiplicative_margin, bool notional_is_paid);
28  virtual double price(const SmartPointer<ir::Curve>& disc);
29  double value(const SmartPointer<ir::Curve>& disc);
30  virtual Date getDate() const;
31  virtual double getCF() const;
32  virtual double getNotional() const;
33 
34  void setCashFlow(double amount);
35  void setCashFlow(double quote, const InterestRate& rate);
37  virtual FloatingCashFlow* clone() const;
38  virtual ~FloatingCashFlow(){};
39 
40  friend std::ostream& operator<<(std::ostream&, FloatingCashFlow&);
41  friend class boost::serialization::access;
42  template<class Archive>
43  void serialize(Archive & ar, const unsigned int);
44  private:
52  double notional_;
53  double amount_;
58  };
59 
62  template<class Archive>
63  void FloatingCashFlow::serialize(Archive & ar, const unsigned int) {
64  boost::serialization::base_object<CashFlow>(*this);
65  ar & BOOST_SERIALIZATION_NVP(accrual_start_);
66  ar & BOOST_SERIALIZATION_NVP(accrual_end_);
67  ar & BOOST_SERIALIZATION_NVP(fixing_start_);
68  ar & BOOST_SERIALIZATION_NVP(fixing_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(additive_margin_);
73  ar & BOOST_SERIALIZATION_NVP(multiplicative_margin_);
74  ar & BOOST_SERIALIZATION_NVP(notional_is_paid_);
75  }
76 
77 } // namespace julian
78 
79 #endif /* FLOATINGCASHFLOW_HPP */
Class implements the general concept of CF understand as certain amount paid on predefined date...
Definition: CashFlow.hpp:22
File contains definition of cash flow class.
double amount_
Amount paid on payment_date_.
Definition: FloatingCashFlow.hpp:53
Date fixing_start_
Date of fixings the benchmark rate.
Definition: FloatingCashFlow.hpp:47
Date accrual_start_
Date determining the beginning of accrual period.
Definition: FloatingCashFlow.hpp:45
Definition: cadHoliday.cpp:3
double additive_margin_
Margin added to benchmark date.
Definition: FloatingCashFlow.hpp:54
void serialize(Archive &ar, const unsigned int)
interface used by Boost serialization library
Definition: FloatingCashFlow.hpp:63
virtual double getCF() const
returns CF
Definition: FloatingCashFlow.cpp:96
virtual FloatingCashFlow * clone() const
virtual copy constructor
Definition: FloatingCashFlow.cpp:52
virtual Date getDate() const
returns payment date
Definition: FloatingCashFlow.cpp:30
Date accrual_end_
Date determining the end of accrual period.
Definition: FloatingCashFlow.hpp:46
double value(const SmartPointer< ir::Curve > &disc)
prints discounted cashflows
Definition: FloatingCashFlow.cpp:38
friend std::ostream & operator<<(std::ostream &, FloatingCashFlow &)
Overloads stream operator.
Definition: FloatingCashFlow.cpp:89
double multiplicative_margin_
Margin multiplying to benchmark date.
Definition: FloatingCashFlow.hpp:55
virtual double getNotional() const
returns notional
Definition: FloatingCashFlow.cpp:102
Class implements the concept of floating cash flow.
Definition: FloatingCashFlow.hpp:24
Class implements a date object.
Definition: date.hpp:27
double notional_
Notional of the CF.
Definition: FloatingCashFlow.hpp:52
void setCashFlow(double amount)
sets the cash flow
Definition: FloatingCashFlow.cpp:58
Date payment_date_
Date on which the CF is paid.
Definition: FloatingCashFlow.hpp:50
The class implements the concept of interest rate.
Definition: interestRate.hpp:25
bool notional_is_paid_
If true notional of CF is paid on payment date with accrued amount.
Definition: FloatingCashFlow.hpp:57
Date fixing_end_
Benchmark rate maturity date.
Definition: FloatingCashFlow.hpp:48
virtual double price(const SmartPointer< ir::Curve > &disc)
discounts the cashflow
Definition: FloatingCashFlow.cpp:22