35 ext::shared_ptr<OvernightIndex> overnightIndex,
38 Real meanReversionSpeed,
41 :
Swap(2), type_(type), nominals_(
std::vector<
Real>(1, nominal)),
42 fixedLegPaymentFrequency_(fixedLegSchedule.tenor().frequency()),
43 overnightLegPaymentFrequency_(overnightLegSchedule.tenor().frequency()),
44 fixedRate_(fixedRate), fixedDC_(
std::move(fixedDC)),
45 overnightIndex_(
std::move(overnightIndex)), spread_(spread), byApprox_(byApprox),
46 mrs_(meanReversionSpeed),
vol_(volatility) {
48 initialize(std::move(fixedLegSchedule), std::move(overnightLegSchedule));
52 std::vector<Real> nominals,
56 ext::shared_ptr<OvernightIndex> overnightIndex,
59 Real meanReversionSpeed,
62 :
Swap(2), type_(type), nominals_(
std::move(nominals)),
63 fixedLegPaymentFrequency_(fixedLegSchedule.tenor().frequency()),
64 overnightLegPaymentFrequency_(overnightLegSchedule.tenor().frequency()),
65 fixedRate_(fixedRate), fixedDC_(
std::move(fixedDC)),
66 overnightIndex_(
std::move(overnightIndex)), spread_(spread), byApprox_(byApprox),
67 mrs_(meanReversionSpeed),
vol_(volatility) {
69 initialize(std::move(fixedLegSchedule), std::move(overnightLegSchedule));
84 ext::shared_ptr<FloatingRateCouponPricer> arithmeticPricer(
87 for (
auto& i :
legs_[1]) {
88 ext::shared_ptr<OvernightIndexedCoupon> c =
89 ext::dynamic_pointer_cast<OvernightIndexedCoupon>(i);
90 c->setPricer(arithmeticPricer);
93 for (
Size j=0; j<2; ++j) {
94 for (
auto& i :
legs_[j])
108 QL_FAIL(
"Unknown overnight-swap type");
113 static Spread basisPoint = 1.0e-4;
119 static Spread basisPoint = 1.0e-4;
Overnight index swap paying arithmetic average of overnight vs. fixed.
ext::shared_ptr< SimpleQuote > vol_
ext::shared_ptr< OvernightIndex > overnightIndex_
void initialize(Schedule fixedLegSchedule, Schedule overnightLegSchedule)
Spread fairSpread() const
ArithmeticAverageOIS(Type type, Real nominal, Schedule fixedLegSchedule, Rate fixedRate, DayCounter fixedDC, ext::shared_ptr< OvernightIndex > overnightIndex, Schedule overnightLegSchedule, Spread spread=0.0, Real meanReversionSpeed=0.03, Real volatility=0.00, bool byApprox=false)
Real overnightLegBPS() const
Real overnightLegNPV() const
std::vector< Real > nominals_
helper class building a sequence of fixed rate coupons
FixedRateLeg & withNotionals(Real)
FixedRateLeg & withCouponRates(Rate, const DayCounter &paymentDayCounter, Compounding comp=Simple, Frequency freq=Annual)
void calculate() const override
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
helper class building a sequence of overnight coupons
OvernightLeg & withNotionals(Real notional)
OvernightLeg & withSpreads(Spread spread)
std::vector< Real > legNPV_
std::vector< Real > legBPS_
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.
Real Spread
spreads on interest rates
std::size_t Size
size of a container
coupon paying the compounded daily overnight rate
contains the pricer for an OvernightIndexedCoupon
#define QL_DEPRECATED_DISABLE_WARNING
#define QL_DEPRECATED_ENABLE_WARNING