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

FX Linked cash-flow. More...

#include <qle/cashflows/fxlinkedcashflow.hpp>

+ Inheritance diagram for FXLinkedCashFlow:
+ Collaboration diagram for FXLinkedCashFlow:

Public Member Functions

 FXLinkedCashFlow (const Date &cashFlowDate, const Date &fixingDate, Real foreignAmount, QuantLib::ext::shared_ptr< FxIndex > fxIndex)
 
CashFlow interface
Date date () const override
 
Real amount () const override
 
Visitability
void accept (AcyclicVisitor &) override
 
Observer interface
void update () override
 
- Public Member Functions inherited from FXLinked
 FXLinked (const Date &fixingDate, Real foreignAmount, QuantLib::ext::shared_ptr< FxIndex > fxIndex)
 
virtual ~FXLinked ()
 
Date fxFixingDate () const
 
Real foreignAmount () const
 
const QuantLib::ext::shared_ptr< FxIndex > & fxIndex () const
 
Real fxRate () const
 
virtual QuantLib::ext::shared_ptr< FXLinkedclone (QuantLib::ext::shared_ptr< FxIndex > fxIndex)=0
 

FXLinked interface

Date cashFlowDate_
 
QuantLib::ext::shared_ptr< FXLinkedclone (QuantLib::ext::shared_ptr< FxIndex > fxIndex) override
 

Additional Inherited Members

- Protected Attributes inherited from FXLinked
Date fxFixingDate_
 
Real foreignAmount_
 
QuantLib::ext::shared_ptr< FxIndexfxIndex_
 

Detailed Description

FX Linked cash-flow.

Cashflow of Domestic currency where the amount is fx linked to some fixed foreign amount.

For example: a JPY flow based off 1M USD, if the USDJPY FX rate is 123.45 then the JPY amount is 123.45 M JPY.

FXLinkedCashFlow checks the FX fixing date against the eval date

For future fixings (date > eval) this class calculates the FX Fwd rate (using the provided FX Spot rate and FOR and DOM yield curves)

For todays fixing (date = eval) this class converts the foreign amount using the provided FX Spot rate.

For previous fixings (date < eval) this class checks the QuantLib IndexManager to get the FX fixing at which the foreign rate should be converted at. The name of the index is a parameter to the constructor.

This is not a lazy object.

Definition at line 101 of file fxlinkedcashflow.hpp.

Constructor & Destructor Documentation

◆ FXLinkedCashFlow()

FXLinkedCashFlow ( const Date &  cashFlowDate,
const Date &  fixingDate,
Real  foreignAmount,
QuantLib::ext::shared_ptr< FxIndex fxIndex 
)

Definition at line 43 of file fxlinkedcashflow.cpp.

46 registerWith(FXLinked::fxIndex());
47}
const QuantLib::ext::shared_ptr< FxIndex > & fxIndex() const
FXLinked(const Date &fixingDate, Real foreignAmount, QuantLib::ext::shared_ptr< FxIndex > fxIndex)
Real foreignAmount() const
Date fxFixingDate() const
+ Here is the call graph for this function:

Member Function Documentation

◆ date()

Date date ( ) const
override

Definition at line 108 of file fxlinkedcashflow.hpp.

108{ return cashFlowDate_; }
+ Here is the caller graph for this function:

◆ amount()

Real amount ( ) const
override

Definition at line 109 of file fxlinkedcashflow.hpp.

109{ return foreignAmount() * fxRate(); }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ accept()

void accept ( AcyclicVisitor &  v)
override

Definition at line 133 of file fxlinkedcashflow.hpp.

133 {
134 Visitor<FXLinkedCashFlow>* v1 = dynamic_cast<Visitor<FXLinkedCashFlow>*>(&v);
135 if (v1 != 0)
136 v1->visit(*this);
137 else
138 CashFlow::accept(v);
139}

◆ update()

void update ( )
override

Definition at line 119 of file fxlinkedcashflow.hpp.

119{ notifyObservers(); }

◆ clone()

QuantLib::ext::shared_ptr< FXLinked > clone ( QuantLib::ext::shared_ptr< FxIndex fxIndex)
overridevirtual

Implements FXLinked.

Definition at line 56 of file fxlinkedcashflow.cpp.

56 {
57 return QuantLib::ext::make_shared<FXLinkedCashFlow>(date(), fxFixingDate(), foreignAmount(), fxIndex);
58}
Date date() const override
+ Here is the call graph for this function:

Member Data Documentation

◆ cashFlowDate_

Date cashFlowDate_
private

Definition at line 128 of file fxlinkedcashflow.hpp.