21#include <ql/cashflows/cashflows.hpp>
22#include <ql/event.hpp>
27 const std::vector<Leg>& underlying,
const std::vector<bool>& underlyingPayer,
28 const std::vector<std::string>& underlyingCcys,
const std::vector<Leg>& protectionFee,
29 const bool protectionFeePayer,
const std::vector<std::string>& protectionFeeCcys,
const Real participationRate,
30 const Date& protectionStart,
const Date& protectionEnd,
const bool settlesAccrual,
const Real fixedRecoveryRate,
31 const QuantLib::ext::shared_ptr<Exercise>& exercise,
const bool exerciseIsLong,
const std::vector<QuantLib::ext::shared_ptr<CashFlow>>& premium,
const bool nakedOption)
32 : underlying_(underlying), underlyingPayer_(underlyingPayer), underlyingCcys_(underlyingCcys),
33 protectionFee_(protectionFee), protectionFeePayer_(protectionFeePayer), protectionFeeCcys_(protectionFeeCcys),
34 participationRate_(participationRate), protectionStart_(protectionStart), protectionEnd_(protectionEnd),
35 settlesAccrual_(settlesAccrual), fixedRecoveryRate_(fixedRecoveryRate), exercise_(exercise),
36 exerciseIsLong_(exerciseIsLong), premium_(premium), nakedOption_(nakedOption) {
39 "underlying size (" <<
underlying_.size() <<
") must match underlying payer size ("
42 "underlying size (" <<
underlying_.size() <<
") must match underlying ccys size ("
44 QL_REQUIRE(!
underlying_.empty(),
"underlying is empty");
46 "protection fee size (" <<
protectionFee_.size() <<
") must match protecttion fee ccys size ("
66 for (
auto const& c : l) {
68 if (
auto lazy = QuantLib::ext::dynamic_pointer_cast<LazyObject>(c))
69 lazy->alwaysForwardNotifications();
74 for (
auto const& c : l) {
76 if (
auto lazy = QuantLib::ext::dynamic_pointer_cast<LazyObject>(c))
77 lazy->alwaysForwardNotifications();
85 Instrument::setupExpired();
94 QL_REQUIRE(
arguments,
"RiskParticipationAgreement::setupArguments(): wrong argument type");
119 Instrument::fetchResults(r);
121 QL_REQUIRE(
results,
"RiskParticipationAgreement::fetchResults(): wrong result type");
std::vector< std::string > underlyingCcys
std::vector< std::string > protectionFeeCcys
std::vector< QuantLib::ext::shared_ptr< CashFlow > > premium
Date optionRepresentationReferenceDate
std::vector< QuantLib::ext::shared_ptr< Instrument > > optionRepresentation
QuantLib::ext::shared_ptr< Exercise > exercise
std::vector< std::tuple< Date, Date, Date > > optionRepresentationPeriods
std::vector< Leg > underlying
std::vector< Leg > protectionFee
std::vector< Real > optionMultiplier
std::vector< bool > underlyingPayer
Date optionRepresentationReferenceDate
std::vector< QuantLib::ext::shared_ptr< Instrument > > optionRepresentation
std::vector< std::tuple< Date, Date, Date > > optionRepresentationPeriods
std::vector< Real > optionMultiplier
void fetchResults(const QuantLib::PricingEngine::results *) const override
const std::vector< std::string > protectionFeeCcys_
const Real fixedRecoveryRate_
const std::vector< Leg > & underlying() const
Inspectors.
bool isExpired() const override
Instrument interface.
std::vector< QuantLib::ext::shared_ptr< Instrument > > optionRepresentation_
const std::vector< Leg > underlying_
const QuantLib::ext::shared_ptr< Exercise > exercise_
const std::vector< std::string > underlyingCcys_
std::vector< std::tuple< Date, Date, Date > > optionRepresentationPeriods_
const std::vector< Leg > protectionFee_
const std::vector< QuantLib::ext::shared_ptr< CashFlow > > premium_
RiskParticipationAgreement(const std::vector< Leg > &underlying, const std::vector< bool > &underlyingPayer, const std::vector< std::string > &underlyingCcys, 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 QuantLib::ext::shared_ptr< QuantLib::Exercise > &exercise=nullptr, const bool exerciseIsLong=false, const std::vector< QuantLib::ext::shared_ptr< CashFlow > > &premium=std::vector< QuantLib::ext::shared_ptr< CashFlow > >(), const bool nakedOption=false)
const Date & maturity() const
const Date protectionStart_
const Real participationRate_
const bool settlesAccrual_
const std::vector< bool > underlyingPayer_
const Date protectionEnd_
const bool protectionFeePayer_
std::vector< Real > optionMultiplier_
const std::vector< Leg > & protectionFee() const
void setupExpired() const override
void setupArguments(QuantLib::PricingEngine::arguments *) const override
Date optionRepresentationReferenceDate_
const bool exerciseIsLong_
Filter close_enough(const RandomVariable &x, const RandomVariable &y)