34 std::vector<Real> fixedNominals,
38 std::vector<Real> floatingNominals,
40 ext::shared_ptr<IborIndex> iborIndex,
43 ext::optional<BusinessDayConvention> paymentConvention,
46 :
Swap(2), type_(type), fixedNominals_(
std::move(fixedNominals)), fixedSchedule_(
std::move(fixedSchedule)),
47 fixedRate_(fixedRate), fixedDayCount_(
std::move(fixedDayCount)),
48 floatingNominals_(
std::move(floatingNominals)), floatingSchedule_(
std::move(floatingSchedule)),
49 iborIndex_(
std::move(iborIndex)), spread_(spread), floatingDayCount_(
std::move(floatingDayCount)) {
82 QL_FAIL(
"Unknown vanilla-swap type");
123 Size n = fixedCoupons.size();
128 for (
Size i=0; i<
n; ++i) {
129 auto coupon = ext::dynamic_pointer_cast<FixedRateCoupon>(fixedCoupons[i]);
184 static const Spread basisPoint = 1.0e-4;
212 "number of fixed nominals different from "
213 "number of fixed payment dates");
215 "number of fixed start dates different from "
216 "number of fixed payment dates");
218 "number of fixed payment dates different from "
219 "number of fixed coupon amounts");
221 "number of floating nominals different from "
222 "number of floating payment dates");
224 "number of floating start dates different from "
225 "number of floating payment dates");
227 "number of floating fixing dates different from "
228 "number of floating payment dates");
230 "number of floating accrual Times different from "
231 "number of floating payment dates");
233 "number of floating spreads different from "
234 "number of floating payment dates");
236 "number of floating payment dates different from "
237 "number of floating coupon amounts");
Cash-flow analysis functions.
Cash flow vector builders.
bool empty() const
Returns whether or not the calendar is initialized.
helper class building a sequence of fixed rate coupons
FixedRateLeg & withNotionals(Real)
FixedRateLeg & withPaymentLag(Integer lag)
FixedRateLeg & withPaymentCalendar(const Calendar &)
FixedRateLeg & withPaymentAdjustment(BusinessDayConvention)
FixedRateLeg & withCouponRates(Rate, const DayCounter &paymentDayCounter, Compounding comp=Simple, Frequency freq=Annual)
Arguments for simple swap calculation
std::vector< Date > floatingResetDates
std::vector< Real > floatingNominals
std::vector< Spread > floatingSpreads
std::vector< Real > fixedNominals
std::vector< Date > floatingFixingDates
std::vector< Date > fixedPayDates
std::vector< Date > fixedResetDates
void validate() const override
std::vector< Real > floatingCoupons
std::vector< Time > floatingAccrualTimes
std::vector< Real > fixedCoupons
std::vector< Date > floatingPayDates
Results from simple swap calculation
std::vector< Real > floatingNominals_
Schedule floatingSchedule_
BusinessDayConvention paymentConvention() const
DayCounter fixedDayCount_
virtual void setupFloatingArguments(arguments *args) const =0
Spread fairSpread() const
Real floatingLegBPS() const
std::vector< Real > fixedNominals_
ext::shared_ptr< IborIndex > iborIndex_
void setupArguments(PricingEngine::arguments *args) const override
BusinessDayConvention paymentConvention_
const Leg & fixedLeg() const
void setupExpired() const override
Real floatingLegNPV() const
void fetchResults(const PricingEngine::results *) const override
FixedVsFloatingSwap(Type type, std::vector< Real > fixedNominals, Schedule fixedSchedule, Rate fixedRate, DayCounter fixedDayCount, std::vector< Real > floatingNominals, Schedule floatingSchedule, ext::shared_ptr< IborIndex > iborIndex, Spread spread, DayCounter floatingDayCount, ext::optional< BusinessDayConvention > paymentConvention=ext::nullopt, Integer paymentLag=0, const Calendar &paymentCalendar=Calendar())
void calculate() const override
template class providing a null value for a given type.
const Calendar & calendar() const
BusinessDayConvention businessDayConvention() const
void validate() const override
void setupArguments(PricingEngine::arguments *) const override
std::vector< Real > legNPV_
std::vector< Real > legBPS_
void setupExpired() const override
void fetchResults(const PricingEngine::results *) const override
std::vector< Real > payer_
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
#define QL_FAIL(message)
throw an error (possibly with file and line information)
Coupon paying a fixed annual rate.
Fixed-rate vs floating-rate swap.
QL_INTEGER Integer
integer number
Real Spread
spreads on interest rates
std::size_t Size
size of a container
base class for Inter-Bank-Offered-Rate indexes
std::vector< ext::shared_ptr< CashFlow > > Leg
Sequence of cash-flows.
ext::shared_ptr< YieldTermStructure > r
Interest-rate term structure.