1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2018 Roy Zywina
5 Copyright (C) 2019 Eisuke Tani
6
7 This file is part of QuantLib, a free-software/open-source library
8 for financial quantitative analysts and developers - http://quantlib.org/
9
10 QuantLib is free software: you can redistribute it and/or modify it
11 under the terms of the QuantLib license. You should have received a
12 copy of the license along with this program; if not, please email
13 <quantlib-dev@lists.sf.net>. The license is also available online at
14 <http://quantlib.org/license.shtml>.
15
16 This program is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18 FOR A PARTICULAR PURPOSE. See the license for more details.
19*/
20
21/*! \file overnightindexfuture.hpp
22 \brief Overnight Index Future
23*/
24
25#ifndef quantlib_overnightindexfuture_hpp
26#define quantlib_overnightindexfuture_hpp
27
28#include <ql/indexes/iborindex.hpp>
29#include <ql/instruments/forward.hpp>
30#include <ql/cashflows/rateaveraging.hpp>
31
32namespace QuantLib {
33
34 /*! Future on a compounded overnight index investment.
35
36 Compatible with SOFR futures and Sonia futures available on
37 CME and ICE exchanges.
38 */
39 class OvernightIndexFuture : public Instrument {
40 public:
41 OvernightIndexFuture(
42 ext::shared_ptr<OvernightIndex> overnightIndex,
43 const Date& valueDate,
44 const Date& maturityDate,
45 Handle<Quote> convexityAdjustment = Handle<Quote>(),
46 RateAveraging::Type averagingMethod = RateAveraging::Compound);
47
48 Real convexityAdjustment() const;
49 bool isExpired() const override;
50 const ext::shared_ptr<OvernightIndex>& overnightIndex() const { return overnightIndex_; }
51 Date valueDate() const { return valueDate_; }
52 Date maturityDate() const { return maturityDate_; }
53 private:
54 void performCalculations() const override;
55 Real rate() const;
56 Real averagedRate() const;
57 Real compoundedRate() const;
58 ext::shared_ptr<OvernightIndex> overnightIndex_;
59 Date valueDate_, maturityDate_;
60 Handle<Quote> convexityAdjustment_;
61 RateAveraging::Type averagingMethod_;
62 };
63
64}
65
66#endif
67

source code of quantlib/ql/instruments/overnightindexfuture.hpp