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

#include <qle/instruments/riskparticipationagreement_tlock.hpp>

+ Inheritance diagram for RiskParticipationAgreementTLock:
+ Collaboration diagram for RiskParticipationAgreementTLock:

Classes

class  arguments
 
class  engine
 
class  results
 

Public Member Functions

 RiskParticipationAgreementTLock (const QuantLib::ext::shared_ptr< QuantLib::Bond > &bond, Real bondNotional, bool payer, Real referenceRate, const DayCounter &dayCounter, const Date &terminationDate, const Date &paymentDate, const std::vector< Leg > &protectionFee, const bool protectionFeePayer, const std::vector< std::string > &protectionFeeCcys, const Real participationRate, const Date &protectionStart, const Date &protectionEnd, const bool settlesAccrual, const Real fixedRecoveryRate=Null< Real >())
 
bool isExpired () const override
 Instrument interface. More...
 
const QuantLib::ext::shared_ptr< QuantLib::Bond > & bond () const
 Inspectors. More...
 
bool payer ()
 
Real referenceRate () const
 
const DayCounter & dayCounter () const
 
const Date & terminationDate () const
 
const Date & paymentDate () const
 
const std::vector< Leg > & protectionFee () const
 
bool protectionFeePayer () const
 
const std::vector< std::string > & protectionFeeCcys () const
 
Real participationRate () const
 
const Date & protectionStart () const
 
const Date & protectionEnd () const
 
bool settlesAccrual () const
 
Real fixedRecoveryRate () const
 
const Date & maturity () const
 

Private Member Functions

void setupArguments (QuantLib::PricingEngine::arguments *) const override
 
void setupExpired () const override
 
void fetchResults (const QuantLib::PricingEngine::results *) const override
 

Private Attributes

QuantLib::ext::shared_ptr< QuantLib::Bond > bond_
 
Real bondNotional_
 
bool payer_
 
Real referenceRate_
 
DayCounter dayCounter_
 
Date terminationDate_
 
Date paymentDate_
 
std::vector< Leg > protectionFee_
 
bool protectionFeePayer_
 
std::vector< std::string > protectionFeeCcys_
 
Real participationRate_
 
Date protectionStart_
 
Date protectionEnd_
 
bool settlesAccrual_
 
Real fixedRecoveryRate_
 
Date maturity_
 

Detailed Description

Definition at line 36 of file riskparticipationagreement_tlock.hpp.

Constructor & Destructor Documentation

◆ RiskParticipationAgreementTLock()

RiskParticipationAgreementTLock ( const QuantLib::ext::shared_ptr< QuantLib::Bond > &  bond,
Real  bondNotional,
bool  payer,
Real  referenceRate,
const DayCounter &  dayCounter,
const Date &  terminationDate,
const Date &  paymentDate,
const std::vector< Leg > &  protectionFee,
const bool  protectionFeePayer,
const std::vector< std::string > &  protectionFeeCcys,
const Real  participationRate,
const Date &  protectionStart,
const Date &  protectionEnd,
const bool  settlesAccrual,
const Real  fixedRecoveryRate = Null<Real>() 
)

The bond must be a fixed rate bond, i.e. it may only contain FixedCoupons. The udnerlying payout is (referenceRate - bond yield) * DV01 if payer = false, otherwise multiplied by -1. As in the swap RPA, protectionFeepayer = true means protection is received, protection fee is paid.

Definition at line 27 of file riskparticipationagreement_tlock.cpp.

38
39 // checks
40
41 QL_REQUIRE(bond != nullptr, "RiskParticipationAgreementTLock: underlying bond is null");
42 QL_REQUIRE(!dayCounter.empty(), "RiskParticipationAgreementTLock: day counter is empty");
43
44 QL_REQUIRE(paymentDate_ >= terminationDate, "RiskParticipationAgreementTLock: payment date ("
45 << paymentDate_ << ") must be >= termination date ("
46 << terminationDate_ << ")");
47 QL_REQUIRE(protectionFee_.size() == protectionFeeCcys_.size(),
48 "protection fee size (" << protectionFee_.size() << ") must match protecttion fee ccys size ("
49 << protectionFeeCcys_.size() << ")");
50 QL_REQUIRE(participationRate_ > 0.0 || close_enough(participationRate_, 0.0),
51 "participation rate must be non-negative (" << participationRate_ << ")");
53 "protection end (" << protectionEnd_ << ") must be greater than protection start " << protectionStart_);
54
55 for (auto const& c : bond->cashflows()) {
56 if (auto tmp = QuantLib::ext::dynamic_pointer_cast<Coupon>(c)) {
57 QL_REQUIRE(QuantLib::ext::dynamic_pointer_cast<FixedRateCoupon>(c),
58 "RiskParticipationAgreementTLock: only fixed rate coupons allowed in bond underlying");
59 }
60 }
61
62 // the maturity is the maximum of the protection end date and fee payment dates
63
65 for (auto const& p : protectionFee)
66 maturity_ = std::max(maturity_, CashFlows::maturityDate(p));
67
68 // register with observables
69
70 for (auto const& l : protectionFee)
71 for (auto const& c : l)
72 registerWith(c);
73}
const QuantLib::ext::shared_ptr< QuantLib::Bond > & bond() const
Inspectors.
const std::vector< std::string > & protectionFeeCcys() const
QuantLib::ext::shared_ptr< QuantLib::Bond > bond_
Filter close_enough(const RandomVariable &x, const RandomVariable &y)
+ Here is the call graph for this function:

Member Function Documentation

◆ isExpired()

bool isExpired ( ) const
override

Instrument interface.

Definition at line 75 of file riskparticipationagreement_tlock.cpp.

75{ return detail::simple_event(maturity_).hasOccurred(); }

◆ bond()

const QuantLib::ext::shared_ptr< QuantLib::Bond > & bond ( ) const

Inspectors.

Definition at line 56 of file riskparticipationagreement_tlock.hpp.

56{ return bond_; }
+ Here is the caller graph for this function:

◆ payer()

bool payer ( )

Definition at line 57 of file riskparticipationagreement_tlock.hpp.

57{ return payer_; }

◆ referenceRate()

Real referenceRate ( ) const

Definition at line 58 of file riskparticipationagreement_tlock.hpp.

58{ return referenceRate_; }

◆ dayCounter()

const DayCounter & dayCounter ( ) const

Definition at line 59 of file riskparticipationagreement_tlock.hpp.

59{ return dayCounter_; }
+ Here is the caller graph for this function:

◆ terminationDate()

const Date & terminationDate ( ) const

Definition at line 60 of file riskparticipationagreement_tlock.hpp.

60{ return terminationDate_; }
+ Here is the caller graph for this function:

◆ paymentDate()

const Date & paymentDate ( ) const

Definition at line 61 of file riskparticipationagreement_tlock.hpp.

61{ return paymentDate_; }

◆ protectionFee()

const std::vector< Leg > & protectionFee ( ) const

Definition at line 63 of file riskparticipationagreement_tlock.hpp.

63{ return protectionFee_; }
+ Here is the caller graph for this function:

◆ protectionFeePayer()

bool protectionFeePayer ( ) const

Definition at line 64 of file riskparticipationagreement_tlock.hpp.

64{ return protectionFeePayer_; }

◆ protectionFeeCcys()

const std::vector< std::string > & protectionFeeCcys ( ) const

Definition at line 65 of file riskparticipationagreement_tlock.hpp.

65{ return protectionFeeCcys_; }

◆ participationRate()

Real participationRate ( ) const

Definition at line 66 of file riskparticipationagreement_tlock.hpp.

66{ return participationRate_; }

◆ protectionStart()

const Date & protectionStart ( ) const

Definition at line 67 of file riskparticipationagreement_tlock.hpp.

67{ return protectionStart_; }

◆ protectionEnd()

const Date & protectionEnd ( ) const

Definition at line 68 of file riskparticipationagreement_tlock.hpp.

68{ return protectionEnd_; }

◆ settlesAccrual()

bool settlesAccrual ( ) const

Definition at line 69 of file riskparticipationagreement_tlock.hpp.

69{ return settlesAccrual_; }

◆ fixedRecoveryRate()

Real fixedRecoveryRate ( ) const

Definition at line 70 of file riskparticipationagreement_tlock.hpp.

70{ return fixedRecoveryRate_; }

◆ maturity()

const Date & maturity ( ) const

Definition at line 73 of file riskparticipationagreement_tlock.hpp.

73{ return maturity_; }

◆ setupArguments()

void setupArguments ( QuantLib::PricingEngine::arguments args) const
overrideprivate

Definition at line 79 of file riskparticipationagreement_tlock.cpp.

79 {
80 RiskParticipationAgreementTLock::arguments* arguments =
81 dynamic_cast<RiskParticipationAgreementTLock::arguments*>(args);
82 QL_REQUIRE(arguments, "RiskParticipationAgreement::setupArguments(): wrong argument type");
83 arguments->bond = bond_;
84 arguments->bondNotional = bondNotional_;
85 arguments->payer = payer_;
86 arguments->referenceRate = referenceRate_;
87 arguments->dayCounter = dayCounter_;
88 arguments->terminationDate = terminationDate_;
89 arguments->paymentDate = paymentDate_;
90
91 arguments->protectionFee = protectionFee_;
92 arguments->protectionFeePayer = protectionFeePayer_;
93 arguments->protectionFeeCcys = protectionFeeCcys_;
94 arguments->participationRate = participationRate_;
95 arguments->protectionStart = protectionStart_;
96 arguments->protectionEnd = protectionEnd_;
97 arguments->settlesAccrual = settlesAccrual_;
98 arguments->fixedRecoveryRate = fixedRecoveryRate_;
99}

◆ setupExpired()

void setupExpired ( ) const
overrideprivate

Definition at line 77 of file riskparticipationagreement_tlock.cpp.

77{ Instrument::setupExpired(); }

◆ fetchResults()

void fetchResults ( const QuantLib::PricingEngine::results *  ) const
overrideprivate

Definition at line 101 of file riskparticipationagreement_tlock.cpp.

101 {
102 Instrument::fetchResults(r);
103}

Member Data Documentation

◆ bond_

QuantLib::ext::shared_ptr<QuantLib::Bond> bond_
private

Definition at line 81 of file riskparticipationagreement_tlock.hpp.

◆ bondNotional_

Real bondNotional_
private

Definition at line 82 of file riskparticipationagreement_tlock.hpp.

◆ payer_

bool payer_
private

Definition at line 83 of file riskparticipationagreement_tlock.hpp.

◆ referenceRate_

Real referenceRate_
private

Definition at line 84 of file riskparticipationagreement_tlock.hpp.

◆ dayCounter_

DayCounter dayCounter_
private

Definition at line 85 of file riskparticipationagreement_tlock.hpp.

◆ terminationDate_

Date terminationDate_
private

Definition at line 86 of file riskparticipationagreement_tlock.hpp.

◆ paymentDate_

Date paymentDate_
private

Definition at line 87 of file riskparticipationagreement_tlock.hpp.

◆ protectionFee_

std::vector<Leg> protectionFee_
private

Definition at line 90 of file riskparticipationagreement_tlock.hpp.

◆ protectionFeePayer_

bool protectionFeePayer_
private

Definition at line 91 of file riskparticipationagreement_tlock.hpp.

◆ protectionFeeCcys_

std::vector<std::string> protectionFeeCcys_
private

Definition at line 92 of file riskparticipationagreement_tlock.hpp.

◆ participationRate_

Real participationRate_
private

Definition at line 93 of file riskparticipationagreement_tlock.hpp.

◆ protectionStart_

Date protectionStart_
private

Definition at line 94 of file riskparticipationagreement_tlock.hpp.

◆ protectionEnd_

Date protectionEnd_
private

Definition at line 94 of file riskparticipationagreement_tlock.hpp.

◆ settlesAccrual_

bool settlesAccrual_
private

Definition at line 95 of file riskparticipationagreement_tlock.hpp.

◆ fixedRecoveryRate_

Real fixedRecoveryRate_
private

Definition at line 96 of file riskparticipationagreement_tlock.hpp.

◆ maturity_

Date maturity_
private

Definition at line 98 of file riskparticipationagreement_tlock.hpp.