QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.32
Loading...
Searching...
No Matches
interestratevolsurface.cpp
1/* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
3/*
4 Copyright (C) 2007 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
20#include <ql/experimental/volatility/interestratevolsurface.hpp>
21#include <utility>
22
23namespace QuantLib {
24
25 InterestRateVolSurface::InterestRateVolSurface(ext::shared_ptr<InterestRateIndex> index,
27 const DayCounter& dc)
28 : BlackVolSurface(bdc, dc), index_(std::move(index)) {}
29
30 InterestRateVolSurface::InterestRateVolSurface(ext::shared_ptr<InterestRateIndex> index,
31 const Date& refDate,
32 const Calendar& cal,
34 const DayCounter& dc)
35 : BlackVolSurface(refDate, cal, bdc, dc), index_(std::move(index)) {}
36
37 InterestRateVolSurface::InterestRateVolSurface(ext::shared_ptr<InterestRateIndex> index,
38 Natural settlDays,
39 const Calendar& cal,
41 const DayCounter& dc)
42 : BlackVolSurface(settlDays, cal, bdc, dc), index_(std::move(index)) {}
43
45 ext::shared_ptr<InterestRateIndex> i = index();
46 // optionlet style
47 Date refDate = i->fixingCalendar().adjust(referenceDate(), Following);
48 Date settlement = i->valueDate(refDate);
49 Date start = settlement+p;
50 return i->fixingDate(start);
51 }
52
54 auto* v1 = dynamic_cast<Visitor<InterestRateVolSurface>*>(&v);
55 if (v1 != nullptr)
56 v1->visit(*this);
57 else
59 }
60
61}
degenerate base class for the Acyclic Visitor pattern
Definition: visitor.hpp:33
Black volatility (smile) surface.
void accept(AcyclicVisitor &) override
calendar class
Definition: calendar.hpp:61
Concrete date class.
Definition: date.hpp:125
day counter class
Definition: daycounter.hpp:44
InterestRateVolSurface(ext::shared_ptr< InterestRateIndex >, BusinessDayConvention bdc=Following, const DayCounter &dc=DayCounter())
void accept(AcyclicVisitor &) override
const ext::shared_ptr< InterestRateIndex > & index() const
Date optionDateFromTenor(const Period &) const
period/date conversion
virtual const Date & referenceDate() const
the date at which discount = 1.0 and/or variance = 0.0
Visitor for a specific class
Definition: visitor.hpp:40
virtual void visit(T &)=0
BusinessDayConvention
Business Day conventions.
unsigned QL_INTEGER Natural
positive integer
Definition: types.hpp:43
Definition: any.hpp:35
STL namespace.