19#include <boost/assign/list_of.hpp>
21#include <ql/cashflows/iborcoupon.hpp>
22#include <ql/cashflows/simplecashflow.hpp>
28using boost::assign::list_of;
33 const QuantLib::ext::shared_ptr<IborIndex>& payIndex, Spread paySpread, Real payGearing,
34 Real recNominal,
const Currency& recCurrency,
const Schedule& recSchedule,
35 const QuantLib::ext::shared_ptr<IborIndex>& recIndex, Spread recSpread, Real recGearing,
36 Size payPaymentLag, Size recPaymentLag, boost::optional<bool> payIncludeSpread,
37 boost::optional<Period> payLookback, boost::optional<Size> payFixingDays,
38 boost::optional<Size> payRateCutoff, boost::optional<bool> payIsAveraged,
39 boost::optional<bool> recIncludeSpread, boost::optional<Period> recLookback,
40 boost::optional<Size> recFixingDays, boost::optional<Size> recRateCutoff,
41 boost::optional<bool> recIsAveraged,
const bool telescopicValueDates)
42 :
CrossCcySwap(2), payNominal_(payNominal), payCurrency_(payCurrency), paySchedule_(paySchedule),
43 payIndex_(payIndex), paySpread_(paySpread), payGearing_(payGearing), recNominal_(recNominal),
44 recCurrency_(recCurrency), recSchedule_(recSchedule), recIndex_(recIndex), recSpread_(recSpread),
45 recGearing_(recGearing), payPaymentLag_(payPaymentLag), recPaymentLag_(recPaymentLag),
46 payIncludeSpread_(payIncludeSpread), payLookback_(payLookback), payFixingDays_(payFixingDays),
47 payRateCutoff_(payRateCutoff), payIsAveraged_(payIsAveraged), recIncludeSpread_(recIncludeSpread),
48 recLookback_(recLookback), recFixingDays_(recFixingDays), recRateCutoff_(recRateCutoff),
49 recIsAveraged_(recIsAveraged), telescopicValueDates_(telescopicValueDates) {
57 if (
auto on = QuantLib::ext::dynamic_pointer_cast<QuantLib::OvernightIndex>(
payIndex_)) {
93 QuantLib::ext::shared_ptr<CashFlow> initialPayCF(
new SimpleCashFlow(-
payNominal_, initialPayDate));
94 legs_[0].insert(legs_[0].begin(), initialPayCF);
97 QuantLib::ext::shared_ptr<CashFlow> finalPayCF(
new SimpleCashFlow(
payNominal_, finalPayDate));
98 legs_[0].push_back(finalPayCF);
101 if (
auto on = QuantLib::ext::dynamic_pointer_cast<QuantLib::OvernightIndex>(
recIndex_)) {
137 QuantLib::ext::shared_ptr<CashFlow> initialRecCF(
new SimpleCashFlow(-
recNominal_, initialRecDate));
138 legs_[1].insert(legs_[1].begin(), initialRecCF);
141 QuantLib::ext::shared_ptr<CashFlow> finalRecCF(
new SimpleCashFlow(
recNominal_, finalRecDate));
142 legs_[1].push_back(finalRecCF);
145 for (Size legNo = 0; legNo < 2; legNo++) {
147 for (it = legs_[legNo].begin(); it != legs_[legNo].end(); ++it) {
185 static Spread basisPoint = 1.0e-4;
187 if (legBPS_[0] != Null<Real>())
191 if (legBPS_[1] != Null<Real>())
204 QL_REQUIRE(
paySpread != Null<Spread>(),
"Pay spread cannot be null");
205 QL_REQUIRE(
recSpread != Null<Spread>(),
"Rec spread cannot be null");
coupon paying the weighted average of the daily overnight rate
helper class building a sequence of overnight coupons
AverageONLeg & withGearing(Real gearing)
AverageONLeg & withSpread(Spread spread)
AverageONLeg & withPaymentLag(Natural lag)
AverageONLeg & withNotional(Real notional)
AverageONLeg & withLookback(const Period &lookback)
AverageONLeg & withRateCutoff(Natural rateCutoff)
AverageONLeg & withTelescopicValueDates(bool telescopicValueDates)
AverageONLeg & withFixingDays(const Size fixingDays)
void validate() const override
boost::optional< QuantLib::Period > payLookback_
QuantLib::ext::shared_ptr< IborIndex > payIndex_
bool telescopicValueDates_
QuantLib::ext::shared_ptr< IborIndex > recIndex_
boost::optional< bool > payIsAveraged_
Spread fairRecSpread() const
boost::optional< Size > recRateCutoff_
boost::optional< bool > payIncludeSpread_
boost::optional< bool > recIsAveraged_
boost::optional< QuantLib::Size > payFixingDays_
boost::optional< QuantLib::Size > recFixingDays_
void setupArguments(PricingEngine::arguments *args) const override
boost::optional< Size > payRateCutoff_
void setupExpired() const override
void fetchResults(const PricingEngine::results *) const override
boost::optional< QuantLib::Period > recLookback_
CrossCcyBasisSwap(Real payNominal, const Currency &payCurrency, const Schedule &paySchedule, const QuantLib::ext::shared_ptr< IborIndex > &payIndex, Spread paySpread, Real payGearing, Real recNominal, const Currency &recCurrency, const Schedule &recSchedule, const QuantLib::ext::shared_ptr< IborIndex > &recIndex, Spread recSpread, Real recGearing, Size payPaymentLag=0, Size recPaymentLag=0, boost::optional< bool > payIncludeSpread=boost::none, boost::optional< Period > payLookback=boost::none, boost::optional< Size > payFixingDays=boost::none, boost::optional< Size > payRateCutoff=boost::none, boost::optional< bool > payIsAveraged=boost::none, boost::optional< bool > recIncludeSpread=boost::none, boost::optional< Period > recLookback=boost::none, boost::optional< Size > recFixingDays=boost::none, boost::optional< Size > recRateCutoff=boost::none, boost::optional< bool > recIsAveraged=boost::none, const bool telescopicValueDates=false)
Spread fairPaySpread() const
boost::optional< bool > recIncludeSpread_
void validate() const override
void setupArguments(PricingEngine::arguments *args) const override
void setupExpired() const override
void fetchResults(const PricingEngine::results *) const override
std::vector< Currency > currencies_
helper class building a sequence of overnight coupons
OvernightLeg & withLookback(const Period &lookback)
OvernightLeg & withGearings(Real gearing)
OvernightLeg & withTelescopicValueDates(bool telescopicValueDates)
OvernightLeg & withFixingDays(const Natural fixingDays)
OvernightLeg & withNotionals(Real notional)
OvernightLeg & withRateCutoff(const Natural rateCutoff)
OvernightLeg & withSpreads(Spread spread)
OvernightLeg & includeSpread(bool includeSpread)
OvernightLeg & withPaymentLag(Natural lag)
Cross currency basis swap instrument.
coupon paying the compounded daily overnight rate, copy of QL class, added includeSpread flag