Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
dummymarket.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2017 Quaternion Risk Management Ltd
3 All rights reserved.
4
5 This file is part of ORE, a free-software/open-source library
6 for transparent pricing and risk analysis - http://opensourcerisk.org
7
8 ORE is free software: you can redistribute it and/or modify it
9 under the terms of the Modified BSD License. You should have received a
10 copy of the license along with this program.
11 The license is also available online at <http://opensourcerisk.org>
12
13 This program is distributed on the basis that it will form a useful
14 contribution to risk analytics and model standardisation, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the license for more details.
17*/
18
19/*!
20 \file ored/marketdata/dummymarket.hpp
21 \brief Dummy Market class returning empty handles, used in tests
22 \ingroup curves
23*/
24
25#pragma once
26
29
30namespace ore {
31namespace analytics {
32using namespace std;
33using namespace QuantLib;
34using namespace ore::data;
35
36//! DummyMarket
37class DummyMarket : public Market {
38public:
39 DummyMarket() : Market(false) {}
40
41 //! Get the asof Date
42 Date asofDate() const override { return Date(); }
43
44 Handle<YieldTermStructure> discountCurveImpl(const string& key, const string& config) const override {
45 return Handle<YieldTermStructure>();
46 }
47 Handle<YieldTermStructure> yieldCurve(const ore::data::YieldCurveType& type, const string&,
48 const string&) const override {
49 return Handle<YieldTermStructure>();
50 }
51 Handle<YieldTermStructure> yieldCurve(const string&, const string&) const override {
52 return Handle<YieldTermStructure>();
53 }
54 Handle<IborIndex> iborIndex(const string&, const string&) const override {
55 return Handle<IborIndex>(ore::data::parseIborIndex("EUR-EONIA")); // ugly, but some people check index.empty()
56 }
57 Handle<SwapIndex> swapIndex(const string&, const string&) const override { return Handle<SwapIndex>(); }
58 Handle<SwaptionVolatilityStructure> swaptionVol(const string&, const string&) const override {
59 return Handle<SwaptionVolatilityStructure>();
60 }
61 string shortSwapIndexBase(const string&, const string&) const override { return string(); }
62 string swapIndexBase(const string&, const string&) const override { return string(); }
63
64 Handle<SwaptionVolatilityStructure> yieldVol(const string&, const string&) const override {
65 return Handle<SwaptionVolatilityStructure>();
66 }
67
68 Handle<QuantExt::FxIndex> fxIndexImpl(const string& index, const string&) const override {
69 if (isFxIndex(index))
70 return Handle<QuantExt::FxIndex>(parseFxIndex(index));
71 return Handle<QuantExt::FxIndex>();
72 };
73 Handle<Quote> fxSpotImpl(const string&, const string&) const override { return Handle<Quote>(); }
74 Handle<Quote> fxRateImpl(const string&, const string&) const override { return Handle<Quote>(); }
75 Handle<BlackVolTermStructure> fxVolImpl(const string&, const string&) const override {
76 return Handle<BlackVolTermStructure>();
77 }
78
79 Handle<QuantExt::CreditCurve> defaultCurve(const string&, const string&) const override {
80 return Handle<QuantExt::CreditCurve>(
81 QuantLib::ext::make_shared<QuantExt::CreditCurve>(Handle<DefaultProbabilityTermStructure>()));
82 }
83 Handle<Quote> recoveryRate(const string&, const string&) const override { return Handle<Quote>(); }
84
85 Handle<QuantExt::CreditVolCurve> cdsVol(const string&, const string&) const override {
86 return Handle<QuantExt::CreditVolCurve>();
87 }
88
89 Handle<QuantExt::BaseCorrelationTermStructure> baseCorrelation(const string&, const string&) const override {
90 return Handle<QuantExt::BaseCorrelationTermStructure>();
91 }
92
93 Handle<OptionletVolatilityStructure> capFloorVol(const string&, const string&) const override {
94 return Handle<OptionletVolatilityStructure>();
95 }
96
97 std::pair<string, QuantLib::Period> capFloorVolIndexBase(const string&, const string&) const override {
98 return std::make_pair(string(), 0 * Days);
99 }
100
101 Handle<ZeroInflationIndex> zeroInflationIndex(const string&, const string&) const override {
102 return Handle<ZeroInflationIndex>();
103 }
104 Handle<YoYInflationIndex> yoyInflationIndex(const string&, const string&) const override {
105 return Handle<YoYInflationIndex>();
106 }
107
108 Handle<QuantExt::YoYOptionletVolatilitySurface> yoyCapFloorVol(const string&, const string&) const override {
109 return Handle<QuantExt::YoYOptionletVolatilitySurface>();
110 }
111
112 Handle<QuantLib::CPIVolatilitySurface> cpiInflationCapFloorVolatilitySurface(const string&, const string&) const override {
113 return Handle<QuantLib::CPIVolatilitySurface>();
114 }
115
116 Handle<Quote> equitySpot(const string&, const string&) const override { return Handle<Quote>(); }
117 Handle<YieldTermStructure> equityDividendCurve(const string&, const string&) const override {
118 return Handle<YieldTermStructure>();
119 }
120 Handle<YieldTermStructure> equityForecastCurve(const string&, const string&) const override {
121 return Handle<YieldTermStructure>();
122 }
123
124 Handle<QuantExt::EquityIndex2> equityCurve(const string& eqName, const string&) const override {
125 return Handle<QuantExt::EquityIndex2>();
126 }
127
128 Handle<BlackVolTermStructure> equityVol(const string&, const string&) const override {
129 return Handle<BlackVolTermStructure>();
130 }
131
132 Handle<Quote> securitySpread(const string&, const string&) const override { return Handle<Quote>(); }
133
134 QuantLib::Handle<QuantExt::PriceTermStructure> commodityPriceCurve(const std::string&,
135 const std::string&) const override {
136 return QuantLib::Handle<QuantExt::PriceTermStructure>();
137 }
138
139 QuantLib::Handle<QuantExt::CommodityIndex> commodityIndex(const std::string&, const std::string&) const override {
140 return QuantLib::Handle<QuantExt::CommodityIndex>();
141 }
142
143 QuantLib::Handle<QuantLib::BlackVolTermStructure> commodityVolatility(const std::string&,
144 const std::string&) const override {
145 return Handle<BlackVolTermStructure>();
146 }
147
148 QuantLib::Handle<QuantLib::Quote> cpr(const string&, const string&) const override {
149 return QuantLib::Handle<QuantLib::Quote>();
150 }
151
152 QuantLib::Handle<QuantExt::CorrelationTermStructure> correlationCurve(const std::string&, const std::string&,
153 const std::string&) const override {
154 return QuantLib::Handle<QuantExt::CorrelationTermStructure>();
155 }
156};
157
158} // namespace analytics
159} // namespace ore
QuantLib::Handle< QuantLib::BlackVolTermStructure > commodityVolatility(const std::string &, const std::string &) const override
Handle< QuantExt::EquityIndex2 > equityCurve(const string &eqName, const string &) const override
Handle< SwapIndex > swapIndex(const string &, const string &) const override
Definition: dummymarket.hpp:57
Handle< YoYInflationIndex > yoyInflationIndex(const string &, const string &) const override
QuantLib::Handle< QuantExt::CommodityIndex > commodityIndex(const std::string &, const std::string &) const override
Handle< QuantExt::CreditCurve > defaultCurve(const string &, const string &) const override
Definition: dummymarket.hpp:79
Handle< QuantLib::CPIVolatilitySurface > cpiInflationCapFloorVolatilitySurface(const string &, const string &) const override
CPI Inflation Cap Floor Volatility Surfaces.
std::pair< string, QuantLib::Period > capFloorVolIndexBase(const string &, const string &) const override
Definition: dummymarket.hpp:97
Handle< Quote > equitySpot(const string &, const string &) const override
Handle< SwaptionVolatilityStructure > swaptionVol(const string &, const string &) const override
Definition: dummymarket.hpp:58
Handle< Quote > fxSpotImpl(const string &, const string &) const override
Definition: dummymarket.hpp:73
Handle< Quote > recoveryRate(const string &, const string &) const override
Definition: dummymarket.hpp:83
Handle< YieldTermStructure > discountCurveImpl(const string &key, const string &config) const override
Definition: dummymarket.hpp:44
Handle< YieldTermStructure > yieldCurve(const ore::data::YieldCurveType &type, const string &, const string &) const override
Definition: dummymarket.hpp:47
QuantLib::Handle< QuantLib::Quote > cpr(const string &, const string &) const override
Date asofDate() const override
Get the asof Date.
Definition: dummymarket.hpp:42
Handle< QuantExt::YoYOptionletVolatilitySurface > yoyCapFloorVol(const string &, const string &) const override
Handle< QuantExt::FxIndex > fxIndexImpl(const string &index, const string &) const override
Definition: dummymarket.hpp:68
Handle< ZeroInflationIndex > zeroInflationIndex(const string &, const string &) const override
Inflation Indexes.
Handle< Quote > securitySpread(const string &, const string &) const override
string shortSwapIndexBase(const string &, const string &) const override
Definition: dummymarket.hpp:61
Handle< QuantExt::BaseCorrelationTermStructure > baseCorrelation(const string &, const string &) const override
Definition: dummymarket.hpp:89
Handle< OptionletVolatilityStructure > capFloorVol(const string &, const string &) const override
Definition: dummymarket.hpp:93
Handle< YieldTermStructure > yieldCurve(const string &, const string &) const override
Definition: dummymarket.hpp:51
Handle< YieldTermStructure > equityForecastCurve(const string &, const string &) const override
string swapIndexBase(const string &, const string &) const override
Definition: dummymarket.hpp:62
Handle< IborIndex > iborIndex(const string &, const string &) const override
Definition: dummymarket.hpp:54
Handle< QuantExt::CreditVolCurve > cdsVol(const string &, const string &) const override
Definition: dummymarket.hpp:85
Handle< SwaptionVolatilityStructure > yieldVol(const string &, const string &) const override
Definition: dummymarket.hpp:64
Handle< BlackVolTermStructure > equityVol(const string &, const string &) const override
QuantLib::Handle< QuantExt::PriceTermStructure > commodityPriceCurve(const std::string &, const std::string &) const override
Handle< Quote > fxRateImpl(const string &, const string &) const override
Definition: dummymarket.hpp:74
Handle< BlackVolTermStructure > fxVolImpl(const string &, const string &) const override
Definition: dummymarket.hpp:75
QuantLib::Handle< QuantExt::CorrelationTermStructure > correlationCurve(const std::string &, const std::string &, const std::string &) const override
Handle< YieldTermStructure > equityDividendCurve(const string &, const string &) const override
QuantLib::ext::shared_ptr< IborIndex > parseIborIndex(const string &s, const Handle< YieldTermStructure > &h)
Convert std::string to QuantLib::IborIndex.
QuantLib::ext::shared_ptr< FxIndex > parseFxIndex(const string &s, const Handle< Quote > &fxSpot, const Handle< YieldTermStructure > &sourceYts, const Handle< YieldTermStructure > &targetYts, const bool useConventions)
Convert std::string to QuantExt::FxIndex.
Map text representations to QuantLib/QuantExt types.
Base Market class.
bool isFxIndex(const std::string &indexName)
YieldCurveType
Definition: market.hpp:59
Serializable Credit Default Swap.
Definition: namespaces.docs:23