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

Average FX Linked cash-flow. More...

#include <qle/cashflows/fxlinkedcashflow.hpp>

+ Inheritance diagram for AverageFXLinkedCashFlow:
+ Collaboration diagram for AverageFXLinkedCashFlow:

Public Member Functions

 AverageFXLinkedCashFlow (const Date &cashFlowDate, const std::vector< Date > &fixingDates, Real foreignAmount, QuantLib::ext::shared_ptr< FxIndex > fxIndex, const bool inverted=false)
 
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 AverageFXLinked
 AverageFXLinked (const std::vector< Date > &fixingDates, Real foreignAmount, QuantLib::ext::shared_ptr< FxIndex > fxIndex, const bool inverted=false)
 
virtual ~AverageFXLinked ()
 
const std::vector< Date > & fxFixingDates () const
 
Real foreignAmount () const
 
const QuantLib::ext::shared_ptr< FxIndex > & fxIndex () const
 
Real fxRate () const
 
virtual QuantLib::ext::shared_ptr< AverageFXLinkedclone (QuantLib::ext::shared_ptr< FxIndex > fxIndex)=0
 

FXLinked interface

Date cashFlowDate_
 
QuantLib::ext::shared_ptr< AverageFXLinkedclone (QuantLib::ext::shared_ptr< FxIndex > fxIndex) override
 
std::map< Date, Real > fixings () const
 

Additional Inherited Members

- Protected Attributes inherited from AverageFXLinked
std::vector< Date > fxFixingDates_
 
Real foreignAmount_
 
QuantLib::ext::shared_ptr< FxIndexfxIndex_
 
bool inverted_ = false
 

Detailed Description

Average FX Linked cash-flow.

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

Difference to the FX Linked cash-flow: The FX rate is an arithmetic average across observation dates.

This is not a lazy object.

Definition at line 153 of file fxlinkedcashflow.hpp.

Constructor & Destructor Documentation

◆ AverageFXLinkedCashFlow()

AverageFXLinkedCashFlow ( const Date &  cashFlowDate,
const std::vector< Date > &  fixingDates,
Real  foreignAmount,
QuantLib::ext::shared_ptr< FxIndex fxIndex,
const bool  inverted = false 
)

Definition at line 49 of file fxlinkedcashflow.cpp.

53 registerWith(AverageFXLinked::fxIndex());
54}
const QuantLib::ext::shared_ptr< FxIndex > & fxIndex() const
const std::vector< Date > & fxFixingDates() const
AverageFXLinked(const std::vector< Date > &fixingDates, Real foreignAmount, QuantLib::ext::shared_ptr< FxIndex > fxIndex, const bool inverted=false)
+ Here is the call graph for this function:

Member Function Documentation

◆ date()

Date date ( ) const
override

Definition at line 160 of file fxlinkedcashflow.hpp.

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

◆ amount()

Real amount ( ) const
override

Definition at line 161 of file fxlinkedcashflow.hpp.

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

◆ accept()

void accept ( AcyclicVisitor &  v)
override

Definition at line 186 of file fxlinkedcashflow.hpp.

186 {
187 Visitor<AverageFXLinkedCashFlow>* v1 = dynamic_cast<Visitor<AverageFXLinkedCashFlow>*>(&v);
188 if (v1 != 0)
189 v1->visit(*this);
190 else
191 CashFlow::accept(v);
192}

◆ update()

void update ( )
override

Definition at line 171 of file fxlinkedcashflow.hpp.

171{ notifyObservers(); }

◆ clone()

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

Implements AverageFXLinked.

Definition at line 60 of file fxlinkedcashflow.cpp.

60 {
61 return QuantLib::ext::make_shared<AverageFXLinkedCashFlow>(date(), fxFixingDates(), foreignAmount(), fxIndex);
62}
+ Here is the call graph for this function:

◆ fixings()

std::map< Date, Real > fixings ( ) const

Definition at line 64 of file fxlinkedcashflow.cpp.

64 {
65 std::map<Date, Real> result;
66 for (auto const& d : fxFixingDates_)
67 result[d] = inverted_ ? 1.0 / fxIndex_->fixing(d) : fxIndex_->fixing(d);
68 return result;
69}
std::vector< Date > fxFixingDates_
QuantLib::ext::shared_ptr< FxIndex > fxIndex_

Member Data Documentation

◆ cashFlowDate_

Date cashFlowDate_
private

Definition at line 183 of file fxlinkedcashflow.hpp.