QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
CPICapFloor Class Reference

CPI cap or floor. More...

#include <ql/instruments/cpicapfloor.hpp>

+ Inheritance diagram for CPICapFloor:
+ Collaboration diagram for CPICapFloor:

Classes

class  arguments
 
class  engine
 

Public Member Functions

 CPICapFloor (Option::Type type, Real nominal, const Date &startDate, Real baseCPI, const Date &maturity, Calendar fixCalendar, BusinessDayConvention fixConvention, Calendar payCalendar, BusinessDayConvention payConvention, Rate strike, const ext::shared_ptr< ZeroInflationIndex > &inflationIndex, const Period &observationLag, CPI::InterpolationType observationInterpolation=CPI::AsIndex)
 
Inspectors
Option::Type type () const
 
Real nominal () const
 
Rate strike () const
 \( K \) in the above formula. More...
 
Date fixingDate () const
 
Date payDate () const
 
const ext::shared_ptr< ZeroInflationIndex > & index () const
 
Period observationLag () const
 
- Public Member Functions inherited from Instrument
 Instrument ()
 
Real NPV () const
 returns the net present value of the instrument. More...
 
Real errorEstimate () const
 returns the error estimate on the NPV when available. More...
 
const DatevaluationDate () const
 returns the date the net present value refers to. More...
 
template<typename T >
result (const std::string &tag) const
 returns any additional result returned by the pricing engine. More...
 
const std::map< std::string, ext::any > & additionalResults () const
 returns all additional result returned by the pricing engine. More...
 
void setPricingEngine (const ext::shared_ptr< PricingEngine > &)
 set the pricing engine to be used. More...
 
virtual void fetchResults (const PricingEngine::results *) const
 
- Public Member Functions inherited from LazyObject
 LazyObject ()
 
 ~LazyObject () override=default
 
void update () override
 
bool isCalculated () const
 
void forwardFirstNotificationOnly ()
 
void alwaysForwardNotifications ()
 
void recalculate ()
 
void freeze ()
 
void unfreeze ()
 
- 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 ()
 

Instrument interface

Option::Type type_
 
Real nominal_
 
Date startDate_
 
Date fixDate_
 
Date payDate_
 
Real baseCPI_
 
Date maturity_
 
Calendar fixCalendar_
 
BusinessDayConvention fixConvention_
 
Calendar payCalendar_
 
BusinessDayConvention payConvention_
 
Rate strike_
 
ext::shared_ptr< ZeroInflationIndexindex_
 
Period observationLag_
 
CPI::InterpolationType observationInterpolation_
 
bool isExpired () const override
 returns whether the instrument might have value greater than zero. More...
 
void setupArguments (PricingEngine::arguments *) const override
 

Additional Inherited Members

- Public Types inherited from Observer
typedef set_type::iterator iterator
 
- Protected Member Functions inherited from Instrument
void calculate () const override
 
virtual void setupExpired () const
 
void performCalculations () const override
 
- Protected Member Functions inherited from LazyObject
- Protected Attributes inherited from Instrument
Real NPV_
 
Real errorEstimate_
 
Date valuationDate_
 
std::map< std::string, ext::any > additionalResults_
 
ext::shared_ptr< PricingEngineengine_
 
- Protected Attributes inherited from LazyObject
bool calculated_ = false
 
bool frozen_ = false
 
bool alwaysForward_
 

Detailed Description

CPI cap or floor.

Quoted as a fixed strike rate \( K \). Payoff:

\[ P_n(0,T) \max(y (N [(1+K)^{T}-1] - N \left[ \frac{I(T)}{I(0)} -1 \right]), 0) \]

where \( T \) is the maturity time, \( P_n(0,t) \) is the nominal discount factor at time \( t \), \( N \) is the notional, and \( I(t) \) is the inflation index value at time \( t \).

Inflation is generally available on every day, including holidays and weekends. Hence there is a variable to state whether the observe/fix dates for inflation are adjusted or not. The default is not to adjust.

N.B. a cpi cap or floor is an option, not a cap or floor on a coupon. Thus this is very similar to a ZCIIS and has a single flow, this is as usual for cpi because it is cumulative up to option maturity from base date.

We do not inherit from Option, although this would be reasonable, because we do not have that degree of generality.

Definition at line 62 of file cpicapfloor.hpp.

Constructor & Destructor Documentation

◆ CPICapFloor()

CPICapFloor ( Option::Type  type,
Real  nominal,
const Date startDate,
Real  baseCPI,
const Date maturity,
Calendar  fixCalendar,
BusinessDayConvention  fixConvention,
Calendar  payCalendar,
BusinessDayConvention  payConvention,
Rate  strike,
const ext::shared_ptr< ZeroInflationIndex > &  inflationIndex,
const Period observationLag,
CPI::InterpolationType  observationInterpolation = CPI::AsIndex 
)

Definition at line 37 of file cpicapfloor.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ type()

Option::Type type ( ) const

Definition at line 83 of file cpicapfloor.hpp.

◆ nominal()

Real nominal ( ) const

Definition at line 84 of file cpicapfloor.hpp.

◆ strike()

Rate strike ( ) const

\( K \) in the above formula.

Definition at line 86 of file cpicapfloor.hpp.

◆ fixingDate()

Date fixingDate ( ) const

Definition at line 74 of file cpicapfloor.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ payDate()

Date payDate ( ) const

Definition at line 79 of file cpicapfloor.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ index()

const ext::shared_ptr< ZeroInflationIndex > & index ( ) const

Definition at line 89 of file cpicapfloor.hpp.

◆ observationLag()

Period observationLag ( ) const

Definition at line 90 of file cpicapfloor.hpp.

◆ isExpired()

bool isExpired ( ) const
overridevirtual

returns whether the instrument might have value greater than zero.

Implements Instrument.

Definition at line 84 of file cpicapfloor.cpp.

+ Here is the call graph for this function:

◆ setupArguments()

void setupArguments ( PricingEngine::arguments ) const
overridevirtual

When a derived argument structure is defined for an instrument, this method should be overridden to fill it. This is mandatory in case a pricing engine is used.

Reimplemented from Instrument.

Definition at line 94 of file cpicapfloor.cpp.

+ Here is the call graph for this function:

Member Data Documentation

◆ type_

Option::Type type_
protected

Definition at line 100 of file cpicapfloor.hpp.

◆ nominal_

Real nominal_
protected

Definition at line 101 of file cpicapfloor.hpp.

◆ startDate_

Date startDate_
protected

Definition at line 102 of file cpicapfloor.hpp.

◆ fixDate_

Date fixDate_
protected

Definition at line 102 of file cpicapfloor.hpp.

◆ payDate_

Date payDate_
protected

Definition at line 102 of file cpicapfloor.hpp.

◆ baseCPI_

Real baseCPI_
protected

Definition at line 103 of file cpicapfloor.hpp.

◆ maturity_

Date maturity_
protected

Definition at line 104 of file cpicapfloor.hpp.

◆ fixCalendar_

Calendar fixCalendar_
protected

Definition at line 105 of file cpicapfloor.hpp.

◆ fixConvention_

BusinessDayConvention fixConvention_
protected

Definition at line 106 of file cpicapfloor.hpp.

◆ payCalendar_

Calendar payCalendar_
protected

Definition at line 107 of file cpicapfloor.hpp.

◆ payConvention_

BusinessDayConvention payConvention_
protected

Definition at line 108 of file cpicapfloor.hpp.

◆ strike_

Rate strike_
protected

Definition at line 109 of file cpicapfloor.hpp.

◆ index_

ext::shared_ptr<ZeroInflationIndex> index_
protected

Definition at line 110 of file cpicapfloor.hpp.

◆ observationLag_

Period observationLag_
protected

Definition at line 111 of file cpicapfloor.hpp.

◆ observationInterpolation_

CPI::InterpolationType observationInterpolation_
protected

Definition at line 112 of file cpicapfloor.hpp.