38 ext::shared_ptr<OvernightIndex> index =
39 ext::dynamic_pointer_cast<OvernightIndex>(
coupon_->
index());
47 Real accumulatedRate = 0.0;
51 while (i <
n && fixingDates[i] < today) {
54 index->name())[fixingDates[i]];
56 "Missing " << index->name() <<
57 " fixing for " << fixingDates[i]);
58 accumulatedRate += pastFixing*dt[i];
63 if (i <
n && fixingDates[i] == today) {
67 index->name())[fixingDates[i]];
69 accumulatedRate += pastFixing*dt[i];
86 index->forwardingTermStructure();
88 "null term structure set to this instance of " <<
95 accumulatedRate += log(startDiscount / endDiscount) -
96 convAdj1(curve->timeFromReference(dates[i]),
97 curve->timeFromReference(dates[
n])) -
98 convAdj2(curve->timeFromReference(dates[i]),
99 curve->timeFromReference(dates[
n]));
104 index->forwardingTermStructure();
106 "null term structure set to this instance of " <<
110 Time te = curve->timeFromReference(dates[
n]);
113 Rate forecastFixing = index->fixing(fixingDates[i]);
114 Time ti1 = curve->timeFromReference(dates[i]);
115 Time ti2 = curve->timeFromReference(dates[i + 1]);
118 Real convAdj = exp( 0.5*pow(
vol_, 2.0) / pow(
mrs_, 3.0)*
119 (exp(2 *
mrs_*ti1) - 1)*
121 (exp(-
mrs_*ti2) - exp(-
mrs_*ti1)) );
122 accumulatedRate += convAdj*(1 + forecastFixing*dt[i]) - 1;
134 (1.0 - exp(-2.0*
mrs_*ts)) *
135 pow((1.0 - exp(-
mrs_*(te - ts))), 2.0);
140 return vol_ *
vol_ / (2.0 * pow(
mrs_, 2.0)) * ((te - ts) -
141 pow(1.0 - exp(-
mrs_*(te - ts)), 2.0) /
mrs_ -
142 (1.0 - exp(-2.0*
mrs_*(te - ts))) / (2.0 *
mrs_));
pricer for arithmetically-averaged overnight-indexed coupons
void initialize(const FloatingRateCoupon &coupon) override
Real convAdj2(Time ts, Time te) const
const OvernightIndexedCoupon * coupon_
Rate swapletRate() const override
Real convAdj1(Time ts, Time te) const
Time accrualPeriod() const
accrual period as fraction of year
base floating-rate coupon class
Real gearing() const
index gearing, i.e. multiplicative coefficient for the index
const ext::shared_ptr< InterestRateIndex > & index() const
floating index
Spread spread() const
spread paid over the fixing of the underlying index
Shared handle to an observable.
bool empty() const
checks if the contained shared pointer points to anything
const TimeSeries< Real > & getHistory(const std::string &name) const
returns the (possibly empty) history of the index fixings
template class providing a null value for a given type.
const std::vector< Date > & valueDates() const
value dates for the rates to be compounded
const std::vector< Time > & dt() const
accrual (compounding) periods
const std::vector< Date > & fixingDates() const
fixing dates for the rates to be compounded
DateProxy & evaluationDate()
the date at which pricing is to be performed.
static Settings & instance()
access to the unique instance
#define QL_ENSURE(condition, message)
throw an error if the given post-condition is not verified
#define QL_REQUIRE(condition, message)
throw an error if the given pre-condition is not verified
Real Time
continuous quantity with 1-year units
Real DiscountFactor
discount factor between dates
std::size_t Size
size of a container