smilesection.hpp
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) 2006 Francois du Vignaud
5  Copyright (C) 2016 Stefano Fondi
6 
7  This file is part of QuantLib, a free-software/open-source library
8  for financial quantitative analysts and developers - http://quantlib.org/
9 
10  QuantLib is free software: you can redistribute it and/or modify it
11  under the terms of the QuantLib license. You should have received a
12  copy of the license along with this program; if not, please email
13  <quantlib-dev@lists.sf.net>. The license is also available online at
14  <http://quantlib.org/license.shtml>.
15 
16  This program is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
18  FOR A PARTICULAR PURPOSE. See the license for more details.
19 */
20 
21 #ifndef qla_smilesection_hpp
22 #define qla_smilesection_hpp
23 
24 #include <oh/libraryobject.hpp>
25 #include <ql/types.hpp>
26 #include <ql/termstructures/volatility/volatilitytype.hpp>
27 
28 
29 namespace QuantLib {
30  class Date;
31  class SmileSection;
32  class DayCounter;
33  class EndCriteria;
34  class Quote;
35  class OptimizationMethod;
36  class SabrVolSurface;
37 
38  template <class T>
39  class Handle;
40 }
41 
42 namespace QuantLibAddin {
43 
44  OH_LIB_CLASS(SmileSection, QuantLib::SmileSection);
45 
46  class FlatSmileSection : public SmileSection {
47  public:
48  FlatSmileSection(const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
49  const QuantLib::Date& optionDate,
50  QuantLib::Volatility v,
51  const QuantLib::DayCounter& dc,
52  const QuantLib::Date& refDate,
53  QuantLib::Real atmValue,
54  QuantLib::VolatilityType type,
55  QuantLib::Real shift,
56  bool permanent);
57  };
58 
59  class InterpolatedSmileSection : public SmileSection {
60  public:
62  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
63  const QuantLib::Date& optionDate,
64  const std::vector<QuantLib::Rate>& strikes,
65  const std::vector<QuantLib::Handle<QuantLib::Quote> >& stdDevs,
66  const QuantLib::Handle<QuantLib::Quote>& atmLevel,
67  const QuantLib::DayCounter& dc,
68  QuantLib::VolatilityType type,
69  QuantLib::Real shift,
70  bool permanent);
71  };
72 
73  class SabrSmileSection: public SmileSection{
74  public:
76  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
77  const QuantLib::Time expiry,
78  const std::vector<QuantLib::Rate>& strikes,
79  const std::vector<QuantLib::Handle<QuantLib::Quote> >& stdDevs,
80  const QuantLib::Handle<QuantLib::Quote>& forward,
81  QuantLib::Real alpha,
82  QuantLib::Real beta,
83  QuantLib::Real nu,
84  QuantLib::Real rho,
85  bool isAlphaFixed,
86  bool isBetaFixed,
87  bool isNuFixed,
88  bool isRhoFixed,
89  bool vegaWeighted = false,
90  const boost::shared_ptr<QuantLib::EndCriteria> endCriteria
91  = boost::shared_ptr<QuantLib::EndCriteria>(),
92  const boost::shared_ptr<QuantLib::OptimizationMethod> method
93  = boost::shared_ptr<QuantLib::OptimizationMethod>(),
94  bool permanent = false);
95 
96  };
97 
98  class SabrInterpolatedSmileSection : public SmileSection {
99  public:
101  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
102  const QuantLib::Date& optionDate,
103  const QuantLib::Rate& forward,
104  const std::vector<QuantLib::Rate>& strikes,
105  bool hasFloatingStrikes,
106  const QuantLib::Volatility& atmVolatility,
107  const std::vector<QuantLib::Volatility>& vols,
108  QuantLib::Real alpha,
109  QuantLib::Real beta,
110  QuantLib::Real nu,
111  QuantLib::Real rho,
112  bool isAlphaFixed,
113  bool isBetaFixed,
114  bool isNuFixed,
115  bool isRhoFixed,
116  bool vegaWeighted,
117  const boost::shared_ptr<QuantLib::EndCriteria> endCriteria,
118  const boost::shared_ptr<QuantLib::OptimizationMethod> method,
119  const QuantLib::DayCounter& dc,
120  bool permanent);
121 
123  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
124  const QuantLib::Date& optionDate,
125  const QuantLib::Handle<QuantLib::Quote>& forward,
126  const std::vector<QuantLib::Rate>& strikes,
127  bool hasFloatingStrikes,
128  const QuantLib::Handle<QuantLib::Quote>& atmVolatility,
129  const std::vector<QuantLib::Handle<QuantLib::Quote> >& volHandles,
130  QuantLib::Real alpha,
131  QuantLib::Real beta,
132  QuantLib::Real nu,
133  QuantLib::Real rho,
134  bool isAlphaFixed,
135  bool isBetaFixed,
136  bool isNuFixed,
137  bool isRhoFixed,
138  bool vegaWeighted,
139  const boost::shared_ptr<QuantLib::EndCriteria> endCriteria,
140  const boost::shared_ptr<QuantLib::OptimizationMethod> method,
141  const QuantLib::DayCounter& dc,
142  bool permanent);
143  };
144 
145  class SmileSectionFromSabrVolSurface : public SmileSection {
146  public:
148  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
150  const QuantLib::Time& time,
151  bool permanent);
152  };
153 }
154 
155 #endif
156 
SabrInterpolatedSmileSection(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Date &optionDate, const QuantLib::Rate &forward, const std::vector< QuantLib::Rate > &strikes, bool hasFloatingStrikes, const QuantLib::Volatility &atmVolatility, const std::vector< QuantLib::Volatility > &vols, QuantLib::Real alpha, QuantLib::Real beta, QuantLib::Real nu, QuantLib::Real rho, bool isAlphaFixed, bool isBetaFixed, bool isNuFixed, bool isRhoFixed, bool vegaWeighted, const boost::shared_ptr< QuantLib::EndCriteria > endCriteria, const boost::shared_ptr< QuantLib::OptimizationMethod > method, const QuantLib::DayCounter &dc, bool permanent)
Definition: smilesection.hpp:145
SmileSectionFromSabrVolSurface(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Handle< QuantLib::SabrVolSurface > &sabrVol, const QuantLib::Time &time, bool permanent)
Definition: smilesection.hpp:59
OH_LIB_CLASS(AlphaForm, QuantLib::AlphaForm)
Definition: smilesection.hpp:46
FlatSmileSection(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Date &optionDate, QuantLib::Volatility v, const QuantLib::DayCounter &dc, const QuantLib::Date &refDate, QuantLib::Real atmValue, QuantLib::VolatilityType type, QuantLib::Real shift, bool permanent)
Definition: abcd.hpp:38
InterpolatedSmileSection(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Date &optionDate, const std::vector< QuantLib::Rate > &strikes, const std::vector< QuantLib::Handle< QuantLib::Quote > > &stdDevs, const QuantLib::Handle< QuantLib::Quote > &atmLevel, const QuantLib::DayCounter &dc, QuantLib::VolatilityType type, QuantLib::Real shift, bool permanent)
Definition: smilesection.hpp:98
Definition: abcd.hpp:30
Definition: smilesection.hpp:73
SabrSmileSection(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Time expiry, const std::vector< QuantLib::Rate > &strikes, const std::vector< QuantLib::Handle< QuantLib::Quote > > &stdDevs, const QuantLib::Handle< QuantLib::Quote > &forward, QuantLib::Real alpha, QuantLib::Real beta, QuantLib::Real nu, QuantLib::Real rho, bool isAlphaFixed, bool isBetaFixed, bool isNuFixed, bool isRhoFixed, bool vegaWeighted=false, const boost::shared_ptr< QuantLib::EndCriteria > endCriteria=boost::shared_ptr< QuantLib::EndCriteria >(), const boost::shared_ptr< QuantLib::OptimizationMethod > method=boost::shared_ptr< QuantLib::OptimizationMethod >(), bool permanent=false)