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

Bond Futures Index. More...

#include <qle/indexes/bondindex.hpp>

+ Inheritance diagram for BondFuturesIndex:
+ Collaboration diagram for BondFuturesIndex:

Public Member Functions

 BondFuturesIndex (const QuantLib::Date &expiryDate, const std::string &securityName, const bool dirty=false, const bool relative=true, const Calendar &fixingCalendar=NullCalendar(), const QuantLib::ext::shared_ptr< QuantLib::Bond > &bond=nullptr, const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >(), const Handle< DefaultProbabilityTermStructure > &defaultCurve=Handle< DefaultProbabilityTermStructure >(), const Handle< Quote > &recoveryRate=Handle< Quote >(), const Handle< Quote > &securitySpread=Handle< Quote >(), const Handle< YieldTermStructure > &incomeCurve=Handle< YieldTermStructure >(), const bool conditionalOnSurvival=true, const Date &issueDate=Date(), const PriceQuoteMethod priceQuoteMethod=PriceQuoteMethod::PercentageOfPar, const double priceQuoteBaseValue=1.0)
 
Index interface
std::string name () const override
 
Fixing calculations
Rate forecastFixing (const Date &fixingDate) const override
 
- Public Member Functions inherited from BondIndex
 BondIndex (const std::string &securityName, const bool dirty=false, const bool relative=true, const Calendar &fixingCalendar=NullCalendar(), const QuantLib::ext::shared_ptr< QuantLib::Bond > &bond=nullptr, const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >(), const Handle< DefaultProbabilityTermStructure > &defaultCurve=Handle< DefaultProbabilityTermStructure >(), const Handle< Quote > &recoveryRate=Handle< Quote >(), const Handle< Quote > &securitySpread=Handle< Quote >(), const Handle< YieldTermStructure > &incomeCurve=Handle< YieldTermStructure >(), const bool conditionalOnSurvival=true, const Date &issueDate=Date(), const PriceQuoteMethod priceQuoteMethod=PriceQuoteMethod::PercentageOfPar, const double priceQuoteBaseValue=1.0, const bool isInflationLinked=false, const double bidAskAdjustment=0.0, const bool bondIssueDateFallback=false)
 
std::string name () const override
 
Calendar fixingCalendar () const override
 
bool isValidFixingDate (const Date &fixingDate) const override
 
Real fixing (const Date &fixingDate, bool forecastTodaysFixing=false) const override
 
void update () override
 
Rate pastFixing (const Date &fixingDate) const
 
const std::string & securityName () const
 
bool dirty () const
 
bool relative () const
 
QuantLib::ext::shared_ptr< QuantLib::Bond > bond () const
 
Handle< YieldTermStructure > discountCurve () const
 
Handle< DefaultProbabilityTermStructure > defaultCurve () const
 
Handle< Quote > recoveryRate () const
 
Handle< Quote > securitySpread () const
 
Handle< YieldTermStructure > incomeCurve () const
 
bool conditionalOnSurvival () const
 
Date issueDate () const
 
PriceQuoteMethod priceQuoteMethod () const
 
double priceQuoteBaseValue () const
 

Inspectors

Date expiryDate_
 
std::string name_
 
const QuantLib::Date & expiryDate () const
 

Additional Inherited Members

- Public Types inherited from BondIndex
enum class  PriceQuoteMethod { PercentageOfPar , CurrencyPerUnit }
 
- Protected Attributes inherited from BondIndex
std::string securityName_
 
bool dirty_
 
bool relative_
 
Calendar fixingCalendar_
 
QuantLib::ext::shared_ptr< QuantLib::Bond > bond_
 
Handle< YieldTermStructure > discountCurve_
 
Handle< DefaultProbabilityTermStructure > defaultCurve_
 
Handle< Quote > recoveryRate_
 
Handle< Quote > securitySpread_
 
Handle< YieldTermStructure > incomeCurve_
 
bool conditionalOnSurvival_
 
Date issueDate_
 
PriceQuoteMethod priceQuoteMethod_
 
double priceQuoteBaseValue_
 
bool isInflationLinked_
 
double bidAskAdjustment_
 
QuantLib::ext::shared_ptr< DiscountingRiskyBondEnginevanillaBondEngine_
 
bool bondIssueDateFallback_ = false
 

Detailed Description

Bond Futures Index.

Definition at line 159 of file bondindex.hpp.

Constructor & Destructor Documentation

◆ BondFuturesIndex()

BondFuturesIndex ( const QuantLib::Date &  expiryDate,
const std::string &  securityName,
const bool  dirty = false,
const bool  relative = true,
const Calendar &  fixingCalendar = NullCalendar(),
const QuantLib::ext::shared_ptr< QuantLib::Bond > &  bond = nullptr,
const Handle< YieldTermStructure > &  discountCurve = Handle<YieldTermStructure>(),
const Handle< DefaultProbabilityTermStructure > &  defaultCurve = Handle<DefaultProbabilityTermStructure>(),
const Handle< Quote > &  recoveryRate = Handle<Quote>(),
const Handle< Quote > &  securitySpread = Handle<Quote>(),
const Handle< YieldTermStructure > &  incomeCurve = Handle<YieldTermStructure>(),
const bool  conditionalOnSurvival = true,
const Date &  issueDate = Date(),
const PriceQuoteMethod  priceQuoteMethod = PriceQuoteMethod::PercentageOfPar,
const double  priceQuoteBaseValue = 1.0 
)

Definition at line 158 of file bondindex.cpp.

const QuantLib::Date & expiryDate() const
Definition: bondindex.hpp:185
bool dirty() const
Definition: bondindex.hpp:123
BondIndex(const std::string &securityName, const bool dirty=false, const bool relative=true, const Calendar &fixingCalendar=NullCalendar(), const QuantLib::ext::shared_ptr< QuantLib::Bond > &bond=nullptr, const Handle< YieldTermStructure > &discountCurve=Handle< YieldTermStructure >(), const Handle< DefaultProbabilityTermStructure > &defaultCurve=Handle< DefaultProbabilityTermStructure >(), const Handle< Quote > &recoveryRate=Handle< Quote >(), const Handle< Quote > &securitySpread=Handle< Quote >(), const Handle< YieldTermStructure > &incomeCurve=Handle< YieldTermStructure >(), const bool conditionalOnSurvival=true, const Date &issueDate=Date(), const PriceQuoteMethod priceQuoteMethod=PriceQuoteMethod::PercentageOfPar, const double priceQuoteBaseValue=1.0, const bool isInflationLinked=false, const double bidAskAdjustment=0.0, const bool bondIssueDateFallback=false)
Definition: bondindex.cpp:29
const std::string & securityName() const
Definition: bondindex.hpp:122
Handle< Quote > recoveryRate() const
Definition: bondindex.hpp:128
double priceQuoteBaseValue() const
Definition: bondindex.hpp:134
Calendar fixingCalendar() const override
Definition: bondindex.cpp:59
Handle< YieldTermStructure > discountCurve() const
Definition: bondindex.hpp:126
bool conditionalOnSurvival() const
Definition: bondindex.hpp:131
Handle< DefaultProbabilityTermStructure > defaultCurve() const
Definition: bondindex.hpp:127
Handle< YieldTermStructure > incomeCurve() const
Definition: bondindex.hpp:130
Date issueDate() const
Definition: bondindex.hpp:132
Handle< Quote > securitySpread() const
Definition: bondindex.hpp:129
bool relative() const
Definition: bondindex.hpp:124
QuantLib::ext::shared_ptr< QuantLib::Bond > bond() const
Definition: bondindex.hpp:125
PriceQuoteMethod priceQuoteMethod() const
Definition: bondindex.hpp:133

Member Function Documentation

◆ name()

std::string name ( ) const
override

Definition at line 170 of file bondindex.cpp.

170 {
171 if (name_ == "") {
172 std::ostringstream o;
173 o << "BOND-" << securityName() << "-" << QuantLib::io::iso_date(expiryDate_);
174 name_ = o.str();
175 // Remove the "-dd" portion from the expiry date
176 name_.erase(name_.length() - 3);
177 }
178
179 return name_;
180}
+ Here is the call graph for this function:

◆ forecastFixing()

Rate forecastFixing ( const Date &  fixingDate) const
overridevirtual

Reimplemented from BondIndex.

Definition at line 182 of file bondindex.cpp.

182 {
183 Date today = Settings::instance().evaluationDate();
184 QL_REQUIRE(fixingDate >= today, "BondFuturesIndex::forecastFixing(): fixingDate ("
185 << fixingDate << ") must be >= today (" << today << ")");
186 QL_REQUIRE(bond_, "BondFuturesIndex::forecastFixing(): bond required");
187
188 auto bondNpvResults = vanillaBondEngine_->calculateNpv(bond()->settlementDate(expiryDate_),
189 bond()->settlementDate(expiryDate_), bond()->cashflows(),
190 boost::none, incomeCurve(), conditionalOnSurvival(), false);
191 Real price = bondNpvResults.npv;
192
193 if (!dirty()) {
194 price -= bond()->accruedAmount(expiryDate_) / 100.0 * bond()->notional(expiryDate_);
195 }
196
197 if (relative()) {
198 if (close_enough(bond()->notional(expiryDate_), 0.0))
199 price = 0.0;
200 else
201 price /= bond()->notional(expiryDate_);
202 }
203
204 return price;
205}
QuantLib::ext::shared_ptr< DiscountingRiskyBondEngine > vanillaBondEngine_
Definition: bondindex.hpp:153
QuantLib::ext::shared_ptr< QuantLib::Bond > bond_
Definition: bondindex.hpp:141
Filter close_enough(const RandomVariable &x, const RandomVariable &y)
+ Here is the call graph for this function:

◆ expiryDate()

const QuantLib::Date & expiryDate ( ) const

Definition at line 185 of file bondindex.hpp.

185{ return expiryDate_; }

Member Data Documentation

◆ expiryDate_

Date expiryDate_
private

Definition at line 189 of file bondindex.hpp.

◆ name_

std::string name_
mutableprivate

Definition at line 190 of file bondindex.hpp.