QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
|
#include <cpicapfloor.hpp>
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, 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 Date & | valuationDate () const |
returns the date the net present value refers to. More... | |
template<typename T > | |
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 &) | |
Observable & | operator= (const Observable &) |
Observable (Observable &&)=delete | |
Observable & | operator= (Observable &&)=delete |
virtual | ~Observable ()=default |
void | notifyObservers () |
Public Member Functions inherited from Observer | |
Observer ()=default | |
Observer (const Observer &) | |
Observer & | operator= (const Observer &) |
virtual | ~Observer () |
std::pair< iterator, bool > | registerWith (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< ZeroInflationIndex > | index_ |
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< PricingEngine > | engine_ |
Protected Attributes inherited from LazyObject | |
bool | calculated_ = false |
bool | frozen_ = false |
bool | alwaysForward_ |
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.
CPICapFloor | ( | Option::Type | type, |
Real | nominal, | ||
const Date & | startDate, | ||
Real | baseCPI, | ||
const Date & | maturity, | ||
Calendar | fixCalendar, | ||
BusinessDayConvention | fixConvention, | ||
Calendar | payCalendar, | ||
BusinessDayConvention | payConvention, | ||
Rate | strike, | ||
ext::shared_ptr< ZeroInflationIndex > | inflationIndex, | ||
const Period & | observationLag, | ||
CPI::InterpolationType | observationInterpolation = CPI::AsIndex |
||
) |
Option::Type type | ( | ) | const |
Definition at line 83 of file cpicapfloor.hpp.
Real nominal | ( | ) | const |
Definition at line 84 of file cpicapfloor.hpp.
Rate strike | ( | ) | const |
\( K \) in the above formula.
Definition at line 86 of file cpicapfloor.hpp.
Date fixingDate | ( | ) | const |
Definition at line 74 of file cpicapfloor.cpp.
Date payDate | ( | ) | const |
Definition at line 79 of file cpicapfloor.cpp.
const ext::shared_ptr< ZeroInflationIndex > & index | ( | ) | const |
Definition at line 89 of file cpicapfloor.hpp.
Period observationLag | ( | ) | const |
Definition at line 90 of file cpicapfloor.hpp.
|
overridevirtual |
returns whether the instrument might have value greater than zero.
Implements Instrument.
Definition at line 84 of file cpicapfloor.cpp.
|
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.
|
protected |
Definition at line 100 of file cpicapfloor.hpp.
|
protected |
Definition at line 101 of file cpicapfloor.hpp.
|
protected |
Definition at line 102 of file cpicapfloor.hpp.
|
protected |
Definition at line 102 of file cpicapfloor.hpp.
|
protected |
Definition at line 102 of file cpicapfloor.hpp.
|
protected |
Definition at line 103 of file cpicapfloor.hpp.
|
protected |
Definition at line 104 of file cpicapfloor.hpp.
|
protected |
Definition at line 105 of file cpicapfloor.hpp.
|
protected |
Definition at line 106 of file cpicapfloor.hpp.
|
protected |
Definition at line 107 of file cpicapfloor.hpp.
|
protected |
Definition at line 108 of file cpicapfloor.hpp.
|
protected |
Definition at line 109 of file cpicapfloor.hpp.
|
protected |
Definition at line 110 of file cpicapfloor.hpp.
|
protected |
Definition at line 111 of file cpicapfloor.hpp.
|
protected |
Definition at line 112 of file cpicapfloor.hpp.