21#include <ql/cashflows/cashflows.hpp>
22#include <ql/cashflows/fixedratecoupon.hpp>
23#include <ql/event.hpp>
28 const QuantLib::ext::shared_ptr<QuantLib::Bond>& bond, Real bondNotional,
bool payer, Real referenceRate,
29 const DayCounter& dayCounter,
const Date& terminationDate,
const Date& paymentDate,
30 const std::vector<Leg>& protectionFee,
const bool protectionFeePayer,
31 const std::vector<std::string>& protectionFeeCcys,
const Real participationRate,
const Date& protectionStart,
32 const Date& protectionEnd,
const bool settlesAccrual,
const Real fixedRecoveryRate)
33 :
bond_(bond), bondNotional_(bondNotional), payer_(payer), referenceRate_(referenceRate), dayCounter_(dayCounter),
34 terminationDate_(terminationDate), paymentDate_(paymentDate), protectionFee_(protectionFee),
35 protectionFeePayer_(protectionFeePayer), protectionFeeCcys_(protectionFeeCcys),
36 participationRate_(participationRate), protectionStart_(protectionStart), protectionEnd_(protectionEnd),
37 settlesAccrual_(settlesAccrual), fixedRecoveryRate_(fixedRecoveryRate) {
41 QL_REQUIRE(
bond !=
nullptr,
"RiskParticipationAgreementTLock: underlying bond is null");
42 QL_REQUIRE(!
dayCounter.empty(),
"RiskParticipationAgreementTLock: day counter is empty");
48 "protection fee size (" <<
protectionFee_.size() <<
") must match protecttion fee ccys size ("
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");
71 for (
auto const& c : l)
82 QL_REQUIRE(
arguments,
"RiskParticipationAgreement::setupArguments(): wrong argument type");
102 Instrument::fetchResults(r);
std::vector< std::string > protectionFeeCcys
QuantLib::ext::shared_ptr< QuantLib::Bond > bond
std::vector< Leg > protectionFee
void fetchResults(const QuantLib::PricingEngine::results *) const override
bool isExpired() const override
Instrument interface.
std::vector< Leg > protectionFee_
const DayCounter & dayCounter() const
std::vector< std::string > protectionFeeCcys_
const QuantLib::ext::shared_ptr< QuantLib::Bond > & bond() const
Inspectors.
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 >())
const Date & terminationDate() const
const std::vector< Leg > & protectionFee() const
void setupExpired() const override
void setupArguments(QuantLib::PricingEngine::arguments *) const override
QuantLib::ext::shared_ptr< QuantLib::Bond > bond_
Filter close_enough(const RandomVariable &x, const RandomVariable &y)
RPA instrument for tlock underlyings.