QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
constantcapfloortermvol.cpp
Go to the documentation of this file.
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2008 Ferdinando Ametrano
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
22#include <utility>
23
24namespace QuantLib {
25
26 // floating reference date, floating market data
28 const Calendar& cal,
30 Handle<Quote> vol,
31 const DayCounter& dc)
32 : CapFloorTermVolatilityStructure(settlementDays, cal, bdc, dc), volatility_(std::move(vol)) {
34 }
35
36 // fixed reference date, floating market data
38 const Calendar& cal,
40 Handle<Quote> vol,
41 const DayCounter& dc)
42 : CapFloorTermVolatilityStructure(referenceDate, cal, bdc, dc), volatility_(std::move(vol)) {
44 }
45
46 // floating reference date, fixed market data
48 Natural settlementDays,
49 const Calendar& cal,
51 Volatility vol,
52 const DayCounter& dc)
53 : CapFloorTermVolatilityStructure(settlementDays, cal, bdc, dc),
54 volatility_(ext::shared_ptr<Quote>(new SimpleQuote(vol))) {}
55
56 // fixed reference date, fixed market data
58 const Date& referenceDate,
59 const Calendar& cal,
61 Volatility vol,
62 const DayCounter& dc)
63 : CapFloorTermVolatilityStructure(referenceDate, cal, bdc, dc),
64 volatility_(ext::shared_ptr<Quote>(new SimpleQuote(vol))) {}
65
67 Rate) const {
68 return volatility_->value();
69 }
70
71}
calendar class
Definition: calendar.hpp:61
ConstantCapFloorTermVolatility(Natural settlementDays, const Calendar &cal, BusinessDayConvention bdc, Handle< Quote > volatility, const DayCounter &dc)
floating reference date, floating market data
Volatility volatilityImpl(Time, Rate) const override
implements the actual volatility calculation in derived classes
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
Shared handle to an observable.
Definition: handle.hpp:41
std::pair< iterator, bool > registerWith(const ext::shared_ptr< Observable > &)
Definition: observable.hpp:228
purely virtual base class for market observables
Definition: quote.hpp:37
market element returning a stored value
Definition: simplequote.hpp:33
Constant cap/floor term volatility.
BusinessDayConvention
Business Day conventions.
Real Time
continuous quantity with 1-year units
Definition: types.hpp:62
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Real Volatility
volatility
Definition: types.hpp:78
Real Rate
interest rates
Definition: types.hpp:70
Definition: any.hpp:35
STL namespace.
simple quote class