22#include <ql/event.hpp>
23#include <ql/termstructures/yieldtermstructure.hpp>
27BondTRS::BondTRS(
const QuantLib::ext::shared_ptr<QuantExt::BondIndex>& bondIndex,
const Real bondNotional,
28 const Real initialPrice,
const std::vector<QuantLib::Leg>& fundingLeg,
const bool payTotalReturnLeg,
29 const std::vector<Date>& valuationDates,
const std::vector<Date>& paymentDates,
30 const QuantLib::ext::shared_ptr<QuantExt::FxIndex>& fxIndex,
bool payBondCashFlowsImmediately,
31 const Currency& fundingCurrency,
const Currency& bondCurrency)
32 : bondIndex_(bondIndex), bondNotional_(bondNotional), initialPrice_(initialPrice), fundingLeg_(fundingLeg),
33 payTotalReturnLeg_(payTotalReturnLeg), fxIndex_(fxIndex),
34 payBondCashFlowsImmediately_(payBondCashFlowsImmediately), fundingCurrency_(fundingCurrency),
35 bondCurrency_(bondCurrency), valuationDates_(valuationDates), paymentDates_(paymentDates) {
37 QL_REQUIRE(
bondIndex,
"BondTRS: no bond index given");
46 "BondTRS: fx index required if funding ccy ("
51 "BondTRS: fx index '" <<
fxIndex_->name() <<
"' currencies must match bond ccy / funding ccy ("
57 for (
auto const& c : l)
60 QL_REQUIRE(
valuationDates.size() > 1,
"valuation dates size > 1 required");
70 QL_REQUIRE(
arguments,
"BondTRS instrument: wrong argument type in bond total return swap");
cashflow paying the total return of a bond
bool payBondCashFlowsImmediately
QuantLib::ext::shared_ptr< QuantExt::BondIndex > bondIndex
std::vector< Date > valuationDates
std::vector< Leg > fundingLeg
QuantLib::ext::shared_ptr< QuantExt::FxIndex > fxIndex
std::vector< Date > paymentDates
bool payBondCashFlowsImmediately_
const QuantLib::ext::shared_ptr< QuantExt::BondIndex > & bondIndex() const
void setupArguments(PricingEngine::arguments *) const override
QuantLib::ext::shared_ptr< QuantExt::FxIndex > fxIndex_
BondTRS(const QuantLib::ext::shared_ptr< QuantExt::BondIndex > &bondIndex, const Real bondNotional, const Real initialPrice, const std::vector< Leg > &fundingLeg, const bool payTotalReturnLeg, const std::vector< Date > &valuationDates, const std::vector< Date > &paymentDates, const QuantLib::ext::shared_ptr< QuantExt::FxIndex > &fxIndex=nullptr, bool payBondCashFlowsImmediately=false, const Currency &fundingCurrency=Currency(), const Currency &bondCurrency=Currency())
Constructor.
bool isExpired() const override
std::vector< Leg > fundingLeg_
const std::vector< Date > & valuationDates() const
const std::vector< Leg > & fundingLeg() const
std::vector< Date > valuationDates_
Currency fundingCurrency_
std::vector< Date > paymentDates_
QuantLib::ext::shared_ptr< QuantExt::BondIndex > bondIndex_
helper class building a sequence of bond trs cashflows
BondTRSLeg & withInitialPrice(Real)