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

#include <qle/indexes/fxindex.hpp>

+ Inheritance diagram for FxSpotQuote:
+ Collaboration diagram for FxSpotQuote:

Public Member Functions

 FxSpotQuote (Handle< Quote > todaysQuote, const Handle< YieldTermStructure > &sourceYts, const Handle< YieldTermStructure > &targetYts, Natural fixingDays, const Calendar &fixingCalendar)
 
Quote interface
Real value () const override
 
bool isValid () const override
 

Observer interface

const Handle< Quote > todaysQuote_
 
const Handle< YieldTermStructure > sourceYts_
 
const Handle< YieldTermStructure > targetYts_
 
Natural fixingDays_
 
Calendar fixingCalendar_
 
void update () override
 

Detailed Description

Definition at line 72 of file fxindex.hpp.

Constructor & Destructor Documentation

◆ FxSpotQuote()

FxSpotQuote ( Handle< Quote >  todaysQuote,
const Handle< YieldTermStructure > &  sourceYts,
const Handle< YieldTermStructure > &  targetYts,
Natural  fixingDays,
const Calendar &  fixingCalendar 
)

Definition at line 72 of file fxindex.cpp.

75 : todaysQuote_(todaysQuote), sourceYts_(sourceYts), targetYts_(targetYts), fixingDays_(fixingDays),
76 fixingCalendar_(fixingCalendar) {
77 registerWith(todaysQuote_);
78 registerWith(sourceYts_);
79 registerWith(targetYts_);
80}
const Handle< YieldTermStructure > targetYts_
Definition: fxindex.hpp:87
const Handle< Quote > todaysQuote_
Definition: fxindex.hpp:86
const Handle< YieldTermStructure > sourceYts_
Definition: fxindex.hpp:87
Calendar fixingCalendar_
Definition: fxindex.hpp:89

Member Function Documentation

◆ value()

Real value ( ) const
override

Definition at line 82 of file fxindex.cpp.

82 {
83 QL_ENSURE(isValid(), "invalid FxSpotQuote");
84 if (fixingDays_ == 0)
85 return todaysQuote_->value();
86 else {
87 if(sourceYts_.empty() || targetYts_.empty())
88 return todaysQuote_->value();
89 Date today = sourceYts_->referenceDate();
90 Date refValueDate = fixingCalendar_.advance(today, fixingDays_, Days);
91 return todaysQuote_->value() / targetYts_->discount(refValueDate) * sourceYts_->discount(refValueDate);
92 }
93}
bool isValid() const override
Definition: fxindex.cpp:95
+ Here is the call graph for this function:

◆ isValid()

bool isValid ( ) const
override

Definition at line 95 of file fxindex.cpp.

95 {
96 return !todaysQuote_.empty() && todaysQuote_->isValid();
97}
+ Here is the caller graph for this function:

◆ update()

void update ( )
override

Definition at line 99 of file fxindex.cpp.

99{ notifyObservers(); }

Member Data Documentation

◆ todaysQuote_

const Handle<Quote> todaysQuote_
private

Definition at line 86 of file fxindex.hpp.

◆ sourceYts_

const Handle<YieldTermStructure> sourceYts_
private

Definition at line 87 of file fxindex.hpp.

◆ targetYts_

const Handle<YieldTermStructure> targetYts_
private

Definition at line 87 of file fxindex.hpp.

◆ fixingDays_

Natural fixingDays_
private

Definition at line 88 of file fxindex.hpp.

◆ fixingCalendar_

Calendar fixingCalendar_
private

Definition at line 89 of file fxindex.hpp.