quotes.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) 2007 Ferdinando Ametrano
5  Copyright (C) 2006 Francois du Vignaud
6  Copyright (C) 2006 Giorgio Facchinetti
7  Copyright (C) 2007 Eric Ehlers
8 
9  This file is part of QuantLib, a free-software/open-source library
10  for financial quantitative analysts and developers - http://quantlib.org/
11 
12  QuantLib is free software: you can redistribute it and/or modify it
13  under the terms of the QuantLib license. You should have received a
14  copy of the license along with this program; if not, please email
15  <quantlib-dev@lists.sf.net>. The license is also available online at
16  <http://quantlib.org/license.shtml>.
17 
18  This program is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
20  FOR A PARTICULAR PURPOSE. See the license for more details.
21 */
22 
23 #ifndef qla_quotes_hpp
24 #define qla_quotes_hpp
25 
26 #include <qlo/quote.hpp>
27 
28 #include <ql/option.hpp>
29 #include <ql/types.hpp>
30 #include <ql/experimental/risk/sensitivityanalysis.hpp>
31 
32 namespace QuantLib {
33  class Index;
34  class IborIndex;
35  class SwapIndex;
36  class Quote;
37  class SimpleQuote;
38  class Date;
39  class CapsStripper2;
40  class Period;
41 
42  template <class T>
43  class Handle;
44 }
45 
46 namespace QuantLibAddin {
47 
48  class SimpleQuote : public Quote {
49  public:
50  SimpleQuote(const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
51  QuantLib::Real value,
52  QuantLib::Real tickValue,
53  bool permanent);
54  QuantLib::Real tickValue() const;
55  void setTickValue(QuantLib::Real tickValue);
56  // it wraps underlying QuantLib::SimpleQuote method
57  // in order to make SimpleQuote serializable in a stateful way
58  QuantLib::Real setValue(QuantLib::Real value);
59  private:
60  boost::shared_ptr<QuantLib::SimpleQuote> simpleQuote_;
61  };
62 
63  class ForwardValueQuote : public Quote {
64  public:
65  ForwardValueQuote(const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
66  const boost::shared_ptr<QuantLib::IborIndex>&,
67  const QuantLib::Date& fixingDate,
68  bool permanent);
69  };
70 
71  class ForwardSwapQuote : public Quote {
72  public:
73  ForwardSwapQuote(const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
74  const boost::shared_ptr<QuantLib::SwapIndex>& swapIndex,
76  const QuantLib::Period& fwdStart,
77  bool permanent);
78  };
79 
80  class ImpliedStdDevQuote : public Quote {
81  public:
82  ImpliedStdDevQuote(const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
83  QuantLib::Option::Type optionType,
84  const QuantLib::Handle<QuantLib::Quote>& forward,
86  QuantLib::Real strike,
87  QuantLib::Real guess,
88  QuantLib::Real accuracy,
89  bool permanent);
90  };
91 
92  class EurodollarFuturesImpliedStdDevQuote : public Quote {
93  public:
95  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
96  const QuantLib::Handle<QuantLib::Quote>& forward,
97  const QuantLib::Handle<QuantLib::Quote>& callPrice,
98  const QuantLib::Handle<QuantLib::Quote>& putPrice,
99  QuantLib::Real strike,
100  QuantLib::Real guess,
101  QuantLib::Real accuracy,
102  bool permanent);
103  };
104 
105  class FuturesConvAdjustmentQuote : public Quote {
106  public:
108  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
109  const boost::shared_ptr<QuantLib::IborIndex>& index,
110  const std::string& immCode,
111  const QuantLib::Handle<QuantLib::Quote>& futuresQuote,
112  const QuantLib::Handle<QuantLib::Quote>& volatility,
113  const QuantLib::Handle<QuantLib::Quote>& meanReversion,
114  bool permanent);
115  };
116 
117  class CompositeQuote : public Quote {
118  public:
120  const boost::shared_ptr<ObjectHandler::ValueObject>& properties,
121  const QuantLib::Handle<QuantLib::Quote>& element1,
122  const QuantLib::Handle<QuantLib::Quote>& element2,
123  const std::string& op,
124  bool permanent);
125  };
126 
127  class LastFixingQuote : public Quote {
128  public:
129  LastFixingQuote(const boost::shared_ptr<ObjectHandler::ValueObject>& p,
130  const boost::shared_ptr<QuantLib::Index>& index,
131  bool permanent);
132  };
133 
134  std::vector<std::vector<QuantLib::Real> >
135  bucketAnalysis(const std::vector<std::vector<QuantLib::Handle<QuantLib::Quote> > >&,
136  const std::vector<boost::shared_ptr<QuantLib::Instrument> >&,
137  const std::vector<QuantLib::Real>& quant,
138  QuantLib::Real shift,
139  QuantLib::SensitivityAnalysis type);
140 
141  inline std::vector<QuantLib::Real>
143  const std::vector<QuantLib::Handle<QuantLib::Quote> >& parameters,
144  QuantLib::Real shift,
145  QuantLib::SensitivityAnalysis type) {
146  std::vector<QuantLib::Real> deltaVector;
147  std::vector<QuantLib::Real> gammaVector;
148  std::vector<QuantLib::Real> refVals;
149  QuantLib::bucketAnalysis(deltaVector, gammaVector, refVals,
150  quote, parameters, shift, type);
151  return deltaVector;
152  }
153 
154  std::vector<std::vector<QuantLib::Real> >
155  bucketAnalysisDelta2(const std::vector<QuantLib::Handle<QuantLib::Quote> >& quotes,
156  const std::vector<QuantLib::Handle<QuantLib::Quote> >& parameters,
157  QuantLib::Real shift,
158  QuantLib::SensitivityAnalysis type);
159 }
160 
161 #endif
ImpliedStdDevQuote(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, QuantLib::Option::Type optionType, const QuantLib::Handle< QuantLib::Quote > &forward, const QuantLib::Handle< QuantLib::Quote > &price, QuantLib::Real strike, QuantLib::Real guess, QuantLib::Real accuracy, bool permanent)
Definition: quotes.hpp:63
std::vector< QuantLib::Real > bucketAnalysisDelta(const QuantLib::Handle< QuantLib::SimpleQuote > &quote, const std::vector< QuantLib::Handle< QuantLib::Quote > > &parameters, QuantLib::Real shift, QuantLib::SensitivityAnalysis type)
Definition: quotes.hpp:142
Definition: quotes.hpp:71
ForwardSwapQuote(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const boost::shared_ptr< QuantLib::SwapIndex > &swapIndex, const QuantLib::Handle< QuantLib::Quote > &spread, const QuantLib::Period &fwdStart, bool permanent)
Definition: quotes.hpp:80
FuturesConvAdjustmentQuote(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const boost::shared_ptr< QuantLib::IborIndex > &index, const std::string &immCode, const QuantLib::Handle< QuantLib::Quote > &futuresQuote, const QuantLib::Handle< QuantLib::Quote > &volatility, const QuantLib::Handle< QuantLib::Quote > &meanReversion, bool permanent)
QuantLib::Real setValue(QuantLib::Real value)
Definition: quotes.hpp:127
SimpleQuote(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, QuantLib::Real value, QuantLib::Real tickValue, bool permanent)
QuantLib::Real tickValue() const
std::vector< std::vector< QuantLib::Real > > bucketAnalysis(const std::vector< std::vector< QuantLib::Handle< QuantLib::Quote > > > &, const std::vector< boost::shared_ptr< QuantLib::Instrument > > &, const std::vector< QuantLib::Real > &quant, QuantLib::Real shift, QuantLib::SensitivityAnalysis type)
std::vector< std::vector< QuantLib::Real > > bucketAnalysisDelta2(const std::vector< QuantLib::Handle< QuantLib::Quote > > &quotes, const std::vector< QuantLib::Handle< QuantLib::Quote > > &parameters, QuantLib::Real shift, QuantLib::SensitivityAnalysis type)
Definition: abcd.hpp:38
Definition: quotes.hpp:48
EurodollarFuturesImpliedStdDevQuote(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Handle< QuantLib::Quote > &forward, const QuantLib::Handle< QuantLib::Quote > &callPrice, const QuantLib::Handle< QuantLib::Quote > &putPrice, QuantLib::Real strike, QuantLib::Real guess, QuantLib::Real accuracy, bool permanent)
LastFixingQuote(const boost::shared_ptr< ObjectHandler::ValueObject > &p, const boost::shared_ptr< QuantLib::Index > &index, bool permanent)
CompositeQuote(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const QuantLib::Handle< QuantLib::Quote > &element1, const QuantLib::Handle< QuantLib::Quote > &element2, const std::string &op, bool permanent)
Definition: abcd.hpp:30
void setTickValue(QuantLib::Real tickValue)
ForwardValueQuote(const boost::shared_ptr< ObjectHandler::ValueObject > &properties, const boost::shared_ptr< QuantLib::IborIndex > &, const QuantLib::Date &fixingDate, bool permanent)
Definition: quotes.hpp:117