32 const QuantLib::ext::shared_ptr<SimMarket>& simMarket, QuantLib::ext::shared_ptr<NPVCube>& outputCube,
33 const Date& date, Size dateIndex, Size sample,
bool isCloseOut) {
35 outputCube->set(
survProb(
name, simMarket, date), nameIndex, dateIndex, sample,
index_);
39 const QuantLib::ext::shared_ptr<SimMarket>& simMarket,
40 QuantLib::ext::shared_ptr<NPVCube>& outputCube) {
45 const QuantLib::ext::shared_ptr<SimMarket>& simMarket,
47 Real survivalProb = 1.0;
50 Handle<DefaultProbabilityTermStructure> dts = simMarket->defaultCurve(
name,
configuration_)->curve();
51 QL_REQUIRE(!dts.empty(),
"Default curve missing for counterparty " <<
name);
52 survivalProb = dts->survivalProbability(date == Date() ? dts->referenceDate() : date);
53 }
catch (std::exception& e) {
54 ALOG(
"Failed to calculate surv prob of counterparty " <<
name <<
" : " << e.what());
57 ALOG(
"Failed to calculate surv prob of counterparty " <<
name <<
" : Unhandled Exception");
std::string configuration_
Real survProb(const std::string &name, const QuantLib::ext::shared_ptr< SimMarket > &simMarket, const Date &date=Date())
virtual void calculate(const std::string &name, Size nameIndex, const QuantLib::ext::shared_ptr< SimMarket > &simMarket, QuantLib::ext::shared_ptr< NPVCube > &outputCube, const Date &date, Size dateIndex, Size sample, bool isCloseOut=false) override
virtual void calculateT0(const std::string &name, Size nameIndex, const QuantLib::ext::shared_ptr< SimMarket > &simMarket, QuantLib::ext::shared_ptr< NPVCube > &outputCube) override
The counterparty cube calculator interface.