19#include <boost/make_shared.hpp>
20#include <ql/cashflows/fixedratecoupon.hpp>
21#include <ql/math/comparison.hpp>
22#include <ql/utilities/null_deleter.hpp>
28using QuantLib::FixedRateCoupon;
29using QuantLib::YieldTermStructure;
34 const Handle<Quote>& rate,
const Handle<Quote>& spotFx, Natural settlementDays,
const Calendar& paymentCalendar,
35 BusinessDayConvention paymentConvention,
const Period& tenor,
const Currency& fixedCurrency,
36 Frequency fixedFrequency, BusinessDayConvention fixedConvention,
const DayCounter& fixedDayCount,
37 const QuantLib::ext::shared_ptr<IborIndex>& index,
const Handle<YieldTermStructure>& floatDiscount,
38 const Handle<Quote>& spread,
bool endOfMonth)
39 :
RelativeDateRateHelper(rate), spotFx_(spotFx), settlementDays_(settlementDays), paymentCalendar_(paymentCalendar),
40 paymentConvention_(paymentConvention), tenor_(tenor), fixedCurrency_(fixedCurrency),
41 fixedFrequency_(fixedFrequency), fixedConvention_(fixedConvention), fixedDayCount_(fixedDayCount), index_(index),
42 floatDiscount_(floatDiscount),
spread_(spread), endOfMonth_(endOfMonth) {
44 QL_REQUIRE(!
spotFx_.empty(),
"Spot FX quote cannot be empty.");
45 QL_REQUIRE(
fixedCurrency_ !=
index_->currency(),
"Fixed currency should not equal float leg currency.");
66 RelativeDateRateHelper::update();
70 QL_REQUIRE(termStructure_,
"Term structure needs to be set");
72 return swap_->fairFixedRate();
76 QuantLib::ext::shared_ptr<YieldTermStructure> temp(yts, null_deleter());
78 RelativeDateRateHelper::setTermStructure(yts);
82 if (Visitor<CrossCcyFixFloatSwapHelper>* v1 =
dynamic_cast<Visitor<CrossCcyFixFloatSwapHelper>*
>(&v))
85 RateHelper::accept(v);
91 Date referenceDate = evaluationDate_ = Settings::instance().evaluationDate();
97 Real floatNominal = 1.0;
98 Real fixedNominal =
spotFx_->value();
109 Natural paymentLag = 0;
116 earliestDate_ =
swap_->startDate();
117 maturityDate_ =
swap_->maturityDate();
120 latestRelevantDate_ = earliestDate_;
121 for (Size i = 0; i <
swap_->leg(0).size(); ++i) {
122 latestRelevantDate_ = std::max(latestRelevantDate_,
swap_->leg(0)[i]->date());
124 pillarDate_ = latestDate_ = latestRelevantDate_;
127 QuantLib::ext::shared_ptr<PricingEngine> engine = QuantLib::ext::make_shared<CrossCcySwapEngine>(
129 swap_->setPricingEngine(engine);
QuantLib::DayCounter fixedDayCount_
CrossCcyFixFloatSwapHelper(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)
QuantLib::Handle< QuantLib::Quote > spotFx_
QuantLib::Frequency fixedFrequency_
QuantLib::BusinessDayConvention paymentConvention_
QuantLib::Handle< QuantLib::Quote > spread_
void accept(QuantLib::AcyclicVisitor &) override
QuantLib::RelinkableHandle< QuantLib::YieldTermStructure > termStructureHandle_
QuantLib::Currency fixedCurrency_
QuantLib::Natural settlementDays_
void initializeDates() override
QuantLib::Real impliedQuote() const override
QuantLib::Calendar paymentCalendar_
QuantLib::BusinessDayConvention fixedConvention_
QuantLib::ext::shared_ptr< CrossCcyFixFloatSwap > swap_
void setTermStructure(QuantLib::YieldTermStructure *) override
QuantLib::Handle< QuantLib::YieldTermStructure > floatDiscount_
QuantLib::ext::shared_ptr< QuantLib::IborIndex > index_
Cross currency swap engine.
Cross currency fixed vs. float swap helper.
Cross currency swap engine.
RelativeDateBootstrapHelper< YieldTermStructure > RelativeDateRateHelper