36#include <ql/math/matrix.hpp>
37#include <ql/math/randomnumbers/mt19937uniformrng.hpp>
58 const QuantLib::ext::shared_ptr<NPVCube> cube,
const QuantLib::ext::shared_ptr<NPVCube> nettedCube,
59 const QuantLib::ext::shared_ptr<AggregationScenarioData> aggData,
const Size cubeIndexCashflows,
60 const Size cubeIndexStateNpvs,
const Real distributionLowerBound,
61 const Real distributionUpperBound,
const Size buckets,
const Matrix& globalFactorCorrelation,
62 const std::string& baseCurrency);
65 void build(
const std::map<std::string, QuantLib::ext::shared_ptr<Trade>>& trades);
95 void simulateEntityStates(
const std::vector<Matrix>& cond,
const Size path,
const MersenneTwisterUniformRng& mt);
107 std::vector<Array>& condProbs, std::vector<Array>& pnl)
const;
109 QuantLib::ext::shared_ptr<CreditSimulationParameters>
parameters_;
111 QuantLib::ext::shared_ptr<AggregationScenarioData>
aggData_;
this class holds data associated to scenarios
const std::vector< Real > & upperBucketBound() const
std::vector< std::set< std::string > > issuerTradeIds_
std::map< string, Matrix > rescaledTransitionMatrices(const Size date)
std::vector< Real > cubeTimes_
std::vector< Real > globalVar_
std::vector< std::vector< Matrix > > entityStateSimulationMatrices_
void initEntityStateSimulation()
Allocate 3d storage for the simulated idiosyncratic factors by entity, date and sample.
std::string baseCurrency_
QuantLib::ext::shared_ptr< NPVCube > nettedCube_
QuantLib::ext::shared_ptr< CreditSimulationParameters > parameters_
void build(const std::map< std::string, QuantLib::ext::shared_ptr< Trade > > &trades)
builds the helper for a specific subset of trades stored in the cube
QuantExt::Bucketing bucketing_
Size simulatedEntityState(const Size i, const Size path) const
Look up the simulated entity credit state for the given entity, date and path.
std::vector< std::vector< std::vector< Real > > > globalStates_
std::vector< std::set< std::string > > cptyNettingSetIds_
void generateConditionalMigrationPnl(const Size date, const Size path, const std::map< string, Matrix > &transMat, std::vector< Array > &condProbs, std::vector< Array > &pnl) const
std::map< std::string, std::string > tradeCreditCurves_
Matrix globalFactorCorrelation_
QuantLib::ext::shared_ptr< AggregationScenarioData > aggData_
LoanExposureMode loanExposureMode_
Array pnlDistribution(const Size date)
std::map< std::string, Size > tradeCdsCptyIdx_
std::map< std::string, Real > tradeNotionals_
std::map< std::string, std::string > tradeCurrencies_
std::vector< std::map< string, Matrix > > rescaledTransitionMatrices_
std::vector< std::vector< Size > > simulatedEntityState_
Real generateMigrationPnl(const Size date, const Size path, const Size n) const
QuantLib::ext::shared_ptr< NPVCube > cube_
void simulateEntityStates(const std::vector< Matrix > &cond, const Size path, const MersenneTwisterUniformRng &mt)
const std::vector< Real > & upperBucketBound() const
Credit simulation parameter class.
CreditMigrationHelper::LoanExposureMode parseLoanExposureMode(const std::string &s)
CreditMigrationHelper::Evaluation parseEvaluation(const std::string &s)
CreditMigrationHelper::CreditMode parseCreditMode(const std::string &s)