33 ext::shared_ptr<OvernightIndex> overnightIndex,
36 Real meanReversionSpeed,
39 :
Swap(2), type_(type), nominals_(
std::vector<
Real>(1, nominal)),
40 fixedLegPaymentFrequency_(fixedLegSchedule.tenor().frequency()),
41 overnightLegPaymentFrequency_(overnightLegSchedule.tenor().frequency()),
42 fixedRate_(fixedRate), fixedDC_(
std::move(fixedDC)),
43 overnightIndex_(
std::move(overnightIndex)), spread_(spread), byApprox_(byApprox),
44 mrs_(meanReversionSpeed),
vol_(volatility) {
46 initialize(std::move(fixedLegSchedule), std::move(overnightLegSchedule));
50 std::vector<Real> nominals,
54 ext::shared_ptr<OvernightIndex> overnightIndex,
57 Real meanReversionSpeed,
60 :
Swap(2), type_(type), nominals_(
std::move(nominals)),
61 fixedLegPaymentFrequency_(fixedLegSchedule.tenor().frequency()),
62 overnightLegPaymentFrequency_(overnightLegSchedule.tenor().frequency()),
63 fixedRate_(fixedRate), fixedDC_(
std::move(fixedDC)),
64 overnightIndex_(
std::move(overnightIndex)), spread_(spread), byApprox_(byApprox),
65 mrs_(meanReversionSpeed),
vol_(volatility) {
67 initialize(std::move(fixedLegSchedule), std::move(overnightLegSchedule));
82 ext::shared_ptr<FloatingRateCouponPricer> arithmeticPricer(
85 for (
auto& i :
legs_[1]) {
86 ext::shared_ptr<OvernightIndexedCoupon> c =
87 ext::dynamic_pointer_cast<OvernightIndexedCoupon>(i);
88 c->setPricer(arithmeticPricer);
91 for (
Size j=0; j<2; ++j) {
92 for (
auto& i :
legs_[j])
106 QL_FAIL(
"Unknown overnight-swap type");
111 static Spread basisPoint = 1.0e-4;
117 static Spread basisPoint = 1.0e-4;
Overnight index swap paying arithmetic average of overnight vs. fixed.
pricer for arithmetically-averaged overnight-indexed coupons
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