IRS.hpp
Go to the documentation of this file.
1 #ifndef JULIAN_IRS_HPP
2 #define JULIAN_IRS_HPP
3 
6 #include <dates/_all_dates.hpp>
9 
10 namespace julian {
11 
28  class IRS: public LinearInstrument, public ir::BuildingBlock {
29  public:
32  IRS(){};
35  IRS(Date trade_date,Date start_date, Date maturity_date,
36  CashFlowVector fixed_leg, CashFlowVector floating_leg, InterestRate fixed_leg_rate, InterestRate floating_leg_rate,
37  double notional, double quoting,Frequency fixed_leg_freq, Frequency floating_leg_freq) {
38  trade_date_ = trade_date;
39  start_date_ = start_date;
40  maturity_date_ = maturity_date;
41 
42  fixed_leg_ = fixed_leg;
43  floating_leg_ = floating_leg;
44 
45  fixed_leg_rate_ = fixed_leg_rate;
46  floating_leg_rate_ = floating_leg_rate;
47  notional_ = notional;
48  quoting_ = quoting;
49  //fixing_ = fixing;
50 
51  fixed_leg_freq_ = fixed_leg_freq;
52  floating_leg_freq_ = floating_leg_freq;
53  };
54 
55 
56 
60  virtual double price(const SmartPointer<ir::Curve>&);
61  virtual double price(const SmartPointer<ir::Curve>& discounting, const SmartPointer<ir::Curve>& projecting,const SmartPointer<ir::Curve>& ,const SmartPointer<ir::Curve>& );
62  virtual void valuation(const SmartPointer<ir::Curve>&);
63  virtual void valuation(const SmartPointer<ir::Curve>& discounting, const SmartPointer<ir::Curve>& projecting,const SmartPointer<ir::Curve>& ,const SmartPointer<ir::Curve>& );
65 
69  virtual Date getDate() const override;
70  virtual std::pair<CashFlowVector, CashFlowVector> getCFs() const override;
71  virtual double calibrate(const SmartPointer<ir::Curve>& calibrated) override;
72  virtual double calibrate(const SmartPointer<ir::Curve>& discounting, const SmartPointer<ir::Curve>& projection ,const SmartPointer<ir::Curve>& calibrated) override;
73  virtual double getParRate(const SmartPointer<ir::Curve>& discounting,const SmartPointer<ir::Curve>& projection,const SmartPointer<ir::Curve>& projection2) override;
74  virtual double getQuoting() override;
75  virtual void changeQuoting(double) override;
76  virtual InterestRate getInterestRate() const override;
77  std::string info() const override;
79 
80  virtual ~IRS(){};
81  virtual IRS* clone() const;
82 
83  friend std::ostream& operator<<(std::ostream&, IRS&);
84  private:
92  double notional_;
93  double quoting_;
96  };
97 }
98 #endif
File contains types common to all financial instruments.
virtual InterestRate getInterestRate() const override
Returns interest rates convention of fixed leg.
Definition: IRS.cpp:152
Class is an abstract class expressing the concept of linear instruments like deposits, FRAs, futures, fxForwards and swaps.
Definition: linearInstrument.hpp:21
virtual double getParRate(const SmartPointer< ir::Curve > &discounting, const SmartPointer< ir::Curve > &projection, const SmartPointer< ir::Curve > &projection2) override
Implies quoting of benchmark instrument from interest rate curves provided.
Definition: IRS.cpp:134
File containing definition of interest rates curve building block.
Contains headers of all files with definitions of classes gathered in dates calendar and holidays mod...
std::string info() const override
Returns a name of instrument: FRA.
Definition: IRS.cpp:160
virtual std::pair< CashFlowVector, CashFlowVector > getCFs() const override
Returns the sets of cashflows associated with IRS.
Definition: IRS.cpp:145
Frequency floating_leg_freq_
Frequency of payment of floating leg.
Definition: IRS.hpp:95
virtual Date getDate() const override
returns maturity of IRS
Definition: IRS.cpp:59
Definition: cadHoliday.cpp:3
Date trade_date_
The date on which IRS is dealt.
Definition: IRS.hpp:85
InterestRate floating_leg_rate_
Convention of floating leg interest rate.
Definition: IRS.hpp:91
Class helps to handle the vector of CFs.
Definition: CashFlowVector.hpp:22
InterestRate fixed_leg_rate_
Convention of fixed leg interest rate.
Definition: IRS.hpp:90
virtual IRS * clone() const
Virtual copy constructor.
Definition: IRS.cpp:127
IRS()
Default constructor.
Definition: IRS.hpp:32
virtual double price(const SmartPointer< ir::Curve > &)
calculates price of IRS by summing the discounted CFs
Definition: IRS.cpp:52
Date start_date_
The date initial date of first accrual period.
Definition: IRS.hpp:86
Building Block is a class that defines the interface for benchmark instruments used for estimating in...
Definition: curveBuildingBlock.hpp:27
File contains definition of linear instruments interface.
virtual void changeQuoting(double) override
changes quoting of the IRS
Definition: IRS.cpp:9
double quoting_
Interest rate at which IRS is paying fixed leg.
Definition: IRS.hpp:93
Class implements an plain vanilla (flo/fix) interest rate swap contract.
Definition: IRS.hpp:28
CashFlowVector fixed_leg_
Fixed leg cash flows.
Definition: IRS.hpp:88
Class implements a date object.
Definition: date.hpp:27
IRS(Date trade_date, Date start_date, Date maturity_date, CashFlowVector fixed_leg, CashFlowVector floating_leg, InterestRate fixed_leg_rate, InterestRate floating_leg_rate, double notional, double quoting, Frequency fixed_leg_freq, Frequency floating_leg_freq)
Constructor.
Definition: IRS.hpp:35
Frequency fixed_leg_freq_
Frequency of payment of fixed leg.
Definition: IRS.hpp:94
friend std::ostream & operator<<(std::ostream &, IRS &)
Overloads stream operator.
Definition: IRS.cpp:67
virtual double getQuoting() override
Returns quoting.
Definition: IRS.cpp:121
The class implements the concept of interest rate.
Definition: interestRate.hpp:25
CashFlowVector floating_leg_
Floating leg cash flows.
Definition: IRS.hpp:89
Frequency
Definition: timeUnit.hpp:68
virtual void valuation(const SmartPointer< ir::Curve > &)
prints price and CFs of IRS
Definition: IRS.cpp:115
Date maturity_date_
The date on which the IRS expires.
Definition: IRS.hpp:87
File contains definition of InterestRate class.
double notional_
The amount for which IRS is traded.
Definition: IRS.hpp:92
virtual double calibrate(const SmartPointer< ir::Curve > &calibrated) override
Method calibrate is used by root finding estimator.
Definition: IRS.cpp:20