29 const Date& valueDate,
30 const Date& maturityDate,
33 : overnightIndex_(
std::move(overnightIndex)), valueDate_(valueDate),
34 maturityDate_(maturityDate), convexityAdjustment_(
std::move(convexityAdjustment)),
35 averagingMethod_(averagingMethod) {
55 if (fixingDate < today) {
56 fwd = history[fixingDate];
58 "missing rate on " << fixingDate <<
" for index " <<
overnightIndex_->name());
59 }
else if (fixingDate == today) {
60 fwd = history[fixingDate];
62 fwd = forwardCurve->forwardRate(fixingDate, d2, dayCounter,
Simple).rate();
64 fwd = forwardCurve->forwardRate(fixingDate, d2, dayCounter,
Simple).rate();
86 today = calendar.
adjust(today);
87 forwardDiscountStart = today;
95 Real r = history[fixingDate];
97 "missing rate on " << fixingDate <<
" for index " <<
overnightIndex_->name());
103 fixingDate = d1 = d2;
107 Real r = history[today];
111 forwardDiscountStart = tomorrow;
117 forwardCurve->discount(
maturityDate_) / forwardCurve->discount(forwardDiscountStart);
118 prod /= forwardDiscount;
144 NPV_ = 100.0 * (1.0 - R);
Date adjust(const Date &, BusinessDayConvention convention=Following) const
Date advance(const Date &, Integer n, TimeUnit unit, BusinessDayConvention convention=Following, bool endOfMonth=false) const
Time yearFraction(const Date &, const Date &, const Date &refPeriodStart=Date(), const Date &refPeriodEnd=Date()) const
Returns the period between two dates as a fraction of year.
virtual bool hasOccurred(const Date &refDate=Date(), ext::optional< bool > includeRefDate=ext::nullopt) const
returns true if an event has already occurred before a date
Shared handle to an observable.
template class providing a null value for a given type.
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
ext::shared_ptr< OvernightIndex > overnightIndex_
void performCalculations() const override
Handle< Quote > convexityAdjustment_
bool isExpired() const override
returns whether the instrument might have value greater than zero.
Real compoundedRate() const
RateAveraging::Type averagingMethod_
Real averagedRate() const
OvernightIndexFuture(ext::shared_ptr< OvernightIndex > overnightIndex, const Date &valueDate, const Date &maturityDate, Handle< Quote > convexityAdjustment=Handle< Quote >(), RateAveraging::Type averagingMethod=RateAveraging::Compound)
Real convexityAdjustment() const
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
#define QL_FAIL(message)
throw an error (possibly with file and line information)
Base class for events associated with a given date.
Real DiscountFactor
discount factor between dates
QL_INTEGER Integer
integer number
global repository for past index fixings
Array prod(const SparseMatrix &A, const Array &x)
ext::shared_ptr< YieldTermStructure > r