QuantLib: a free/open-source library for quantitative finance
fully annotated source code - version 1.34
Loading...
Searching...
No Matches
callablebondconstantvol.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 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
23#include <utility>
24
25namespace QuantLib {
26
28 Volatility volatility,
29 DayCounter dayCounter)
30 : CallableBondVolatilityStructure(referenceDate),
31 volatility_(ext::shared_ptr<Quote>(new SimpleQuote(volatility))),
32 dayCounter_(std::move(dayCounter)), maxBondTenor_(100 * Years) {}
33
35 Handle<Quote> volatility,
36 DayCounter dayCounter)
37 : CallableBondVolatilityStructure(referenceDate), volatility_(std::move(volatility)),
38 dayCounter_(std::move(dayCounter)), maxBondTenor_(100 * Years) {
40 }
41
43 const Calendar& calendar,
44 Volatility volatility,
45 DayCounter dayCounter)
46 : CallableBondVolatilityStructure(settlementDays, calendar),
47 volatility_(ext::shared_ptr<Quote>(new SimpleQuote(volatility))),
48 dayCounter_(std::move(dayCounter)), maxBondTenor_(100 * Years) {}
49
51 const Calendar& calendar,
52 Handle<Quote> volatility,
53 DayCounter dayCounter)
54 : CallableBondVolatilityStructure(settlementDays, calendar), volatility_(std::move(volatility)),
55 dayCounter_(std::move(dayCounter)), maxBondTenor_(100 * Years) {
57 }
58
60 const Period&,
61 Rate) const {
62 return volatility_->value();
63 }
64
66 Time, Time, Rate) const {
67 return volatility_->value();
68 }
69
70
71 ext::shared_ptr<SmileSection>
73 Time) const {
74 Volatility atmVol = volatility_->value();
75 return ext::shared_ptr<SmileSection>(
76 new FlatSmileSection(optionTime,
77 atmVol,
79 }
80
81}
82
Constant callable-bond volatility.
calendar class
Definition: calendar.hpp:61
Volatility volatilityImpl(Time, Time, Rate) const override
implements the actual volatility calculation in derived classes
ext::shared_ptr< SmileSection > smileSectionImpl(Time optionTime, Time bondLength) const override
return smile section
CallableBondConstantVolatility(const Date &referenceDate, Volatility volatility, DayCounter dayCounter)
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
Flat SmileSection.
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