29 const ext::shared_ptr<OvernightIndex>& overnightIndex,
31 const Period& forwardStart)
32 : swapTenor_(swapTenor), overnightIndex_(overnightIndex), fixedRate_(fixedRate),
33 forwardStart_(forwardStart),
35 calendar_(overnightIndex->fixingCalendar()),
37 fixedDayCount_(overnightIndex->dayCounter()) {}
40 ext::shared_ptr<ArithmeticAverageOIS> ois = *
this;
44 MakeArithmeticAverageOIS::operator ext::shared_ptr<ArithmeticAverageOIS>()
const {
47 if (effectiveDate_ !=
Date())
48 startDate = effectiveDate_;
53 refDate = calendar_.adjust(refDate);
55 settlementDays_*
Days);
56 startDate = spotDate+forwardStart_;
57 if (forwardStart_.length()<0)
58 startDate = calendar_.adjust(startDate,
Preceding);
60 startDate = calendar_.adjust(startDate,
Following);
65 isDefaultEOM_ ? calendar_.
isEndOfMonth(startDate) : endOfMonth_;
67 Date endDate = terminationDate_;
68 if (endDate ==
Date()) {
70 endDate = calendar_.
advance(startDate,
75 endDate = startDate + swapTenor_;
78 Schedule fixedLegSchedule(startDate, endDate,
79 Period(fixedLegPaymentFrequency_),
86 Schedule overnightLegSchedule(startDate, endDate,
87 Period(overnightLegPaymentFrequency_),
94 Rate usedFixedRate = fixedRate_;
101 overnightLegSchedule,
103 mrs_,
vol_, byApprox_);
106 overnightIndex_->forwardingTermStructure();
108 "null term structure set to this instance of " <<
109 overnightIndex_->name());
110 bool includeSettlementDateFlows =
false;
111 ext::shared_ptr<PricingEngine> engine(
new
120 ext::shared_ptr<ArithmeticAverageOIS> ois(
new
123 usedFixedRate, fixedDayCount_,
125 overnightLegSchedule,
127 mrs_,
vol_, byApprox_));
131 overnightIndex_->forwardingTermStructure();
132 bool includeSettlementDateFlows =
false;
133 ext::shared_ptr<PricingEngine> engine(
new
135 ois->setPricingEngine(engine);
137 ois->setPricingEngine(
engine_);
199 bool includeSettlementDateFlows =
false;
200 engine_ = ext::shared_ptr<PricingEngine>(
new
206 const ext::shared_ptr<PricingEngine>& engine) {
228 Real meanReversionSpeed,
231 mrs_ = meanReversionSpeed;
ext::shared_ptr< SimpleQuote > vol_
ext::shared_ptr< PricingEngine > engine_
Arithemtic Average OIS: fix vs arithmetic average of overnight rate.
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)
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(const Period &swapTenor, const ext::shared_ptr< OvernightIndex > &overnightIndex, Rate fixedRate=Null< Rate >(), const Period &fwdStart=0 *Days)
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