Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
currencyhedgedequityindexdecomposition.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2023 Quaternion Risk Management Ltd.
3 All rights reserved.
4*/
5
6/*! \file ored/utilities/currencyhedgedequityindexdecomposition.hpp
7 \brief Helper function used for the index decompositon
8 */
9
12#include <ql/time/date.hpp>
13
14#pragma once
15
16namespace ore {
17namespace data {
18
19
20
22public:
24 const std::string indexName,
25 const QuantLib::ext::shared_ptr<ore::data::CurrencyHedgedEquityIndexReferenceDatum>& indexRefData,
26 const QuantLib::ext::shared_ptr<ore::data::EquityIndexReferenceDatum> underlyingRefData,
27 const std::string& indexCurrency, const std::string& underlyingIndexCurrency, const std::string& fxIndexName,
28 const std::map<std::string, std::pair<double, std::string>>& currencyWeightsAndFxIndexNames)
32 QL_REQUIRE(indexRefData_, "CurrencyHedgedDecomposition requires a valid indexRefData");
33 QL_REQUIRE(underlyingRefData_, "CurrencyHedgedDecomposition requires a valid underlyingRefData");
34 QL_REQUIRE(!indexCurrency_.empty(), "CurrencyHedgedDecomposition requires the currency of the index");
35 QL_REQUIRE(!underlyingIndexCurrency_.empty(), "CurrencyHedgedDecomposition requires the currency of the underlying index");
36 QL_REQUIRE(!fxIndexName_.empty(),
37 "CurrencyHedgedDecomposition requires the FXIndex name to convert underlyingIndexCurrency to IndexCurrency");
38 }
39
40 const std::string& indexName() const { return name_; }
41
42 const std::string& underlyingIndexName() const { return underlyingRefData_->id(); }
43
44 const std::string& indexCurrency() const { return indexCurrency_; }
45
46 const std::string& underlyingIndexCurrency() const { return underlyingIndexCurrency_; }
47
48 const std::string& fxIndexName() const { return fxIndexName_; }
49
51
52 QuantLib::Date referenceDate(const QuantLib::Date& asof) const;
53
54 QuantLib::Date rebalancingDate(const QuantLib::Date& asof) const;
55
56 static QuantLib::Date referenceDate(const QuantLib::ext::shared_ptr<CurrencyHedgedEquityIndexReferenceDatum>& refData,
57 const QuantLib::Date& asof);
58
59 static QuantLib::Date rebalancingDate(const QuantLib::ext::shared_ptr<CurrencyHedgedEquityIndexReferenceDatum>& refData,
60 const QuantLib::Date& asof);
61
62 const std::map<std::string, std::pair<double, std::string>>& currencyWeightsAndFxIndexNames() const {
64 }
65
66 std::map<std::string, double> fxSpotRiskFromForwards(
67 const double quantity, const QuantLib::Date& asof,
68 const QuantLib::ext::shared_ptr<ore::data::Market>& todaysMarket, const double shiftsize) const;
69
70 double unhedgedSpotExposure(double hedgedExposure, const double quantity, const QuantLib::Date& asof,
71 const QuantLib::ext::shared_ptr<ore::data::Market>& todaysMarket) const;
72
73 QuantLib::ext::shared_ptr<ore::data::EquityIndexReferenceDatum> underlyingRefData() const { return underlyingRefData_; }
74
75 QuantLib::ext::shared_ptr<ore::data::CurrencyHedgedEquityIndexReferenceDatum> indexRefData() const { return indexRefData_; }
76
77 void
78 addAdditionalFixingsForEquityIndexDecomposition(const QuantLib::Date& asof,
79 std::map<std::string, RequiredFixings::FixingDates>& fixings) const;
80
81private:
82 std::string name_;
83 QuantLib::ext::shared_ptr<ore::data::CurrencyHedgedEquityIndexReferenceDatum> indexRefData_;
84 QuantLib::ext::shared_ptr<ore::data::EquityIndexReferenceDatum> underlyingRefData_;
85 std::string indexCurrency_;
87 std::string fxIndexName_;
88 std::map<std::string, std::pair<double, std::string>> currencyWeightsAndFxIndexNames_;
89};
90
91QuantLib::ext::shared_ptr<CurrencyHedgedEquityIndexDecomposition>
93 const QuantLib::ext::shared_ptr<ore::data::ReferenceDataManager>& refDataMgr,
94 const QuantLib::ext::shared_ptr<ore::data::CurveConfigurations>& curveConfigs);
95
96} // namespace data
97} // namespace ore
QuantLib::ext::shared_ptr< ore::data::EquityIndexReferenceDatum > underlyingRefData() const
double unhedgedSpotExposure(double hedgedExposure, const double quantity, const QuantLib::Date &asof, const QuantLib::ext::shared_ptr< ore::data::Market > &todaysMarket) const
std::map< std::string, std::pair< double, std::string > > currencyWeightsAndFxIndexNames_
QuantLib::ext::shared_ptr< ore::data::CurrencyHedgedEquityIndexReferenceDatum > indexRefData() const
const std::map< std::string, std::pair< double, std::string > > & currencyWeightsAndFxIndexNames() const
std::map< std::string, double > fxSpotRiskFromForwards(const double quantity, const QuantLib::Date &asof, const QuantLib::ext::shared_ptr< ore::data::Market > &todaysMarket, const double shiftsize) const
QuantLib::ext::shared_ptr< ore::data::EquityIndexReferenceDatum > underlyingRefData_
QuantLib::Date rebalancingDate(const QuantLib::Date &asof) const
CurrencyHedgedEquityIndexDecomposition(const std::string indexName, const QuantLib::ext::shared_ptr< ore::data::CurrencyHedgedEquityIndexReferenceDatum > &indexRefData, const QuantLib::ext::shared_ptr< ore::data::EquityIndexReferenceDatum > underlyingRefData, const std::string &indexCurrency, const std::string &underlyingIndexCurrency, const std::string &fxIndexName, const std::map< std::string, std::pair< double, std::string > > &currencyWeightsAndFxIndexNames)
QuantLib::ext::shared_ptr< ore::data::CurrencyHedgedEquityIndexReferenceDatum > indexRefData_
void addAdditionalFixingsForEquityIndexDecomposition(const QuantLib::Date &asof, std::map< std::string, RequiredFixings::FixingDates > &fixings) const
Curve configuration repository.
@ data
Definition: log.hpp:77
Date referenceDate
Definition: utilities.cpp:442
QuantLib::ext::shared_ptr< CurrencyHedgedEquityIndexDecomposition > loadCurrencyHedgedIndexDecomposition(const std::string &name, const QuantLib::ext::shared_ptr< ReferenceDataManager > &refDataMgr, const QuantLib::ext::shared_ptr< CurveConfigurations > &curveConfigs)
Serializable Credit Default Swap.
Definition: namespaces.docs:23
Reference data model and serialization.
vector< string > curveConfigs
string name