/src/quantlib/ql/experimental/callablebonds/callablebondconstantvol.hpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 | | |
3 | | /* |
4 | | Copyright (C) 2008 Allen Kuo |
5 | | |
6 | | This file is part of QuantLib, a free-software/open-source library |
7 | | for financial quantitative analysts and developers - http://quantlib.org/ |
8 | | |
9 | | QuantLib is free software: you can redistribute it and/or modify it |
10 | | under the terms of the QuantLib license. You should have received a |
11 | | copy of the license along with this program; if not, please email |
12 | | <quantlib-dev@lists.sf.net>. The license is also available online at |
13 | | <http://quantlib.org/license.shtml>. |
14 | | |
15 | | This program is distributed in the hope that it will be useful, but WITHOUT |
16 | | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
17 | | FOR A PARTICULAR PURPOSE. See the license for more details. |
18 | | */ |
19 | | |
20 | | /*! \file callablebondconstantvol.hpp |
21 | | \brief Constant callable-bond volatility |
22 | | */ |
23 | | |
24 | | #ifndef quantlib_callable_bond_constant_volatility_hpp |
25 | | #define quantlib_callable_bond_constant_volatility_hpp |
26 | | |
27 | | #include <ql/experimental/callablebonds/callablebondvolstructure.hpp> |
28 | | #include <ql/time/period.hpp> |
29 | | |
30 | | namespace QuantLib { |
31 | | |
32 | | class Quote; |
33 | | |
34 | | //! Constant callable-bond volatility, no time-strike dependence |
35 | | class CallableBondConstantVolatility |
36 | | : public CallableBondVolatilityStructure { |
37 | | public: |
38 | | CallableBondConstantVolatility(const Date& referenceDate, |
39 | | Volatility volatility, |
40 | | DayCounter dayCounter); |
41 | | CallableBondConstantVolatility(const Date& referenceDate, |
42 | | Handle<Quote> volatility, |
43 | | DayCounter dayCounter); |
44 | | CallableBondConstantVolatility(Natural settlementDays, |
45 | | const Calendar&, |
46 | | Volatility volatility, |
47 | | DayCounter dayCounter); |
48 | | CallableBondConstantVolatility(Natural settlementDays, |
49 | | const Calendar&, |
50 | | Handle<Quote> volatility, |
51 | | DayCounter dayCounter); |
52 | | //! \name TermStructure interface |
53 | | //@{ |
54 | 0 | DayCounter dayCounter() const override { return dayCounter_; } |
55 | 0 | Date maxDate() const override { return Date::maxDate(); } |
56 | | //@} |
57 | | //! \name CallableBondConstantVolatility interface |
58 | | //@{ |
59 | | const Period& maxBondTenor() const override; |
60 | | Time maxBondLength() const override; |
61 | | Real minStrike() const override; |
62 | | Real maxStrike() const override; |
63 | | |
64 | | protected: |
65 | | Volatility volatilityImpl(Time, Time, Rate) const override; |
66 | | ext::shared_ptr<SmileSection> smileSectionImpl(Time optionTime, |
67 | | Time bondLength) const override; |
68 | | Volatility volatilityImpl(const Date&, const Period&, Rate) const override; |
69 | | //@} |
70 | | private: |
71 | | Handle<Quote> volatility_; |
72 | | DayCounter dayCounter_; |
73 | | Period maxBondTenor_; |
74 | | }; |
75 | | |
76 | | |
77 | | // inline definitions |
78 | | |
79 | 0 | inline const Period& CallableBondConstantVolatility::maxBondTenor() const { |
80 | 0 | return maxBondTenor_; |
81 | 0 | } |
82 | | |
83 | 0 | inline Time CallableBondConstantVolatility::maxBondLength() const { |
84 | 0 | return QL_MAX_REAL; |
85 | 0 | } |
86 | | |
87 | 0 | inline Real CallableBondConstantVolatility::minStrike() const { |
88 | 0 | return QL_MIN_REAL; |
89 | 0 | } |
90 | | |
91 | 0 | inline Real CallableBondConstantVolatility::maxStrike() const { |
92 | 0 | return QL_MAX_REAL; |
93 | 0 | } |
94 | | |
95 | | } |
96 | | |
97 | | #endif |
98 | | |