Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | List of all members
TRSCashFlow Class Reference

bond trs cashflow More...

#include <qle/cashflows/trscashflow.hpp>

+ Inheritance diagram for TRSCashFlow:
+ Collaboration diagram for TRSCashFlow:

Public Member Functions

 TRSCashFlow (const Date &paymentDate, const Date &fixingStartDate, const Date &fixingEndDate, const Real notional, const QuantLib::ext::shared_ptr< Index > &Index, const Real initialPrice=Null< Real >(), const QuantLib::ext::shared_ptr< FxIndex > &fxIndex=nullptr)
 
CashFlow interface
Real amount () const override
 
Date date () const override
 
Inspectors
const Date & fixingStartDate () const
 
const Date & fixingEndDate () const
 
virtual const Real notional () const
 
virtual const Real notional (Date date) const
 
const QuantLib::ext::shared_ptr< Index > & index () const
 
const Real initialPrice () const
 
const QuantLib::ext::shared_ptr< FxIndex > & fxIndex () const
 
Real fxStart () const
 
Real fxEnd () const
 
Real assetStart () const
 
Real assetEnd () const
 
Observer interface
void update () override
 

Visitability

Date paymentDate_
 
Date fixingStartDate_
 
Date fixingEndDate_
 
Real notional_
 
QuantLib::ext::shared_ptr< Index > index_
 
Real initialPrice_ = QuantLib::Null<Real>()
 
QuantLib::ext::shared_ptr< FxIndexfxIndex_
 
virtual void accept (AcyclicVisitor &) override
 

Detailed Description

bond trs cashflow

Definition at line 38 of file trscashflow.hpp.

Constructor & Destructor Documentation

◆ TRSCashFlow()

TRSCashFlow ( const Date &  paymentDate,
const Date &  fixingStartDate,
const Date &  fixingEndDate,
const Real  notional,
const QuantLib::ext::shared_ptr< Index > &  Index,
const Real  initialPrice = Null<Real>(),
const QuantLib::ext::shared_ptr< FxIndex > &  fxIndex = nullptr 
)

Definition at line 23 of file trscashflow.cpp.

28 //QL_REQUIRE(!index->relative(), "TRSCashFlow: index should not use relative prices");
29 registerWith(fxIndex_);
30}
QuantLib::ext::shared_ptr< FxIndex > fxIndex_
Definition: trscashflow.hpp:80
const QuantLib::ext::shared_ptr< FxIndex > & fxIndex() const
Definition: trscashflow.hpp:58
QuantLib::ext::shared_ptr< Index > index_
Definition: trscashflow.hpp:78
const QuantLib::ext::shared_ptr< Index > & index() const
Definition: trscashflow.hpp:56
const Real initialPrice() const
Definition: trscashflow.hpp:57
const Date & fixingEndDate() const
Definition: trscashflow.hpp:53
virtual const Real notional() const
Definition: trscashflow.hpp:54
const Date & fixingStartDate() const
Definition: trscashflow.hpp:52

Member Function Documentation

◆ amount()

Real amount ( ) const
override

Definition at line 32 of file trscashflow.cpp.

32{ return notional_ * (assetEnd() * fxEnd() - assetStart() * fxStart()); }
Real assetEnd() const
Definition: trscashflow.cpp:57
Real assetStart() const
Definition: trscashflow.cpp:52
Real fxStart() const
Definition: trscashflow.cpp:44
+ Here is the call graph for this function:

◆ date()

Date date ( ) const
override

Definition at line 34 of file trscashflow.cpp.

34{ return paymentDate_; }

◆ fixingStartDate()

const Date & fixingStartDate ( ) const

Definition at line 52 of file trscashflow.hpp.

52{ return fixingStartDate_; }

◆ fixingEndDate()

const Date & fixingEndDate ( ) const

Definition at line 53 of file trscashflow.hpp.

53{ return fixingEndDate_; }

◆ notional() [1/2]

virtual const Real notional ( ) const
virtual

Reimplemented in BondTRSCashFlow.

Definition at line 54 of file trscashflow.hpp.

54{ return notional_; }
+ Here is the caller graph for this function:

◆ notional() [2/2]

virtual const Real notional ( Date  date) const
virtual

Reimplemented in BondTRSCashFlow.

Definition at line 55 of file trscashflow.hpp.

55{ return notional_; }

◆ index()

const QuantLib::ext::shared_ptr< Index > & index ( ) const

Definition at line 56 of file trscashflow.hpp.

56{ return index_; }

◆ initialPrice()

const Real initialPrice ( ) const

Definition at line 57 of file trscashflow.hpp.

57{ return initialPrice_; }

◆ fxIndex()

const QuantLib::ext::shared_ptr< FxIndex > & fxIndex ( ) const

Definition at line 58 of file trscashflow.hpp.

58{ return fxIndex_; }

◆ fxStart()

Real fxStart ( ) const

Definition at line 44 of file trscashflow.cpp.

44 {
45 return fxIndex_ ? fxIndex_->fixing(fxIndex_->fixingCalendar().adjust(fixingStartDate_, Preceding)) : 1.0;
46}
+ Here is the caller graph for this function:

◆ fxEnd()

Real fxEnd ( ) const

Definition at line 48 of file trscashflow.cpp.

48 {
49 return fxIndex_ ? fxIndex_->fixing(fxIndex_->fixingCalendar().adjust(fixingEndDate_, Preceding)) : 1.0;
50}
+ Here is the caller graph for this function:

◆ assetStart()

Real assetStart ( ) const

Definition at line 52 of file trscashflow.cpp.

52 {
53 return initialPrice_ != Null<Real>() ? initialPrice_ * notional(fixingStartDate_)
54 : index_->fixing(fixingStartDate_);
55}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assetEnd()

Real assetEnd ( ) const

Definition at line 57 of file trscashflow.cpp.

57{ return index_->fixing(fixingEndDate_); }
+ Here is the caller graph for this function:

◆ update()

void update ( )
override

Definition at line 67 of file trscashflow.hpp.

67{ notifyObservers(); }

◆ accept()

void accept ( AcyclicVisitor &  v)
overridevirtual

Definition at line 36 of file trscashflow.cpp.

36 {
37 Visitor<TRSCashFlow>* v1 = dynamic_cast<Visitor<TRSCashFlow>*>(&v);
38 if (v1 != 0)
39 v1->visit(*this);
40 else
41 CashFlow::accept(v);
42}

Member Data Documentation

◆ paymentDate_

Date paymentDate_
protected

Definition at line 76 of file trscashflow.hpp.

◆ fixingStartDate_

Date fixingStartDate_
protected

Definition at line 76 of file trscashflow.hpp.

◆ fixingEndDate_

Date fixingEndDate_
protected

Definition at line 76 of file trscashflow.hpp.

◆ notional_

Real notional_
protected

Definition at line 77 of file trscashflow.hpp.

◆ index_

QuantLib::ext::shared_ptr<Index> index_
protected

Definition at line 78 of file trscashflow.hpp.

◆ initialPrice_

Real initialPrice_ = QuantLib::Null<Real>()
protected

Definition at line 79 of file trscashflow.hpp.

◆ fxIndex_

QuantLib::ext::shared_ptr<FxIndex> fxIndex_
protected

Definition at line 80 of file trscashflow.hpp.