34 const QuantLib::Date&
asof,
35 const QuantLib::ext::shared_ptr<ore::analytics::ScenarioSimMarketParameters>& simMarketParams,
37 const std::set<ore::analytics::RiskFactorKey::KeyType>& typesDisabled,
38 const std::set<ore::analytics::RiskFactorKey::KeyType>& parTypes,
39 const std::set<ore::analytics::RiskFactorKey>& relevantRiskFactors,
const bool continueOnError,
40 const std::string& marketConfiguration,
const QuantLib::ext::shared_ptr<ScenarioSimMarket>& simMarket)
41 : simMarket_(simMarket) {
43 typesDisabled, parTypes, relevantRiskFactors,
44 continueOnError, marketConfiguration, simMarket);
48 const QuantLib::ext::shared_ptr<ScenarioSimMarket>& simMarket)
49 : instruments_(instruments_), simMarket_(simMarket) {
50 QL_REQUIRE(
simMarket_ !=
nullptr,
"ZeroToParShiftConverter: need a simmarket");
55 it.second->deepUpdate();
57 it.second->deepUpdate();
59 it.second->deepUpdate();
64class SimMarketReseter {
66 SimMarketReseter(
const ext::shared_ptr<ScenarioSimMarket>& simMarket) : simMarket_(simMarket) {
69 ~SimMarketReseter() { simMarket_->reset(); }
70 const ext::shared_ptr<ScenarioSimMarket>& market()
const {
return simMarket_; }
73 ext::shared_ptr<ScenarioSimMarket> simMarket_;
76std::unordered_map<RiskFactorKey, double>
78 QL_REQUIRE(
simMarket_ !=
nullptr,
"ZeroToParShiftConverter: need a simmarket");
81 market.market()->applyScenario(scenario);
85 it.second->deepUpdate();
87 it.second->deepUpdate();
89 it.second->deepUpdate();
94 QL_REQUIRE(
baseValues_.size() == scenarioValues.size(),
95 "ZeroToParShiftConverter: internal error, both maps should have the same entries");
97 [](
const auto& a,
const auto& b) { return a.first == b.first; });
98 QL_REQUIRE(sameKeys,
"ZeroToParShiftConverter: internal error, both maps should have the same entries");
99 std::unordered_map<RiskFactorKey, double> shifts;
101 shifts[key] = scenarioValues[key] - amount;
107 std::unordered_map<RiskFactorKey, double> results;
void createParInstruments(ParSensitivityInstrumentBuilder::Instruments &instruments, const QuantLib::Date &asof, const QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarketParameters > &simMarketParams, const ore::analytics::SensitivityScenarioData &sensitivityData, const std::set< ore::analytics::RiskFactorKey::KeyType > &typesDisabled={}, const std::set< ore::analytics::RiskFactorKey::KeyType > &parTypes={}, const std::set< ore::analytics::RiskFactorKey > &relevantRiskFactors={}, const bool continueOnError=false, const std::string &marketConfiguration=ore::data::Market::defaultConfiguration, const QuantLib::ext::shared_ptr< ore::analytics::Market > &simMarket=nullptr) const
Create par QuantLib::Instruments.
Description of sensitivity shift scenarios.
ZeroToParShiftConverter(const QuantLib::Date &asof, const QuantLib::ext::shared_ptr< ore::analytics::ScenarioSimMarketParameters > &simMarketParams, const ore::analytics::SensitivityScenarioData &sensitivityData, const std::set< ore::analytics::RiskFactorKey::KeyType > &typesDisabled, const std::set< ore::analytics::RiskFactorKey::KeyType > &parTypes, const std::set< ore::analytics::RiskFactorKey > &relevantRiskFactors, const bool continueOnError, const std::string &marketConfiguration, const QuantLib::ext::shared_ptr< ScenarioSimMarket > &simMarket)
std::unordered_map< RiskFactorKey, double > parRates() const
ext::shared_ptr< ScenarioSimMarket > simMarket_
std::unordered_map< RiskFactorKey, double > parShifts(QuantLib::ext::shared_ptr< Scenario > scenario) const
ParSensitivityInstrumentBuilder::Instruments instruments_
std::unordered_map< RiskFactorKey, double > baseValues_
Volatility impliedVolatility(const QuantLib::CapFloor &cap, Real targetValue, const Handle< YieldTermStructure > &d, Volatility guess, VolatilityType type, Real displacement)
Real impliedQuote(const QuantLib::ext::shared_ptr< Instrument > &i)
Singleton class to hold global Observation Mode.
std::map< ore::analytics::RiskFactorKey, QuantLib::ext::shared_ptr< QuantLib::Instrument > > parHelpers_
par helpers (all except cap/floors)
std::map< ore::analytics::RiskFactorKey, QuantLib::ext::shared_ptr< QuantLib::CapFloor > > parCaps_
par helpers: IR cap / floors
std::map< ore::analytics::RiskFactorKey, QuantLib::ext::shared_ptr< QuantLib::YoYInflationCapFloor > > parYoYCaps_
applies a zero scenario and return the par instrument shifts