Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
deposit.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2016 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*! \file qle/instruments/deposit.hpp
20 \brief deposit instrument
21 \ingroup instruments
22*/
23
24#ifndef quantext_deposit_hpp
25#define quantext_deposit_hpp
26
27#include <ql/cashflow.hpp>
28#include <ql/indexes/iborindex.hpp>
29#include <ql/instrument.hpp>
30#include <ql/quote.hpp>
31#include <ql/time/calendar.hpp>
32#include <ql/time/daycounter.hpp>
33
34namespace QuantExt {
35using namespace QuantLib;
36
37//! Deposit Instrument
38
39/*! This class holds the term sheet data for a Deposit Instrument.
40
41 \ingroup instruments
42*/
43class Deposit : public Instrument {
44public:
45 class arguments;
46 class results;
47 class engine;
48
49 Deposit(const Real nominal, const Rate rate, const Period& tenor, const Natural fixingDays,
50 const Calendar& calendar, const BusinessDayConvention convention, const bool endOfMonth,
51 const DayCounter& dayCounter, const Date& tradeDate, const bool isLong = true,
52 const Period forwardStart = 0 * Days);
53
54 //! \name Instrument interface
55 //@{
56 bool isExpired() const override;
57 void setupArguments(PricingEngine::arguments*) const override;
58 void fetchResults(const PricingEngine::results*) const override;
59 //@}
60 //! \name Additional interface
61 //@{
62 Date fixingDate() const { return fixingDate_; }
63 Date startDate() const { return startDate_; }
64 Date maturityDate() const { return maturityDate_; }
65 Real fairRate() const {
66 calculate();
67 QL_REQUIRE(fairRate_ != Null<Real>(), "Deposit::fairRate(): not provided");
68 return fairRate_;
69 }
70 const Leg& leg() const { return leg_; }
71 //@}
72
73private:
74 //! \name Instrument interface
75 //@{
76 void setupExpired() const override;
77 //@}
79 QuantLib::ext::shared_ptr<IborIndex> index_;
80 Leg leg_;
81 // results
82 mutable Real fairRate_;
83};
84
85//! \ingroup instruments
87public:
88 QuantLib::ext::shared_ptr<IborIndex> index;
90 Leg leg;
91 void validate() const override;
92};
93
94//! \ingroup instruments
96public:
98 void reset() override;
99};
100
101//! \ingroup instruments
102class Deposit::engine : public GenericEngine<Deposit::arguments, Deposit::results> {};
103} // namespace QuantExt
104
105#endif
QuantLib::ext::shared_ptr< IborIndex > index
Definition: deposit.hpp:88
void validate() const override
Definition: deposit.cpp:73
void reset() override
Definition: deposit.cpp:78
Deposit Instrument.
Definition: deposit.hpp:43
Real fairRate() const
Definition: deposit.hpp:65
Date fixingDate() const
Definition: deposit.hpp:62
void setupArguments(PricingEngine::arguments *) const override
Definition: deposit.cpp:56
bool isExpired() const override
Definition: deposit.cpp:49
Date startDate() const
Definition: deposit.hpp:63
QuantLib::ext::shared_ptr< IborIndex > index_
Definition: deposit.hpp:79
const Leg & leg() const
Definition: deposit.hpp:70
Date maturityDate() const
Definition: deposit.hpp:64
void setupExpired() const override
Definition: deposit.cpp:51
void fetchResults(const PricingEngine::results *) const override
Definition: deposit.cpp:65