18#include <boost/make_shared.hpp>
19#include <ql/cashflows/iborcoupon.hpp>
20#include <ql/utilities/null_deleter.hpp>
27 const Handle<Quote>& rate,
const Handle<Quote>& spotFx, Natural settlementDays,
const Calendar& paymentCalendar,
28 BusinessDayConvention paymentConvention,
const Period& tenor,
const Currency& fixedCurrency,
29 Frequency fixedFrequency, BusinessDayConvention fixedConvention,
const DayCounter& fixedDayCount,
30 const QuantLib::ext::shared_ptr<IborIndex>& index,
const Handle<YieldTermStructure>& floatDiscount,
31 const Handle<Quote>& spread,
bool endOfMonth,
bool resetsOnFloatLeg)
32 :
RelativeDateRateHelper(rate), spotFx_(spotFx), settlementDays_(settlementDays), paymentCalendar_(paymentCalendar),
33 paymentConvention_(paymentConvention), tenor_(tenor), fixedCurrency_(fixedCurrency),
34 fixedFrequency_(fixedFrequency), fixedConvention_(fixedConvention), fixedDayCount_(fixedDayCount), index_(index),
35 floatDiscount_(floatDiscount),
spread_(spread), endOfMonth_(endOfMonth), resetsOnFloatLeg_(resetsOnFloatLeg){
37 QL_REQUIRE(!
spotFx_.empty(),
"Spot FX quote cannot be empty.");
38 QL_REQUIRE(
fixedCurrency_ !=
index_->currency(),
"Fixed currency should not equal float leg currency.");
51 Date referenceDate = evaluationDate_ = Settings::instance().evaluationDate();
67 Natural paymentLag = 0;
69 QuantLib::ext::shared_ptr<FxIndex> fxIdx;
83 QuantLib::ext::shared_ptr<PricingEngine> engine = QuantLib::ext::make_shared<CrossCcySwapEngine>(
85 swap_->setPricingEngine(engine);
87 earliestDate_ =
swap_->startDate();
88 latestDate_ =
swap_->maturityDate();
92 if (!IborCoupon::Settings::instance().usingAtParCoupons()) {
93 Size numCashflows =
swap_->leg(1).size();
94 Date endDate = latestDate_;
95 if (numCashflows > 0) {
96 for(Size i = numCashflows; i > 0; i--) {
98 QuantLib::ext::shared_ptr<FloatingRateCoupon> lastFloating =
99 QuantLib::ext::dynamic_pointer_cast<FloatingRateCoupon>(
swap_->leg(1)[pos]);
103 Date fixingValueDate =
index_->valueDate(lastFloating->fixingDate());
104 endDate =
index_->maturityDate(fixingValueDate);
105 Date endValueDate =
index_->maturityDate(fixingValueDate);
106 latestDate_ = std::max(latestDate_, endValueDate);
115 QuantLib::ext::shared_ptr<YieldTermStructure> temp(t, null_deleter());
117 RelativeDateRateHelper::setTermStructure(t);
130 RelativeDateRateHelper::update();
134 QL_REQUIRE(termStructure_,
"Term structure needs to be set");
136 return swap_->fairFixedRate();
140 Visitor<CrossCcyFixFloatMtMResetSwapHelper>* v1 =
dynamic_cast<Visitor<CrossCcyFixFloatMtMResetSwapHelper>*
>(&v);
144 RateHelper::accept(v);
QuantLib::DayCounter fixedDayCount_
void setTermStructure(YieldTermStructure *) override
QuantLib::Handle< QuantLib::Quote > spotFx_
QuantLib::Frequency fixedFrequency_
QuantLib::BusinessDayConvention paymentConvention_
QuantLib::ext::shared_ptr< CrossCcyFixFloatMtMResetSwap > swap_
QuantLib::Handle< QuantLib::Quote > spread_
RelinkableHandle< YieldTermStructure > termStructureHandle_
void accept(AcyclicVisitor &) override
QuantLib::Currency fixedCurrency_
QuantLib::Natural settlementDays_
void initializeDates() override
CrossCcyFixFloatMtMResetSwapHelper(const QuantLib::Handle< QuantLib::Quote > &rate, const QuantLib::Handle< QuantLib::Quote > &spotFx, QuantLib::Natural settlementDays, const QuantLib::Calendar &paymentCalendar, QuantLib::BusinessDayConvention paymentConvention, const QuantLib::Period &tenor, const QuantLib::Currency &fixedCurrency, QuantLib::Frequency fixedFrequency, QuantLib::BusinessDayConvention fixedConvention, const QuantLib::DayCounter &fixedDayCount, const QuantLib::ext::shared_ptr< QuantLib::IborIndex > &index, const QuantLib::Handle< QuantLib::YieldTermStructure > &floatDiscount, const Handle< Quote > &spread=Handle< Quote >(), bool endOfMonth=false, bool resetsOnFloatLeg=true)
Real impliedQuote() const override
QuantLib::Calendar paymentCalendar_
QuantLib::BusinessDayConvention fixedConvention_
QuantLib::Handle< QuantLib::YieldTermStructure > floatDiscount_
QuantLib::ext::shared_ptr< QuantLib::IborIndex > index_
Cross currency swap engine.