defaulttermstructures.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) 2009 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 #ifndef qla_defaulttermstructure_hpp
21 #define qla_defaulttermstructure_hpp
22 
23 #include <qlo/termstructures.hpp>
24 
25 #include <ql/types.hpp>
26 #include <ql/time/businessdayconvention.hpp>
27 
28 namespace QuantLib {
29 
30  class Calendar;
31  class DayCounter;
32  class Period;
33  class Quote;
34  class Date;
35 
36  template <class T>
37  class Handle;
38 }
39 
40 namespace QuantLibAddin {
41 
42  OH_OBJ_CLASS(HazardRateStructure, DefaultProbabilityTermStructure);
43 
44  class FlatHazardRate : public HazardRateStructure {
45  public:
47  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
48  QuantLib::Natural nDays,
49  const QuantLib::Calendar& calendar,
50  const QuantLib::Handle<QuantLib::Quote>& hazardRate,
51  const QuantLib::DayCounter& dayCounter,
52  bool permanent);
53  };
54 
55  OH_OBJ_CLASS(DefaultDensityStructure, DefaultProbabilityTermStructure);
56 
57  class BaseCorrelationTermStructure : public CorrelationTermStructure {
58  public:
60  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
61 
62  const std::string& interpolType,
63  QuantLib::Natural nDays,
64  const QuantLib::Calendar& calendar,
65  QuantLib::BusinessDayConvention bdc,
66  const std::vector<QuantLib::Period>& tenors,
67  const std::vector<QuantLib::Real>& lossLevel,
68  const std::vector<std::vector<QuantLib::Handle<QuantLib::Quote> > >& correls,
69  const QuantLib::DayCounter& dayCounter,
70 
71  bool permanent);
72  QuantLib::Real correlation(const QuantLib::Date& d, QuantLib::Real lossLevel);
73  const std::string& interpolType() const {return interpolType_;}
74  private:
75  // to be used in the casting to the QL object methods, alternatively use the same
76  // technique as in QLAddIn::InterpolatedYieldCurve
77  const std::string interpolType_; // or a local enumerator
78  };
79 
80  // Bootstrap real world probabilities to a hazard rate curve.
81  QuantLib::Real probabilityToHazardRate(
82  QuantLib::Probability p,
83  const QuantLib::Date& d,
84  const QuantLib::DayCounter& dc);
85 
86 }
87 
88 #endif
BaseCorrelationTermStructure(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const std::string &interpolType, QuantLib::Natural nDays, const QuantLib::Calendar &calendar, QuantLib::BusinessDayConvention bdc, const std::vector< QuantLib::Period > &tenors, const std::vector< QuantLib::Real > &lossLevel, const std::vector< std::vector< QuantLib::Handle< QuantLib::Quote > > > &correls, const QuantLib::DayCounter &dayCounter, bool permanent)
QuantLib::Real correlation(const QuantLib::Date &d, QuantLib::Real lossLevel)
QuantLib::Real probabilityToHazardRate(QuantLib::Probability p, const QuantLib::Date &d, const QuantLib::DayCounter &dc)
Definition: defaulttermstructures.hpp:44
Definition: defaulttermstructures.hpp:57
const std::string & interpolType() const
Definition: defaulttermstructures.hpp:73
OH_OBJ_CLASS(OneAssetOption, Instrument)
Definition: abcd.hpp:38
FlatHazardRate(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, QuantLib::Natural nDays, const QuantLib::Calendar &calendar, const QuantLib::Handle< QuantLib::Quote > &hazardRate, const QuantLib::DayCounter &dayCounter, bool permanent)
Definition: abcd.hpp:30