Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | List of all members
TestMarket Class Reference

Simple flat market setup to be used in the test suite. More...

#include <test/testmarket.hpp>

+ Inheritance diagram for TestMarket:
+ Collaboration diagram for TestMarket:

Public Member Functions

 TestMarket (Date asof, bool swapVolCube=false)
 
- Public Member Functions inherited from MarketImpl
 MarketImpl (const bool handlePseudoCurrencies)
 
Date asofDate () const override
 
Handle< YieldTermStructure > yieldCurve (const YieldCurveType &type, const string &ccy, const string &configuration=Market::defaultConfiguration) const override
 
Handle< YieldTermStructure > discountCurveImpl (const string &ccy, const string &configuration=Market::defaultConfiguration) const override
 
Handle< YieldTermStructure > yieldCurve (const string &name, const string &configuration=Market::defaultConfiguration) const override
 
Handle< IborIndexiborIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< SwapIndex > swapIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantLib::SwaptionVolatilityStructure > swaptionVol (const string &key, const string &configuration=Market::defaultConfiguration) const override
 
string shortSwapIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const override
 
string swapIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantLib::SwaptionVolatilityStructure > yieldVol (const string &securityID, const string &configuration=Market::defaultConfiguration) const override
 
QuantLib::Handle< QuantExt::FxIndexfxIndexImpl (const string &fxIndex, const string &configuration=Market::defaultConfiguration) const override
 
Handle< Quote > fxRateImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const override
 
Handle< Quote > fxSpotImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const override
 
Handle< BlackVolTermStructurefxVolImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::CreditCurvedefaultCurve (const string &, const string &configuration=Market::defaultConfiguration) const override
 
Handle< Quote > recoveryRate (const string &, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::CreditVolCurvecdsVol (const string &name, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::BaseCorrelationTermStructurebaseCorrelation (const string &name, const string &configuration=Market::defaultConfiguration) const override
 
Handle< OptionletVolatilityStructure > capFloorVol (const string &key, const string &configuration=Market::defaultConfiguration) const override
 
std::pair< string, QuantLib::Period > capFloorVolIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::YoYOptionletVolatilitySurface > yoyCapFloorVol (const string &name, const string &configuration=Market::defaultConfiguration) const override
 
virtual Handle< ZeroInflationIndex > zeroInflationIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 
virtual Handle< YoYInflationIndex > yoyInflationIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 
virtual Handle< CPIVolatilitySurface > cpiInflationCapFloorVolatilitySurface (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< Quote > equitySpot (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::EquityIndex2equityCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< YieldTermStructure > equityDividendCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< BlackVolTermStructureequityVol (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< YieldTermStructure > equityForecastCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< Quote > securitySpread (const string &securityID, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::InflationIndexObserverbaseCpis (const string &index, const string &configuration=Market::defaultConfiguration) const
 
QuantLib::Handle< QuantExt::PriceTermStructurecommodityPriceCurve (const string &commodityName, const string &configuration=Market::defaultConfiguration) const override
 
QuantLib::Handle< QuantExt::CommodityIndexcommodityIndex (const std::string &commodityName, const std::string &configuration=Market::defaultConfiguration) const override
 
QuantLib::Handle< QuantLib::BlackVolTermStructure > commodityVolatility (const string &commodityName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::CorrelationTermStructurecorrelationCurve (const string &index1, const string &index2, const string &configuration=Market::defaultConfiguration) const override
 
QuantLib::Handle< Quote > cpr (const string &securityID, const string &configuration=Market::defaultConfiguration) const override
 
 MarketImpl (const MarketImpl &)=delete
 
MarketImploperator= (const MarketImpl &)=delete
 
void refresh (const string &configuration=Market::defaultConfiguration) override
 
Date asofDate () const override
 
Handle< YieldTermStructure > yieldCurve (const YieldCurveType &type, const string &ccy, const string &configuration=Market::defaultConfiguration) const override
 
Handle< YieldTermStructure > discountCurveImpl (const string &ccy, const string &configuration=Market::defaultConfiguration) const override
 
Handle< YieldTermStructure > yieldCurve (const string &name, const string &configuration=Market::defaultConfiguration) const override
 
Handle< IborIndexiborIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< SwapIndex > swapIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantLib::SwaptionVolatilityStructure > swaptionVol (const string &key, const string &configuration=Market::defaultConfiguration) const override
 
string shortSwapIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const override
 
string swapIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantLib::SwaptionVolatilityStructure > yieldVol (const string &securityID, const string &configuration=Market::defaultConfiguration) const override
 
QuantLib::Handle< QuantExt::FxIndexfxIndexImpl (const string &fxIndex, const string &configuration=Market::defaultConfiguration) const override
 
Handle< Quote > fxRateImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const override
 
Handle< Quote > fxSpotImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const override
 
Handle< BlackVolTermStructurefxVolImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::CreditCurvedefaultCurve (const string &, const string &configuration=Market::defaultConfiguration) const override
 
Handle< Quote > recoveryRate (const string &, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::CreditVolCurvecdsVol (const string &name, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::BaseCorrelationTermStructurebaseCorrelation (const string &name, const string &configuration=Market::defaultConfiguration) const override
 
Handle< OptionletVolatilityStructure > capFloorVol (const string &key, const string &configuration=Market::defaultConfiguration) const override
 
std::pair< string, QuantLib::Period > capFloorVolIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::YoYOptionletVolatilitySurface > yoyCapFloorVol (const string &name, const string &configuration=Market::defaultConfiguration) const override
 
virtual Handle< ZeroInflationIndex > zeroInflationIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 
virtual Handle< YoYInflationIndex > yoyInflationIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 
virtual Handle< CPIVolatilitySurface > cpiInflationCapFloorVolatilitySurface (const string &indexName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< Quote > equitySpot (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::EquityIndex2equityCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< YieldTermStructure > equityDividendCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< BlackVolTermStructureequityVol (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< YieldTermStructure > equityForecastCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< Quote > securitySpread (const string &securityID, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::InflationIndexObserverbaseCpis (const string &index, const string &configuration=Market::defaultConfiguration) const
 
QuantLib::Handle< QuantExt::PriceTermStructurecommodityPriceCurve (const string &commodityName, const string &configuration=Market::defaultConfiguration) const override
 
QuantLib::Handle< QuantExt::CommodityIndexcommodityIndex (const std::string &commodityName, const std::string &configuration=Market::defaultConfiguration) const override
 
QuantLib::Handle< QuantLib::BlackVolTermStructure > commodityVolatility (const string &commodityName, const string &configuration=Market::defaultConfiguration) const override
 
Handle< QuantExt::CorrelationTermStructurecorrelationCurve (const string &index1, const string &index2, const string &configuration=Market::defaultConfiguration) const override
 
QuantLib::Handle< Quote > cpr (const string &securityID, const string &configuration=Market::defaultConfiguration) const override
 
- Public Member Functions inherited from Market
 Market (const bool handlePseudoCurrencies)
 
virtual ~Market ()
 
virtual Date asofDate () const=0
 
virtual Handle< YieldTermStructure > yieldCurve (const YieldCurveType &type, const string &name, const string &configuration=Market::defaultConfiguration) const=0
 
Handle< YieldTermStructure > discountCurve (const string &ccy, const string &configuration=Market::defaultConfiguration) const
 
virtual Handle< YieldTermStructure > discountCurveImpl (const string &ccy, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< YieldTermStructure > yieldCurve (const string &name, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< IborIndexiborIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< SwapIndex > swapIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< SwaptionVolatilityStructureswaptionVol (const string &key, const string &configuration=Market::defaultConfiguration) const=0
 
virtual string shortSwapIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const=0
 
virtual string swapIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< SwaptionVolatilityStructureyieldVol (const string &securityID, const string &configuration=Market::defaultConfiguration) const=0
 
QuantLib::Handle< QuantExt::FxIndexfxIndex (const string &fxIndex, const string &configuration=Market::defaultConfiguration) const
 
virtual QuantLib::Handle< QuantExt::FxIndexfxIndexImpl (const string &fxIndex, const string &configuration=Market::defaultConfiguration) const=0
 
Handle< Quote > fxRate (const string &ccypair, const string &configuration=Market::defaultConfiguration) const
 
virtual Handle< Quote > fxRateImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const=0
 
Handle< Quote > fxSpot (const string &ccypair, const string &configuration=Market::defaultConfiguration) const
 
virtual Handle< Quote > fxSpotImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const=0
 
Handle< BlackVolTermStructurefxVol (const string &ccypair, const string &configuration=Market::defaultConfiguration) const
 
virtual Handle< BlackVolTermStructurefxVolImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< QuantExt::CreditCurvedefaultCurve (const string &, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< Quote > recoveryRate (const string &, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< QuantExt::CreditVolCurvecdsVol (const string &, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< QuantExt::BaseCorrelationTermStructurebaseCorrelation (const string &, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< OptionletVolatilityStructure > capFloorVol (const string &key, const string &configuration=Market::defaultConfiguration) const=0
 
virtual std::pair< std::string, QuantLib::Period > capFloorVolIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< QuantExt::YoYOptionletVolatilitySurface > yoyCapFloorVol (const string &indexName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< ZeroInflationIndex > zeroInflationIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< YoYInflationIndex > yoyInflationIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< CPIVolatilitySurface > cpiInflationCapFloorVolatilitySurface (const string &indexName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< Quote > equitySpot (const string &eqName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< YieldTermStructure > equityDividendCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< YieldTermStructure > equityForecastCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< QuantExt::EquityIndex2equityCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< Quote > securitySpread (const string &securityID, const string &configuration=Market::defaultConfiguration) const=0
 
virtual QuantLib::Handle< QuantExt::PriceTermStructurecommodityPriceCurve (const std::string &commodityName, const std::string &configuration=Market::defaultConfiguration) const=0
 
virtual QuantLib::Handle< QuantExt::CommodityIndexcommodityIndex (const std::string &commodityName, const std::string &configuration=Market::defaultConfiguration) const=0
 
virtual QuantLib::Handle< QuantLib::BlackVolTermStructure > commodityVolatility (const std::string &commodityName, const std::string &configuration=Market::defaultConfiguration) const=0
 
virtual QuantLib::Handle< QuantExt::CorrelationTermStructurecorrelationCurve (const std::string &index1, const std::string &index2, const std::string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< BlackVolTermStructureequityVol (const string &eqName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual void refresh (const string &)
 
virtual Handle< Quote > cpr (const string &securityID, const string &configuration=Market::defaultConfiguration) const=0
 
string commodityCurveLookup (const string &pm) const
 
bool handlePseudoCurrencies () const
 
virtual Handle< YieldTermStructure > yieldCurve (const YieldCurveType &type, const string &name, const string &configuration=Market::defaultConfiguration) const=0
 
Handle< YieldTermStructure > discountCurve (const string &ccy, const string &configuration=Market::defaultConfiguration) const
 
virtual Handle< YieldTermStructure > discountCurveImpl (const string &ccy, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< YieldTermStructure > yieldCurve (const string &name, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< IborIndexiborIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< SwapIndex > swapIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< SwaptionVolatilityStructureswaptionVol (const string &key, const string &configuration=Market::defaultConfiguration) const=0
 
virtual string shortSwapIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const=0
 
virtual string swapIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< SwaptionVolatilityStructureyieldVol (const string &securityID, const string &configuration=Market::defaultConfiguration) const=0
 
QuantLib::Handle< QuantExt::FxIndexfxIndex (const string &fxIndex, const string &configuration=Market::defaultConfiguration) const
 
virtual QuantLib::Handle< QuantExt::FxIndexfxIndexImpl (const string &fxIndex, const string &configuration=Market::defaultConfiguration) const=0
 
Handle< Quote > fxRate (const string &ccypair, const string &configuration=Market::defaultConfiguration) const
 
virtual Handle< Quote > fxRateImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const=0
 
Handle< Quote > fxSpot (const string &ccypair, const string &configuration=Market::defaultConfiguration) const
 
virtual Handle< Quote > fxSpotImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const=0
 
Handle< BlackVolTermStructurefxVol (const string &ccypair, const string &configuration=Market::defaultConfiguration) const
 
virtual Handle< BlackVolTermStructurefxVolImpl (const string &ccypair, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< QuantExt::CreditCurvedefaultCurve (const string &, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< Quote > recoveryRate (const string &, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< QuantExt::CreditVolCurvecdsVol (const string &, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< QuantExt::BaseCorrelationTermStructurebaseCorrelation (const string &, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< OptionletVolatilityStructure > capFloorVol (const string &key, const string &configuration=Market::defaultConfiguration) const=0
 
virtual std::pair< std::string, QuantLib::Period > capFloorVolIndexBase (const string &key, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< QuantExt::YoYOptionletVolatilitySurface > yoyCapFloorVol (const string &indexName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< ZeroInflationIndex > zeroInflationIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< YoYInflationIndex > yoyInflationIndex (const string &indexName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< CPIVolatilitySurface > cpiInflationCapFloorVolatilitySurface (const string &indexName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< Quote > equitySpot (const string &eqName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< YieldTermStructure > equityDividendCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< YieldTermStructure > equityForecastCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< QuantExt::EquityIndex2equityCurve (const string &eqName, const string &configuration=Market::defaultConfiguration) const=0
 
virtual Handle< Quote > securitySpread (const string &securityID, const string &configuration=Market::defaultConfiguration) const=0
 
virtual QuantLib::Handle< QuantExt::PriceTermStructurecommodityPriceCurve (const std::string &commodityName, const std::string &configuration=Market::defaultConfiguration) const=0
 
virtual QuantLib::Handle< QuantExt::CommodityIndexcommodityIndex (const std::string &commodityName, const std::string &configuration=Market::defaultConfiguration) const=0
 
virtual QuantLib::Handle< QuantLib::BlackVolTermStructure > commodityVolatility (const std::string &commodityName, const std::string &configuration=Market::defaultConfiguration) const=0
 
virtual QuantLib::Handle< QuantExt::CorrelationTermStructurecorrelationCurve (const std::string &index1, const std::string &index2, const std::string &configuration=Market::defaultConfiguration) const=0
 

Private Member Functions

Handle< YieldTermStructure > flatRateYts (Real forward)
 
Handle< BlackVolTermStructureflatRateFxv (Volatility forward)
 
Handle< YieldTermStructure > flatRateDiv (Real dividend)
 
Handle< QuantLib::SwaptionVolatilityStructure > flatRateSvs (Volatility forward, VolatilityType type=ShiftedLognormal, Real shift=0.0)
 
Handle< QuantExt::CreditCurveflatRateDcs (Volatility forward)
 
Handle< OptionletVolatilityStructure > flatRateCvs (Volatility vol, VolatilityType type=Normal, Real shift=0.0)
 
Handle< QuantExt::CorrelationTermStructureflatCorrelation (Real correlation=0.0)
 
Handle< CPICapFloorTermPriceSurface > flatRateCps (Handle< ZeroInflationIndex > infIndex, const std::vector< Rate > cStrikes, std::vector< Rate > fStrikes, std::vector< Period > cfMaturities, Matrix cPrice, Matrix fPrice)
 
Handle< QuantLib::CPIVolatilitySurface > flatCpiVolSurface (Volatility v)
 
Handle< ZeroInflationIndex > makeZeroInflationIndex (string index, vector< Date > dates, vector< Rate > rates, QuantLib::ext::shared_ptr< ZeroInflationIndex > ii, Handle< YieldTermStructure > yts)
 
Handle< YoYInflationIndex > makeYoYInflationIndex (string index, vector< Date > dates, vector< Rate > rates, QuantLib::ext::shared_ptr< YoYInflationIndex > ii, Handle< YieldTermStructure > yts)
 
Handle< ZeroInflationTermStructure > flatZeroInflationCurve (Real inflationRate, Rate nominalRate)
 
Handle< YoYInflationTermStructureflatYoYInflationCurve (Real inflationRate, Rate nominalRate)
 
Handle< YoYOptionletVolatilitySurfaceflatYoYOptionletVolatilitySurface (Real normalVol)
 

Additional Inherited Members

- Static Public Attributes inherited from Market
static const string defaultConfiguration
 
static const string inCcyConfiguration
 
- Protected Member Functions inherited from MarketImpl
virtual void require (const MarketObject o, const string &name, const string &configuration, const bool forceBuild=false) const
 
void addSwapIndex (const string &swapindex, const string &discountIndex, const string &configuration=Market::defaultConfiguration) const
 
- Protected Attributes inherited from MarketImpl
Date asof_
 
QuantLib::ext::shared_ptr< FXTriangulationfx_
 
map< tuple< string, YieldCurveType, string >, Handle< YieldTermStructure > > yieldCurves_
 
map< pair< string, string >, Handle< IborIndex > > iborIndices_
 
map< pair< string, string >, Handle< SwapIndex > > swapIndices_
 
map< pair< string, string >, Handle< QuantLib::SwaptionVolatilityStructure > > swaptionCurves_
 
map< pair< string, string >, pair< string, string > > swaptionIndexBases_
 
map< pair< string, string >, Handle< QuantLib::SwaptionVolatilityStructure > > yieldVolCurves_
 
map< pair< string, string >, Handle< BlackVolTermStructure > > fxVols_
 
map< pair< string, string >, Handle< QuantExt::CreditCurve > > defaultCurves_
 
map< pair< string, string >, Handle< QuantExt::CreditVolCurve > > cdsVols_
 
map< pair< string, string >, Handle< QuantExt::BaseCorrelationTermStructure > > baseCorrelations_
 
map< pair< string, string >, Handle< Quote > > recoveryRates_
 
map< pair< string, string >, Handle< OptionletVolatilityStructure > > capFloorCurves_
 
map< pair< string, string >, std::pair< string, QuantLib::Period > > capFloorIndexBase_
 
map< pair< string, string >, Handle< YoYOptionletVolatilitySurface > > yoyCapFloorVolSurfaces_
 
map< pair< string, string >, Handle< ZeroInflationIndex > > zeroInflationIndices_
 
map< pair< string, string >, Handle< YoYInflationIndex > > yoyInflationIndices_
 
map< pair< string, string >, Handle< CPIVolatilitySurface > > cpiInflationCapFloorVolatilitySurfaces_
 
map< pair< string, string >, Handle< Quote > > equitySpots_
 
map< pair< string, string >, Handle< BlackVolTermStructure > > equityVols_
 
map< pair< string, string >, Handle< Quote > > securitySpreads_
 
map< pair< string, string >, Handle< QuantExt::InflationIndexObserver > > baseCpis_
 
map< tuple< string, string, string >, Handle< QuantExt::CorrelationTermStructure > > correlationCurves_
 
map< pair< string, string >, QuantLib::Handle< QuantExt::CommodityIndex > > commodityIndices_
 
map< pair< string, string >, QuantLib::Handle< QuantLib::BlackVolTermStructure > > commodityVols_
 
map< pair< string, string >, QuantLib::Handle< QuantExt::EquityIndex2 > > equityCurves_
 
map< pair< string, string >, Handle< Quote > > cprs_
 
map< string, std::set< QuantLib::ext::shared_ptr< TermStructure > > > refreshTs_
 
- Protected Attributes inherited from Market
bool handlePseudoCurrencies_
 

Detailed Description

Simple flat market setup to be used in the test suite.

Definition at line 64 of file testmarket.hpp.

Constructor & Destructor Documentation

◆ TestMarket()

TestMarket ( Date  asof,
bool  swapVolCube = false 
)

Definition at line 209 of file testmarket.cpp.

209 : MarketImpl(false) {
210
212
213 asof_ = asof;
214
215 // build discount
216 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "EUR")] = flatRateYts(0.02);
217 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "USD")] = flatRateYts(0.03);
218 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "GBP")] = flatRateYts(0.04);
219 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "CHF")] = flatRateYts(0.01);
220 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "JPY")] = flatRateYts(0.005);
221 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "CAD")] = flatRateYts(0.005);
222 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "SEK")] = flatRateYts(0.005);
223
224 // build ibor indices
225 vector<pair<string, Real>> indexData = {
226 {"EUR-EONIA", 0.01}, {"EUR-EURIBOR-3M", 0.015}, {"EUR-EURIBOR-6M", 0.02},
227 {"USD-FedFunds", 0.01}, {"USD-LIBOR-1M", 0.02}, {"USD-LIBOR-3M", 0.03}, {"USD-LIBOR-6M", 0.05},
228 {"GBP-SONIA", 0.01}, {"GBP-LIBOR-3M", 0.03}, {"GBP-LIBOR-6M", 0.04},
229 {"CHF-LIBOR-3M", 0.01}, {"CHF-TOIS", 0.02}, {"CHF-LIBOR-6M", 0.02},
230 {"JPY-LIBOR-6M", 0.01}, {"JPY-TONAR", 0.01}, {"JPY-LIBOR-3M", 0.01},
231 {"CAD-CDOR-3M", 0.02}, {"CAD-CORRA", 0.01},
232 {"SEK-STIBOR-3M", 0.02}};
233
234 for (auto id : indexData) {
235 Handle<IborIndex> h(parseIborIndex(id.first, flatRateYts(id.second)));
236 iborIndices_[make_pair(Market::defaultConfiguration, id.first)] = h;
237
238 // set up dummy fixings for the past 400 days
239 for (Date d = asof - 400; d < asof; d++) {
240 if (h->isValidFixingDate(d))
241 h->addFixing(d, 0.01);
242 }
243 }
244
245 // swap index
246 addSwapIndex("EUR-CMS-2Y", "EUR-EONIA", Market::defaultConfiguration);
247 addSwapIndex("EUR-CMS-30Y", "EUR-EONIA", Market::defaultConfiguration);
248 addSwapIndex("USD-CMS-2Y", "USD-FedFunds", Market::defaultConfiguration);
249 addSwapIndex("USD-CMS-30Y", "USD-FedFunds", Market::defaultConfiguration);
250 addSwapIndex("GBP-CMS-2Y", "GBP-SONIA", Market::defaultConfiguration);
251 addSwapIndex("GBP-CMS-30Y", "GBP-SONIA", Market::defaultConfiguration);
252 addSwapIndex("CHF-CMS-2Y", "CHF-LIBOR-6M", Market::defaultConfiguration);
253 addSwapIndex("CHF-CMS-30Y", "CHF-LIBOR-6M", Market::defaultConfiguration);
254 addSwapIndex("JPY-CMS-2Y", "JPY-LIBOR-6M", Market::defaultConfiguration);
255 addSwapIndex("JPY-CMS-30Y", "JPY-LIBOR-6M", Market::defaultConfiguration);
256
257 // add fx rates
258 std::map<std::string, Handle<Quote>> quotes;
259 quotes["EURUSD"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.2));
260 quotes["EURGBP"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.8));
261 quotes["EURCHF"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.0));
262 quotes["EURCAD"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.0));
263 quotes["EURSEK"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(1.0));
264 quotes["EURJPY"] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(128.0));
265 fx_ = QuantLib::ext::make_shared<FXTriangulation>(quotes);
266
267 // build fx vols
268 fxVols_[make_pair(Market::defaultConfiguration, "EURUSD")] = flatRateFxv(0.12);
269 fxVols_[make_pair(Market::defaultConfiguration, "EURGBP")] = flatRateFxv(0.15);
270 fxVols_[make_pair(Market::defaultConfiguration, "EURCHF")] = flatRateFxv(0.15);
271 fxVols_[make_pair(Market::defaultConfiguration, "EURJPY")] = flatRateFxv(0.15);
272 fxVols_[make_pair(Market::defaultConfiguration, "GBPCHF")] = flatRateFxv(0.15);
273
274 // Add Equity Spots
275 equitySpots_[make_pair(Market::defaultConfiguration, "SP5")] =
276 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(2147.56));
277 equitySpots_[make_pair(Market::defaultConfiguration, "Lufthansa")] =
278 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(12.75));
279
280 equityVols_[make_pair(Market::defaultConfiguration, "SP5")] = flatRateFxv(0.2514);
281 equityVols_[make_pair(Market::defaultConfiguration, "Lufthansa")] = flatRateFxv(0.30);
282
283 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::EquityDividend, "SP5")] = flatRateDiv(0.01);
284 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::EquityDividend, "Lufthansa")] =
285 flatRateDiv(0.0);
286
287 equityCurves_[make_pair(Market::defaultConfiguration, "SP5")] = Handle<EquityIndex2>(QuantLib::ext::make_shared<EquityIndex2>(
288 "SP5", UnitedStates(UnitedStates::Settlement), parseCurrency("USD"), equitySpot("SP5"), yieldCurve(YieldCurveType::Discount, "USD"),
289 yieldCurve(YieldCurveType::EquityDividend, "SP5")));
290 equityCurves_[make_pair(Market::defaultConfiguration, "Lufthansa")] =
291 Handle<EquityIndex2>(QuantLib::ext::make_shared<EquityIndex2>(
292 "Lufthansa", TARGET(), parseCurrency("EUR"), equitySpot("Lufthansa"),
293 yieldCurve(YieldCurveType::Discount, "EUR"), yieldCurve(YieldCurveType::EquityDividend, "Lufthansa")));
294
295 swaptionIndexBases_[make_pair(Market::defaultConfiguration, "EUR")] = std::make_pair("EUR-CMS-2Y", "EUR-CMS-30Y");
296 swaptionIndexBases_[make_pair(Market::defaultConfiguration, "USD")] = std::make_pair("USD-CMS-2Y", "USD-CMS-30Y");
297 swaptionIndexBases_[make_pair(Market::defaultConfiguration, "GBP")] = std::make_pair("GBP-CMS-2Y", "GBP-CMS-30Y");
298 swaptionIndexBases_[make_pair(Market::defaultConfiguration, "CHF")] = std::make_pair("CHF-CMS-2Y", "CHF-CMS-30Y");
299 swaptionIndexBases_[make_pair(Market::defaultConfiguration, "JPY")] = std::make_pair("JPY-CMS-2Y", "JPY-CMS-30Y");
300
301 // build swaption vols
302
303 if (swapVolCube) {
304 vector<Real> shiftStrikes = {-0.02, -0.01, -0.005, -0.0025, 0.0, 0.0025, 0.005, 0.01, 0.02};
305 vector<Period> optionTenors = {2 * Weeks, 1 * Months, 3 * Months, 6 * Months, 1 * Years, 2 * Years,
306 3 * Years, 5 * Years, 10 * Years, 15 * Years, 20 * Years, 30 * Years};
307 vector<Period> swapTenors = {1 * Years, 2 * Years, 3 * Years, 4 * Years, 5 * Years,
308 7 * Years, 10 * Years, 15 * Years, 20 * Years, 30 * Years};
309 DayCounter dc = Actual365Fixed();
310 Calendar cal = TARGET();
311 BusinessDayConvention bdc = Following;
312 vector<vector<Handle<Quote>>> parQuotes(
313 optionTenors.size(),
314 vector<Handle<Quote>>(swapTenors.size(), Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.02))));
315
316 vector<vector<Real>> shift(optionTenors.size(), vector<Real>(swapTenors.size(), 0.0));
317 vector<string> ccys = {"USD", "JPY"};
318 QuantLib::ext::shared_ptr<SwaptionVolatilityStructure> atm(new SwaptionVolatilityMatrix(
319 asof_, cal, bdc, optionTenors, swapTenors, parQuotes, dc, true, QuantLib::Normal, shift));
320
321 Handle<SwaptionVolatilityStructure> hATM(atm);
322 vector<vector<Handle<Quote>>> cubeQuotes(
323 optionTenors.size() * swapTenors.size(),
324 vector<Handle<Quote>>(shiftStrikes.size(), Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.02))));
325
326 for (auto name : ccys) {
327 Handle<SwapIndex> si = swapIndex(swapIndexBase(name));
328 Handle<SwapIndex> ssi = swapIndex(shortSwapIndexBase(name));
329
330 QuantLib::ext::shared_ptr<SwaptionVolatilityCube> tmp(new QuantExt::SwaptionVolCube2(
331 hATM, optionTenors, swapTenors, shiftStrikes, cubeQuotes, *si, *ssi, false, true, false));
332 tmp->enableExtrapolation();
333
334 Handle<SwaptionVolatilityStructure> svp =
335 Handle<SwaptionVolatilityStructure>(QuantLib::ext::make_shared<SwaptionVolCubeWithATM>(tmp));
336 swaptionCurves_[make_pair(Market::defaultConfiguration, name)] = svp;
337 }
338
339 } else {
345 }
346
347 // build cap/floor vol structures
348 capFloorCurves_[make_pair(Market::defaultConfiguration, "EUR")] = flatRateCvs(0.0050, Normal);
349 capFloorCurves_[make_pair(Market::defaultConfiguration, "USD")] = flatRateCvs(0.0060, Normal);
350 capFloorCurves_[make_pair(Market::defaultConfiguration, "GBP")] = flatRateCvs(0.0055, Normal);
351 capFloorCurves_[make_pair(Market::defaultConfiguration, "CHF")] = flatRateCvs(0.0045, Normal);
352 capFloorCurves_[make_pair(Market::defaultConfiguration, "JPY")] = flatRateCvs(0.0040, Normal);
353
354 // build default curves
357 defaultCurves_[make_pair(Market::defaultConfiguration, "BondIssuer0")] = flatRateDcs(0.0);
358 defaultCurves_[make_pair(Market::defaultConfiguration, "BondIssuer1")] = flatRateDcs(0.0);
359
360 recoveryRates_[make_pair(Market::defaultConfiguration, "dc")] = Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.4));
362 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.4));
363 recoveryRates_[make_pair(Market::defaultConfiguration, "BondIssuer0")] =
364 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.0));
365 recoveryRates_[make_pair(Market::defaultConfiguration, "BondIssuer1")] =
366 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.4));
367
368 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Yield, "BondCurve0")] = flatRateYts(0.05);
369 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Yield, "BondCurve1")] = flatRateYts(0.05);
370
372 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.0));
374 Handle<Quote>(QuantLib::ext::make_shared<SimpleQuote>(0.0));
375
376 cdsVols_[make_pair(Market::defaultConfiguration, "dc")] =
377 Handle<QuantExt::CreditVolCurve>(QuantLib::ext::make_shared<QuantExt::CreditVolCurveWrapper>(flatRateFxv(0.12)));
378
379 Handle<IborIndex> hGBP(ore::data::parseIborIndex(
380 "GBP-LIBOR-6M", yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "GBP")]));
381 // FIXME: We have defined that above already
382 iborIndices_[make_pair(Market::defaultConfiguration, "GBP-LIBOR-6M")] = hGBP;
383
384 // Some test cases need a different definition of UKRPI index, curve and vol structure
385 // We there fore added the new UKROi as UKRP1 and keep the "original" below.
386
387 // build inflation indices
388 auto zeroIndex = Handle<ZeroInflationIndex>(QuantLib::ext::make_shared<UKRPI>(true, flatZeroInflationCurve(0.02, 0.01)));
389 zeroInflationIndices_[make_pair(Market::defaultConfiguration, "UKRP1")] = zeroIndex;
390 yoyInflationIndices_[make_pair(Market::defaultConfiguration, "UKRP1")] = Handle<YoYInflationIndex>(
391 QuantLib::ext::make_shared<QuantExt::YoYInflationIndexWrapper>(*zeroIndex, false, flatYoYInflationCurve(0.02, 0.01)));
392
393 // build inflation cap / floor vol curves
396
397 // build UKRPI fixing history
398 Date cpiFixingEnd(1, asof_.month(), asof_.year());
399 Date cpiFixingStart = cpiFixingEnd - Period(14, Months);
400 Schedule fixingDatesUKRPI = MakeSchedule().from(cpiFixingStart).to(cpiFixingEnd).withTenor(1 * Months);
401 Real fixingRatesUKRPI[] = {258.5, 258.9, 258.6, 259.8, 259.6, 259.5, 259.8, 260.6,
402 258.8, 260.0, 261.1, 261.4, 262.1, 264.3, 265.2};
403
404 // build UKRPI index
405 QuantLib::ext::shared_ptr<ZeroInflationIndex> ii = parseZeroInflationIndex("UKRPI");
406 QuantLib::ext::shared_ptr<YoYInflationIndex> yi = QuantLib::ext::make_shared<QuantExt::YoYInflationIndexWrapper>(ii, false);
407
408 RelinkableHandle<ZeroInflationTermStructure> hcpi;
409 ii = QuantLib::ext::shared_ptr<UKRPI>(new UKRPI(hcpi));
410 for (Size i = 0; i < fixingDatesUKRPI.size(); i++) {
411 // std::cout << i << ", " << fixingDatesUKRPI[i] << ", " << fixingRatesUKRPI[i] << std::endl;
412 ii->addFixing(fixingDatesUKRPI[i], fixingRatesUKRPI[i], true);
413 };
414
415 // build EUHICPXT fixing history
416 Schedule fixingDatesEUHICPXT = MakeSchedule().from(cpiFixingStart).to(cpiFixingEnd).withTenor(1 * Months);
417 Real fixingRatesEUHICPXT[] = {258.5, 258.9, 258.6, 259.8, 259.6, 259.5, 259.8, 260.6,
418 258.8, 260.0, 261.1, 261.4, 262.1, 264.3, 265.2};
419
420 // build EUHICPXT index
421 QuantLib::ext::shared_ptr<ZeroInflationIndex> euii = parseZeroInflationIndex("EUHICPXT");
422 QuantLib::ext::shared_ptr<YoYInflationIndex> euyi = QuantLib::ext::make_shared<QuantExt::YoYInflationIndexWrapper>(euii, false);
423
424 RelinkableHandle<ZeroInflationTermStructure> euhcpi;
425 euii = QuantLib::ext::shared_ptr<EUHICPXT>(new EUHICPXT(euhcpi));
426 for (Size i = 0; i < fixingDatesEUHICPXT.size(); i++) {
427 euii->addFixing(fixingDatesEUHICPXT[i], fixingRatesEUHICPXT[i], true);
428 };
429
430 vector<Date> datesZCII = {asof_,
431 asof_ + 1 * Years,
432 asof_ + 2 * Years,
433 asof_ + 3 * Years,
434 asof_ + 4 * Years,
435 asof_ + 5 * Years,
436 asof_ + 6 * Years,
437 asof_ + 7 * Years,
438 asof_ + 8 * Years,
439 asof_ + 9 * Years,
440 asof_ + 10 * Years,
441 asof_ + 12 * Years,
442 asof_ + 15 * Years,
443 asof_ + 20 * Years};
444
445 vector<Rate> ratesZCII = {2.825, 2.9425, 2.975, 2.983, 3.0, 3.01, 3.008,
446 3.009, 3.013, 3.0445, 3.044, 3.09, 3.109, 3.108};
447
449 makeZeroInflationIndex("EUHICPXT", datesZCII, ratesZCII, euii,
450 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "EUR")]);
452 makeZeroInflationIndex("UKRPI", datesZCII, ratesZCII, ii,
453 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "GBP")]);
454
456 makeYoYInflationIndex("UKRPI", datesZCII, ratesZCII, yi,
457 yieldCurves_[make_tuple(Market::defaultConfiguration, YieldCurveType::Discount, "GBP")]);
458
460 flatCpiVolSurface(0.05);
462
463 // Commodity price curves and spots
464 Actual365Fixed ccDayCounter;
465 vector<Period> commTenors = {0 * Days, 365 * Days, 730 * Days, 1825 * Days};
466
467 // Gold curve
468 vector<Real> prices = {1155.593, 1160.9, 1168.1, 1210};
469 Handle<PriceTermStructure> ptsGold(QuantLib::ext::make_shared<InterpolatedPriceCurve<Linear>>(
470 commTenors, prices, ccDayCounter, USDCurrency()));
471 ptsGold->enableExtrapolation();
472 commodityIndices_[make_pair(Market::defaultConfiguration, "COMDTY_GOLD_USD")] = Handle<CommodityIndex>(
473 QuantLib::ext::make_shared<CommoditySpotIndex>("COMDTY_GOLD_USD", NullCalendar(), ptsGold));
474
475 // WTI Oil curve
476 prices = {30.89, 41.23, 44.44, 49.18};
477 Handle<PriceTermStructure> ptsOil(QuantLib::ext::make_shared<InterpolatedPriceCurve<Linear>>(
478 commTenors, prices, ccDayCounter, USDCurrency()));
479 ptsOil->enableExtrapolation();
480 commodityIndices_[make_pair(Market::defaultConfiguration, "COMDTY_WTI_USD")] = Handle<CommodityIndex>(
481 QuantLib::ext::make_shared<CommoditySpotIndex>("COMDTY_WTI_USD", NullCalendar(), ptsOil));
482
483 // Commodity volatilities
484 commodityVols_[make_pair(Market::defaultConfiguration, "COMDTY_GOLD_USD")] = flatRateFxv(0.15);
485 commodityVols_[make_pair(Market::defaultConfiguration, "COMDTY_WTI_USD")] = flatRateFxv(0.20);
486
487 // Correlations
488 correlationCurves_[make_tuple(Market::defaultConfiguration, "EUR-CMS-10Y", "EUR-CMS-1Y")] = flatCorrelation(0.15);
489 correlationCurves_[make_tuple(Market::defaultConfiguration, "USD-CMS-10Y", "USD-CMS-1Y")] = flatCorrelation(0.2);
490}
static const string defaultConfiguration
map< pair< string, string >, Handle< OptionletVolatilityStructure > > capFloorCurves_
string shortSwapIndexBase(const string &key, const string &configuration=Market::defaultConfiguration) const override
string swapIndexBase(const string &key, const string &configuration=Market::defaultConfiguration) const override
map< tuple< string, string, string >, Handle< QuantExt::CorrelationTermStructure > > correlationCurves_
map< pair< string, string >, QuantLib::Handle< QuantExt::EquityIndex2 > > equityCurves_
map< pair< string, string >, Handle< CPIVolatilitySurface > > cpiInflationCapFloorVolatilitySurfaces_
map< pair< string, string >, Handle< BlackVolTermStructure > > fxVols_
QuantLib::ext::shared_ptr< FXTriangulation > fx_
map< tuple< string, YieldCurveType, string >, Handle< YieldTermStructure > > yieldCurves_
map< pair< string, string >, QuantLib::Handle< QuantExt::CommodityIndex > > commodityIndices_
map< pair< string, string >, Handle< QuantExt::CreditCurve > > defaultCurves_
map< pair< string, string >, Handle< IborIndex > > iborIndices_
map< pair< string, string >, Handle< YoYOptionletVolatilitySurface > > yoyCapFloorVolSurfaces_
map< pair< string, string >, Handle< YoYInflationIndex > > yoyInflationIndices_
map< pair< string, string >, Handle< QuantExt::CreditVolCurve > > cdsVols_
map< pair< string, string >, Handle< Quote > > equitySpots_
map< pair< string, string >, Handle< QuantLib::SwaptionVolatilityStructure > > swaptionCurves_
map< pair< string, string >, Handle< Quote > > recoveryRates_
Handle< Quote > equitySpot(const string &eqName, const string &configuration=Market::defaultConfiguration) const override
map< pair< string, string >, Handle< ZeroInflationIndex > > zeroInflationIndices_
Handle< SwapIndex > swapIndex(const string &indexName, const string &configuration=Market::defaultConfiguration) const override
map< pair< string, string >, pair< string, string > > swaptionIndexBases_
map< pair< string, string >, Handle< BlackVolTermStructure > > equityVols_
map< pair< string, string >, Handle< Quote > > securitySpreads_
Handle< YieldTermStructure > yieldCurve(const YieldCurveType &type, const string &ccy, const string &configuration=Market::defaultConfiguration) const override
map< pair< string, string >, QuantLib::Handle< QuantLib::BlackVolTermStructure > > commodityVols_
void addSwapIndex(const string &swapindex, const string &discountIndex, const string &configuration=Market::defaultConfiguration) const
static void setConventions()
Set Conventions.
Handle< YoYInflationIndex > makeYoYInflationIndex(string index, vector< Date > dates, vector< Rate > rates, QuantLib::ext::shared_ptr< YoYInflationIndex > ii, Handle< YieldTermStructure > yts)
Definition: testmarket.cpp:588
Handle< YoYInflationTermStructure > flatYoYInflationCurve(Real inflationRate, Rate nominalRate)
Definition: testmarket.cpp:626
Handle< YoYOptionletVolatilitySurface > flatYoYOptionletVolatilitySurface(Real normalVol)
Definition: testmarket.cpp:639
Handle< OptionletVolatilityStructure > flatRateCvs(Volatility vol, VolatilityType type=Normal, Real shift=0.0)
Definition: testmarket.cpp:524
Handle< ZeroInflationIndex > makeZeroInflationIndex(string index, vector< Date > dates, vector< Rate > rates, QuantLib::ext::shared_ptr< ZeroInflationIndex > ii, Handle< YieldTermStructure > yts)
Definition: testmarket.cpp:561
Handle< QuantLib::CPIVolatilitySurface > flatCpiVolSurface(Volatility v)
Definition: testmarket.cpp:548
Handle< QuantExt::CreditCurve > flatRateDcs(Volatility forward)
Definition: testmarket.cpp:518
Handle< QuantExt::CorrelationTermStructure > flatCorrelation(Real correlation=0.0)
Definition: testmarket.cpp:531
Handle< ZeroInflationTermStructure > flatZeroInflationCurve(Real inflationRate, Rate nominalRate)
Definition: testmarket.cpp:613
Handle< YieldTermStructure > flatRateYts(Real forward)
Definition: testmarket.cpp:492
Handle< BlackVolTermStructure > flatRateFxv(Volatility forward)
Definition: testmarket.cpp:498
Handle< QuantLib::SwaptionVolatilityStructure > flatRateSvs(Volatility forward, VolatilityType type=ShiftedLognormal, Real shift=0.0)
Definition: testmarket.cpp:511
Handle< YieldTermStructure > flatRateDiv(Real dividend)
Definition: testmarket.cpp:504
QuantLib::ext::shared_ptr< ZeroInflationIndex > parseZeroInflationIndex(const string &s, const Handle< ZeroInflationTermStructure > &h=Handle< ZeroInflationTermStructure >())
QuantLib::ext::shared_ptr< IborIndex > parseIborIndex(const string &s, const Handle< YieldTermStructure > &h=Handle< YieldTermStructure >())
Currency parseCurrency(const string &s)
Date asof(14, Jun, 2018)
+ Here is the call graph for this function:

Member Function Documentation

◆ flatRateYts()

Handle< YieldTermStructure > flatRateYts ( Real  forward)
private

Definition at line 492 of file testmarket.cpp.

492 {
493 QuantLib::ext::shared_ptr<YieldTermStructure> yts(
494 new FlatForward(Settings::instance().evaluationDate(), forward, ActualActual(ActualActual::ISDA)));
495 return Handle<YieldTermStructure>(yts);
496}
+ Here is the caller graph for this function:

◆ flatRateFxv()

Handle< BlackVolTermStructure > flatRateFxv ( Volatility  forward)
private

Definition at line 498 of file testmarket.cpp.

498 {
499 QuantLib::ext::shared_ptr<BlackVolTermStructure> fxv(
500 new BlackConstantVol(Settings::instance().evaluationDate(), NullCalendar(), forward, ActualActual(ActualActual::ISDA)));
501 return Handle<BlackVolTermStructure>(fxv);
502}
+ Here is the caller graph for this function:

◆ flatRateDiv()

Handle< YieldTermStructure > flatRateDiv ( Real  dividend)
private

Definition at line 504 of file testmarket.cpp.

504 {
505 QuantLib::ext::shared_ptr<YieldTermStructure> yts(
506 new FlatForward(Settings::instance().evaluationDate(), dividend, ActualActual(ActualActual::ISDA)));
507 return Handle<YieldTermStructure>(yts);
508}
+ Here is the caller graph for this function:

◆ flatRateSvs()

Handle< QuantLib::SwaptionVolatilityStructure > flatRateSvs ( Volatility  forward,
VolatilityType  type = ShiftedLognormal,
Real  shift = 0.0 
)
private

Definition at line 511 of file testmarket.cpp.

511 {
512 QuantLib::ext::shared_ptr<QuantLib::SwaptionVolatilityStructure> svs(
513 new QuantLib::ConstantSwaptionVolatility(Settings::instance().evaluationDate(), NullCalendar(),
514 ModifiedFollowing, forward, ActualActual(ActualActual::ISDA), type, shift));
515 return Handle<QuantLib::SwaptionVolatilityStructure>(svs);
516}
+ Here is the caller graph for this function:

◆ flatRateDcs()

Handle< QuantExt::CreditCurve > flatRateDcs ( Volatility  forward)
private

Definition at line 518 of file testmarket.cpp.

518 {
519 QuantLib::ext::shared_ptr<DefaultProbabilityTermStructure> dcs(
520 new FlatHazardRate(asof_, forward, ActualActual(ActualActual::ISDA)));
521 return Handle<QuantExt::CreditCurve>(QuantLib::ext::make_shared<QuantExt::CreditCurve>(Handle<DefaultProbabilityTermStructure>(dcs)));
522}
+ Here is the caller graph for this function:

◆ flatRateCvs()

Handle< OptionletVolatilityStructure > flatRateCvs ( Volatility  vol,
VolatilityType  type = Normal,
Real  shift = 0.0 
)
private

Definition at line 524 of file testmarket.cpp.

524 {
525 QuantLib::ext::shared_ptr<OptionletVolatilityStructure> ts(
526 new QuantLib::ConstantOptionletVolatility(Settings::instance().evaluationDate(), NullCalendar(),
527 ModifiedFollowing, vol, ActualActual(ActualActual::ISDA), type, shift));
528 return Handle<OptionletVolatilityStructure>(ts);
529}
+ Here is the caller graph for this function:

◆ flatCorrelation()

Handle< QuantExt::CorrelationTermStructure > flatCorrelation ( Real  correlation = 0.0)
private

Definition at line 531 of file testmarket.cpp.

531 {
532 QuantLib::ext::shared_ptr<QuantExt::CorrelationTermStructure> ts(
533 new QuantExt::FlatCorrelation(Settings::instance().evaluationDate(), correlation, ActualActual(ActualActual::ISDA)));
534 return Handle<QuantExt::CorrelationTermStructure>(ts);
535}
+ Here is the caller graph for this function:

◆ flatRateCps()

Handle< CPICapFloorTermPriceSurface > flatRateCps ( Handle< ZeroInflationIndex >  infIndex,
const std::vector< Rate >  cStrikes,
std::vector< Rate >  fStrikes,
std::vector< Period >  cfMaturities,
Matrix  cPrice,
Matrix  fPrice 
)
private

Definition at line 537 of file testmarket.cpp.

539 {
540 QuantLib::ext::shared_ptr<CPICapFloorTermPriceSurface> ts(
541 new InterpolatedCPICapFloorTermPriceSurface<QuantLib::Bilinear>(
542 1.0, 0.0, infIndex->availabilityLag(), infIndex->zeroInflationTermStructure()->calendar(), Following,
543 ActualActual(ActualActual::ISDA), infIndex.currentLink(), CPI::AsIndex, discountCurve(infIndex->currency().code()), cStrikes, fStrikes, cfMaturities,
544 cPrice, fPrice));
545 return Handle<CPICapFloorTermPriceSurface>(ts);
546}
Handle< YieldTermStructure > discountCurve(const string &ccy, const string &configuration=Market::defaultConfiguration) const
+ Here is the call graph for this function:

◆ flatCpiVolSurface()

Handle< QuantLib::CPIVolatilitySurface > flatCpiVolSurface ( Volatility  v)
private

Definition at line 548 of file testmarket.cpp.

548 {
549 Natural settleDays = 0;
550 Calendar cal = TARGET();
551 BusinessDayConvention bdc = Following;
552 DayCounter dc = Actual365Fixed();
553 Period lag = 2 * Months;
554 Frequency freq = Annual;
555 bool interp = false;
556 QuantLib::ext::shared_ptr<QuantLib::ConstantCPIVolatility> cpiCapFloorVolSurface =
557 QuantLib::ext::make_shared<QuantLib::ConstantCPIVolatility>(v, settleDays, cal, bdc, dc, lag, freq, interp);
558 return Handle<QuantLib::CPIVolatilitySurface>(cpiCapFloorVolSurface);
559}
+ Here is the caller graph for this function:

◆ makeZeroInflationIndex()

Handle< ZeroInflationIndex > makeZeroInflationIndex ( string  index,
vector< Date >  dates,
vector< Rate >  rates,
QuantLib::ext::shared_ptr< ZeroInflationIndex >  ii,
Handle< YieldTermStructure >  yts 
)
private

Definition at line 561 of file testmarket.cpp.

563 {
564 // build UKRPI index
565 QuantLib::ext::shared_ptr<ZeroInflationTermStructure> cpiTS;
566 // now build the helpers ...
567 vector<QuantLib::ext::shared_ptr<BootstrapHelper<ZeroInflationTermStructure>>> instruments;
568 for (Size i = 0; i < dates.size(); i++) {
569 Handle<Quote> quote(QuantLib::ext::shared_ptr<Quote>(new SimpleQuote(rates[i] / 100.0)));
570 QuantLib::ext::shared_ptr<BootstrapHelper<ZeroInflationTermStructure>> anInstrument(new ZeroCouponInflationSwapHelper(
571 quote, Period(2, Months), dates[i], TARGET(), ModifiedFollowing, ActualActual(ActualActual::ISDA), ii, CPI::AsIndex, yts));
572 anInstrument->unregisterWith(Settings::instance().evaluationDate());
573 instruments.push_back(anInstrument);
574 };
575 // we can use historical or first ZCIIS for this
576 // we know historical is WAY off market-implied, so use market implied flat.
577 Rate baseZeroRate = rates[0] / 100.0;
578 QuantLib::ext::shared_ptr<PiecewiseZeroInflationCurve<Linear>> pCPIts(
579 new PiecewiseZeroInflationCurve<Linear>(asof_, TARGET(), ActualActual(ActualActual::ISDA), Period(2, Months), ii->frequency(),
580 baseZeroRate, instruments));
581 pCPIts->recalculate();
582 cpiTS = QuantLib::ext::dynamic_pointer_cast<ZeroInflationTermStructure>(pCPIts);
583 cpiTS->enableExtrapolation(true);
584 cpiTS->unregisterWith(Settings::instance().evaluationDate());
585 return Handle<ZeroInflationIndex>(parseZeroInflationIndex(index, Handle<ZeroInflationTermStructure>(cpiTS)));
586}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ makeYoYInflationIndex()

Handle< YoYInflationIndex > makeYoYInflationIndex ( string  index,
vector< Date >  dates,
vector< Rate >  rates,
QuantLib::ext::shared_ptr< YoYInflationIndex >  ii,
Handle< YieldTermStructure >  yts 
)
private

Definition at line 588 of file testmarket.cpp.

590 {
591 // build UKRPI index
592 QuantLib::ext::shared_ptr<YoYInflationTermStructure> yoyTS;
593 // now build the helpers ...
594 vector<QuantLib::ext::shared_ptr<BootstrapHelper<YoYInflationTermStructure>>> instruments;
595 for (Size i = 0; i < dates.size(); i++) {
596 Handle<Quote> quote(QuantLib::ext::shared_ptr<Quote>(new SimpleQuote(rates[i] / 100.0)));
597 QuantLib::ext::shared_ptr<BootstrapHelper<YoYInflationTermStructure>> anInstrument(new YearOnYearInflationSwapHelper(
598 quote, Period(2, Months), dates[i], TARGET(), ModifiedFollowing, ActualActual(ActualActual::ISDA), ii, yts));
599 instruments.push_back(anInstrument);
600 };
601 // we can use historical or first ZCIIS for this
602 // we know historical is WAY off market-implied, so use market implied flat.
603 Rate baseZeroRate = rates[0] / 100.0;
604 QuantLib::ext::shared_ptr<PiecewiseYoYInflationCurve<Linear>> pYoYts(
605 new PiecewiseYoYInflationCurve<Linear>(asof_, TARGET(), ActualActual(ActualActual::ISDA), Period(2, Months), ii->frequency(),
606 ii->interpolated(), baseZeroRate, instruments));
607 pYoYts->recalculate();
608 yoyTS = QuantLib::ext::dynamic_pointer_cast<YoYInflationTermStructure>(pYoYts);
609 return Handle<YoYInflationIndex>(QuantLib::ext::make_shared<QuantExt::YoYInflationIndexWrapper>(
610 parseZeroInflationIndex(index), false, Handle<YoYInflationTermStructure>(pYoYts)));
611}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flatZeroInflationCurve()

Handle< ZeroInflationTermStructure > flatZeroInflationCurve ( Real  inflationRate,
Rate  nominalRate 
)
private

Definition at line 613 of file testmarket.cpp.

613 {
614 Date today = Settings::instance().evaluationDate();
615 Period lag = 2 * Months;
616 std::vector<Date> dates;
617 dates.push_back(today - lag);
618 dates.push_back(today + 1 * Years);
619 std::vector<Real> rates(dates.size(), inflationRate);
620 auto curve = QuantLib::ext::make_shared<QuantLib::InterpolatedZeroInflationCurve<Linear>>(
621 today, NullCalendar(), QuantLib::ActualActual(ActualActual::ISDA), 2 * Months, Monthly, dates, rates);
622 curve->enableExtrapolation();
623 return Handle<ZeroInflationTermStructure>(curve);
624}
+ Here is the caller graph for this function:

◆ flatYoYInflationCurve()

Handle< YoYInflationTermStructure > flatYoYInflationCurve ( Real  inflationRate,
Rate  nominalRate 
)
private

Definition at line 626 of file testmarket.cpp.

626 {
627 Date today = Settings::instance().evaluationDate();
628 Period lag = 2 * Months;
629 std::vector<Date> dates;
630 dates.push_back(today - lag);
631 dates.push_back(today + 1 * Years);
632 std::vector<Real> rates(dates.size(), inflationRate);
633 auto curve = QuantLib::ext::make_shared<QuantLib::InterpolatedYoYInflationCurve<Linear>>(
634 today, NullCalendar(), QuantLib::ActualActual(ActualActual::ISDA), 2 * Months, Monthly, false, dates, rates);
635 curve->enableExtrapolation();
636 return Handle<YoYInflationTermStructure>(curve);
637}
+ Here is the caller graph for this function:

◆ flatYoYOptionletVolatilitySurface()

Handle< YoYOptionletVolatilitySurface > flatYoYOptionletVolatilitySurface ( Real  normalVol)
private

Definition at line 639 of file testmarket.cpp.

639 {
640 auto qlTs = QuantLib::ext::make_shared<ConstantYoYOptionletVolatility>(
641 normalVol, 0, NullCalendar(), Unadjusted, ActualActual(ActualActual::ISDA), 2 * Months, Monthly, false, -1.0, 100.0, Normal);
642 return Handle<YoYOptionletVolatilitySurface>(qlTs);
643}
+ Here is the caller graph for this function: