#include <ored/utilities/correlationmatrix.hpp>
Public Member Functions | |
void | reset () |
Clear all data. | |
Add Correlations | |
void | addCorrelation (const std::string &factor1, const std::string &factor2, QuantLib::Real correlation) |
void | addCorrelation (const std::string &factor1, const std::string &factor2, const QuantLib::Handle< QuantLib::Quote > &correlation) |
void | addCorrelation (const CorrelationFactor &f_1, const CorrelationFactor &f_2, QuantLib::Real correlation) |
Add correlation between factor f_1 and f_2 . | |
void | addCorrelation (const CorrelationFactor &f_1, const CorrelationFactor &f_2, const QuantLib::Handle< QuantLib::Quote > &correlation) |
Add correlation quote between factor f_1 and f_2 . | |
Correlation Matrix | |
typedef std::map< QuantExt::CrossAssetModel::AssetType, std::vector< std::pair< std::string, QuantLib::Size > > > | ProcessInfo |
QuantLib::Matrix | correlationMatrix (const std::vector< std::string > &ccys) |
QuantLib::Matrix | correlationMatrix (const std::vector< std::string > &ccys, const std::vector< std::string > &infIndices) |
QuantLib::Matrix | correlationMatrix (const std::vector< std::string > &ccys, const std::vector< std::string > &infIndices, const std::vector< std::string > &names) |
QuantLib::Matrix | correlationMatrix (const std::vector< std::string > &ccys, const std::vector< std::string > &infIndices, const std::vector< std::string > &names, const std::vector< std::string > &equities) |
QuantLib::Matrix | correlationMatrix (const ProcessInfo &processInfo) |
QuantLib::Handle< QuantLib::Quote > | lookup (const std::string &f1, const std::string &f2) |
Get the correlation between two factors. | |
QuantLib::Handle< QuantLib::Quote > | getCorrelation (const CorrelationFactor &f_1, const CorrelationFactor &f_2) const |
Get the correlation between the factor f_1 and f_2 . | |
const std::map< CorrelationKey, QuantLib::Handle< QuantLib::Quote > > & | correlations () |
Get the raw correlation data. | |
Correlation matrix builder class
Can be loaded with sets of individual correlations as pairs and will build a required correlation matrix.
typedef std::map<QuantExt::CrossAssetModel::AssetType, std::vector<std::pair<std::string, QuantLib::Size> > > ProcessInfo |
Build the correlation matrix according to the information provided in processInfo
. The ProcessInfo map uses the CrossAssetModel asset type as the outer map key and therefore has the correct ordering i.e. IR, FX, etc. For each CrossAssetModel asset type, there is a vector of pairs where the first element in the pair is the name of the factor being modeled and the second element in the pair is the number of factors used in modeling the name. In most cases, the number of factors is 1. The first element in the vector for asset type IR is assumed to be the base currency.
void addCorrelation | ( | const std::string & | factor1, |
const std::string & | factor2, | ||
QuantLib::Real | correlation | ||
) |
Method to add a correlation between factor1
and factor2
. The factor string is of the form type:name
and it is assumed that the factor belongs to a process driven by one factor. For example, IR:EUR
would refer to the single factor driving the EUR interest rate process.
For processes driven by more than one factor, use the addCorrelation
methods below that take a CorrelationFactor
.
void addCorrelation | ( | const std::string & | factor1, |
const std::string & | factor2, | ||
const QuantLib::Handle< QuantLib::Quote > & | correlation | ||
) |
Method to add a correlation between factor1
and factor2
. The factor string is of the form type:name
and it is assumed that the factor belongs to a process driven by one factor. For example, IR:EUR
would refer to the single factor driving the EUR interest rate process.
For processes driven by more than one factor, use the addCorrelation
methods below that take a CorrelationFactor
.
QuantLib::Matrix correlationMatrix | ( | const std::vector< std::string > & | ccys | ) |
For any of the correlation matrices returned below, if it is asked for a correlation between two factors that has not been added to the matrix builder, it will return 0.0 and not raise an exception.
Return a \(2n-1\) square matrix for an IR/FX model, where \(n\) is the number of currencies in the ccys
argument. This assumes that ccys
[0] is the base currency.
QuantLib::Matrix correlationMatrix | ( | const std::vector< std::string > & | ccys, |
const std::vector< std::string > & | infIndices | ||
) |
Return a \(2n-1+m\) square matrix for an IR/FX/INF model, where \(n\) is the number of currencies in the ccys
argument and \(m\) is the number of inflation indices in the infIndices
argument. This assumes that ccys
[0] is the base currency.
QuantLib::Matrix correlationMatrix | ( | const std::vector< std::string > & | ccys, |
const std::vector< std::string > & | infIndices, | ||
const std::vector< std::string > & | names | ||
) |
Return a \(2n-1+m+k\) square matrix for an IR/FX/INF/CR model, where \(n\) is the number of currencies in the ccys
argument, \(m\) is the number of inflation indices in the infIndices
argument and \(k\) is the number of credit names in the names
argument. This assumes that ccys
[0] is the base currency.
QuantLib::Matrix correlationMatrix | ( | const std::vector< std::string > & | ccys, |
const std::vector< std::string > & | infIndices, | ||
const std::vector< std::string > & | names, | ||
const std::vector< std::string > & | equities | ||
) |
Return a \(2n-1+m+k+p\) square matrix for an IR/FX/INF/CR/EQ model, where \(n\) is the number of currencies in the ccys
argument, \(m\) is the number of inflation indices in the infIndices
argument, \(k\) is the number of credit names in the names
argument and \(p\) is the number of equity names in the equities
argument. This assumes that ccys
[0] is the base currency.