31 const ext::shared_ptr<OvernightIndex>& overnightIndex,
33 const Period& forwardStart)
34 : swapTenor_(swapTenor), overnightIndex_(overnightIndex), fixedRate_(fixedRate),
35 forwardStart_(forwardStart),
37 calendar_(overnightIndex->fixingCalendar()),
39 fixedDayCount_(overnightIndex->dayCounter()) {}
42 ext::shared_ptr<ArithmeticAverageOIS> ois = *
this;
46 MakeArithmeticAverageOIS::operator ext::shared_ptr<ArithmeticAverageOIS>()
const {
49 if (effectiveDate_ !=
Date())
50 startDate = effectiveDate_;
55 refDate = calendar_.adjust(refDate);
57 settlementDays_*
Days);
58 startDate = spotDate+forwardStart_;
59 if (forwardStart_.length()<0)
60 startDate = calendar_.adjust(startDate,
Preceding);
62 startDate = calendar_.adjust(startDate,
Following);
67 isDefaultEOM_ ? calendar_.
isEndOfMonth(startDate) : endOfMonth_;
69 Date endDate = terminationDate_;
70 if (endDate ==
Date()) {
72 endDate = calendar_.
advance(startDate,
77 endDate = startDate + swapTenor_;
80 Schedule fixedLegSchedule(startDate, endDate,
81 Period(fixedLegPaymentFrequency_),
88 Schedule overnightLegSchedule(startDate, endDate,
89 Period(overnightLegPaymentFrequency_),
96 Rate usedFixedRate = fixedRate_;
103 overnightLegSchedule,
105 mrs_,
vol_, byApprox_);
108 overnightIndex_->forwardingTermStructure();
110 "null term structure set to this instance of " <<
111 overnightIndex_->name());
112 bool includeSettlementDateFlows =
false;
113 ext::shared_ptr<PricingEngine> engine(
new
122 ext::shared_ptr<ArithmeticAverageOIS> ois(
new
125 usedFixedRate, fixedDayCount_,
127 overnightLegSchedule,
129 mrs_,
vol_, byApprox_));
133 overnightIndex_->forwardingTermStructure();
134 bool includeSettlementDateFlows =
false;
135 ext::shared_ptr<PricingEngine> engine(
new
137 ois->setPricingEngine(engine);
139 ois->setPricingEngine(
engine_);
201 bool includeSettlementDateFlows =
false;
202 engine_ = ext::shared_ptr<PricingEngine>(
new
208 const ext::shared_ptr<PricingEngine>& engine) {
230 Real meanReversionSpeed,
233 mrs_ = meanReversionSpeed;
ext::shared_ptr< SimpleQuote > vol_
ext::shared_ptr< PricingEngine > engine_
static bool isEndOfMonth(const Date &d)
whether a date is the last day of its month
static Date advance(const Date &d, Integer units, TimeUnit)
Discounting engine for swaps.
Shared handle to an observable.
bool empty() const
checks if the contained shared pointer points to anything
void setPricingEngine(const ext::shared_ptr< PricingEngine > &)
set the pricing engine to be used.
MakeArithmeticAverageOIS & withOvernightLegSpread(Spread sp)
MakeArithmeticAverageOIS & withType(Swap::Type type)
MakeArithmeticAverageOIS & withEndOfMonth(bool flag=true)
DayCounter fixedDayCount_
Frequency fixedLegPaymentFrequency_
MakeArithmeticAverageOIS & withFixedLegPaymentFrequency(Frequency f)
QL_DEPRECATED_DISABLE_WARNING MakeArithmeticAverageOIS(const Period &swapTenor, const ext::shared_ptr< OvernightIndex > &overnightIndex, Rate fixedRate=Null< Rate >(), const Period &fwdStart=0 *Days)
MakeArithmeticAverageOIS & withEffectiveDate(const Date &)
MakeArithmeticAverageOIS & withArithmeticAverage(Real meanReversionSpeed=0.03, Real volatility=0.00, bool byApprox=false)
MakeArithmeticAverageOIS & withDiscountingTermStructure(const Handle< YieldTermStructure > &discountingTermStructure)
DateGeneration::Rule rule_
MakeArithmeticAverageOIS & withSettlementDays(Natural settlementDays)
MakeArithmeticAverageOIS & withFixedLegDayCount(const DayCounter &dc)
MakeArithmeticAverageOIS & receiveFixed(bool flag=true)
MakeArithmeticAverageOIS & withOvernightLegPaymentFrequency(Frequency f)
ext::shared_ptr< PricingEngine > engine_
MakeArithmeticAverageOIS & withPricingEngine(const ext::shared_ptr< PricingEngine > &engine)
MakeArithmeticAverageOIS & withNominal(Real n)
MakeArithmeticAverageOIS & withRule(DateGeneration::Rule r)
MakeArithmeticAverageOIS & withTerminationDate(const Date &)
Frequency overnightLegPaymentFrequency_
template class providing a null value for a given type.
DateProxy & evaluationDate()
the date at which pricing is to be performed.
static Settings & instance()
access to the unique instance
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Frequency
Frequency of events.
@ Once
only once, e.g., a zero-coupon
unsigned QL_INTEGER Natural
positive integer
Real Spread
spreads on interest rates
base class for Inter-Bank-Offered-Rate indexes
Helper class to instantiate overnight indexed swaps.
ext::shared_ptr< YieldTermStructure > r
#define QL_DEPRECATED_DISABLE_WARNING
#define QL_DEPRECATED_ENABLE_WARNING