QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SwapSpreadIndex Class Reference

class for swap-rate spread indexes More...

#include <swapspreadindex.hpp>

+ Inheritance diagram for SwapSpreadIndex:
+ Collaboration diagram for SwapSpreadIndex:

Public Member Functions

 SwapSpreadIndex (const std::string &familyName, const ext::shared_ptr< SwapIndex > &swapIndex1, ext::shared_ptr< SwapIndex > swapIndex2, Real gearing1=1.0, Real gearing2=-1.0)
 
InterestRateIndex interface
Date maturityDate (const Date &valueDate) const override
 
Rate forecastFixing (const Date &fixingDate) const override
 It can be overridden to implement particular conventions. More...
 
Rate pastFixing (const Date &fixingDate) const override
 
bool allowsNativeFixings () override
 check if index allows for native fixings. More...
 
- Public Member Functions inherited from InterestRateIndex
 InterestRateIndex (std::string familyName, const Period &tenor, Natural settlementDays, Currency currency, Calendar fixingCalendar, DayCounter dayCounter)
 
std::string name () const override
 Returns the name of the index. More...
 
Calendar fixingCalendar () const override
 returns the calendar defining valid fixing dates More...
 
bool isValidFixingDate (const Date &fixingDate) const override
 returns TRUE if the fixing date is a valid one More...
 
Rate fixing (const Date &fixingDate, bool forecastTodaysFixing=false) const override
 returns the fixing at the given date More...
 
void update () override
 
std::string familyName () const
 
Period tenor () const
 
Natural fixingDays () const
 
Date fixingDate (const Date &valueDate) const
 
const Currencycurrency () const
 
const DayCounterdayCounter () const
 
virtual Date valueDate (const Date &fixingDate) const
 
- Public Member Functions inherited from Index
 ~Index () override=default
 
virtual std::string name () const =0
 Returns the name of the index. More...
 
virtual Calendar fixingCalendar () const =0
 returns the calendar defining valid fixing dates More...
 
virtual bool isValidFixingDate (const Date &fixingDate) const =0
 returns TRUE if the fixing date is a valid one More...
 
bool hasHistoricalFixing (const Date &fixingDate) const
 returns whether a historical fixing was stored for the given date More...
 
virtual Real fixing (const Date &fixingDate, bool forecastTodaysFixing=false) const =0
 returns the fixing at the given date More...
 
const TimeSeries< Real > & timeSeries () const
 returns the fixing TimeSeries More...
 
virtual bool allowsNativeFixings ()
 check if index allows for native fixings. More...
 
virtual void addFixing (const Date &fixingDate, Real fixing, bool forceOverwrite=false)
 stores the historical fixing at the given date More...
 
void addFixings (const TimeSeries< Real > &t, bool forceOverwrite=false)
 stores historical fixings from a TimeSeries More...
 
template<class DateIterator , class ValueIterator >
void addFixings (DateIterator dBegin, DateIterator dEnd, ValueIterator vBegin, bool forceOverwrite=false)
 stores historical fixings at the given dates More...
 
void clearFixings ()
 clears all stored historical fixings More...
 
- Public Member Functions inherited from Observable
 Observable ()
 
 Observable (const Observable &)
 
Observableoperator= (const Observable &)
 
 Observable (Observable &&)=delete
 
Observableoperator= (Observable &&)=delete
 
virtual ~Observable ()=default
 
void notifyObservers ()
 
- Public Member Functions inherited from Observer
 Observer ()=default
 
 Observer (const Observer &)
 
Observeroperator= (const Observer &)
 
virtual ~Observer ()
 
std::pair< iterator, boolregisterWith (const ext::shared_ptr< Observable > &)
 
void registerWithObservables (const ext::shared_ptr< Observer > &)
 
Size unregisterWith (const ext::shared_ptr< Observable > &)
 
void unregisterWithAll ()
 
virtual void update ()=0
 
virtual void deepUpdate ()
 

Inspectors

ext::shared_ptr< SwapIndexswapIndex1_
 
ext::shared_ptr< SwapIndexswapIndex2_
 
Real gearing1_
 
Real gearing2_
 
ext::shared_ptr< SwapIndexswapIndex1 ()
 
ext::shared_ptr< SwapIndexswapIndex2 ()
 
Real gearing1 () const
 
Real gearing2 () const
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Attributes inherited from InterestRateIndex
std::string familyName_
 
Period tenor_
 
Natural fixingDays_
 
Currency currency_
 
DayCounter dayCounter_
 
std::string name_
 

Detailed Description

class for swap-rate spread indexes

Definition at line 30 of file swapspreadindex.hpp.

Constructor & Destructor Documentation

◆ SwapSpreadIndex()

SwapSpreadIndex ( const std::string &  familyName,
const ext::shared_ptr< SwapIndex > &  swapIndex1,
ext::shared_ptr< SwapIndex swapIndex2,
Real  gearing1 = 1.0,
Real  gearing2 = -1.0 
)

Definition at line 25 of file swapspreadindex.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ maturityDate()

Date maturityDate ( const Date valueDate) const
overridevirtual

Implements InterestRateIndex.

Definition at line 40 of file swapspreadindex.hpp.

◆ forecastFixing()

Rate forecastFixing ( const Date fixingDate) const
overridevirtual

It can be overridden to implement particular conventions.

Implements InterestRateIndex.

Definition at line 63 of file swapspreadindex.hpp.

+ Here is the call graph for this function:

◆ pastFixing()

Rate pastFixing ( const Date fixingDate) const
overridevirtual

Reimplemented from InterestRateIndex.

Definition at line 71 of file swapspreadindex.hpp.

+ Here is the call graph for this function:

◆ allowsNativeFixings()

bool allowsNativeFixings ( )
overridevirtual

check if index allows for native fixings.

If this returns false, calls to addFixing and similar methods will raise an exception.

Reimplemented from Index.

Definition at line 45 of file swapspreadindex.hpp.

◆ swapIndex1()

ext::shared_ptr< SwapIndex > swapIndex1 ( )

Definition at line 50 of file swapspreadindex.hpp.

◆ swapIndex2()

ext::shared_ptr< SwapIndex > swapIndex2 ( )

Definition at line 51 of file swapspreadindex.hpp.

◆ gearing1()

Real gearing1 ( ) const

Definition at line 52 of file swapspreadindex.hpp.

+ Here is the caller graph for this function:

◆ gearing2()

Real gearing2 ( ) const

Definition at line 53 of file swapspreadindex.hpp.

+ Here is the caller graph for this function:

Member Data Documentation

◆ swapIndex1_

ext::shared_ptr<SwapIndex> swapIndex1_
private

Definition at line 58 of file swapspreadindex.hpp.

◆ swapIndex2_

ext::shared_ptr<SwapIndex> swapIndex2_
private

Definition at line 58 of file swapspreadindex.hpp.

◆ gearing1_

Real gearing1_
private

Definition at line 59 of file swapspreadindex.hpp.

◆ gearing2_

Real gearing2_
private

Definition at line 59 of file swapspreadindex.hpp.