Loading...
Home / Reply To: Interpretation of scenariodump.csv

Home Forums Help Interpretation of scenariodump.csv Reply To: Interpretation of scenariodump.csv

#6169
rkapl
Participant

OK, I’ve seen from the test cases that indeed there is a need to divide all scenario data by the numeraire:

` // Basic martingale tests
Size samples = 10000;
Real eur = 0.0, usd = 0.0, gbp = 0.0, eur2 = 0.0, usd2 = 0.0, gbp2 = 0.0;

boost::timer timer;
for (Size i = 0; i < samples; i++) {
for (Date d : grid->dates()) {
boost::shared_ptr<Scenario> scenario = scenGen->next(d);

if (d == grid->dates().back()) { // in 10 years from today
RiskFactorKey eurKey(RiskFactorKey::KeyType::DiscountCurve, “EUR”, 8);
RiskFactorKey usdKey(RiskFactorKey::KeyType::DiscountCurve, “USD”, 8);
RiskFactorKey gbpKey(RiskFactorKey::KeyType::DiscountCurve, “GBP”, 8);
RiskFactorKey usdeurKey(RiskFactorKey::KeyType::FXSpot, “USDEUR”);
RiskFactorKey gbpeurKey(RiskFactorKey::KeyType::FXSpot, “GBPEUR”);

Real usdeurFX = scenario->get(usdeurKey);
Real gbpeurFX = scenario->get(gbpeurKey);
Real numeraire = scenario->getNumeraire();
Real eur10yDiscount = scenario->get(eurKey);
Real gbp10yDiscount = scenario->get(gbpKey);
Real usd10yDiscount = scenario->get(usdKey);
eur += eur10yDiscount / numeraire;
gbp += gbp10yDiscount * gbpeurFX / numeraire;
usd += usd10yDiscount * usdeurFX / numeraire;
eur2 += 1.0 / numeraire;
gbp2 += gbpeurFX / numeraire;
usd2 += usdeurFX / numeraire;
}
}
}
Real elapsed = timer.elapsed();

eur /= samples;
gbp /= samples;
usd /= samples;
eur2 /= samples;
gbp2 /= samples;
usd2 /= samples;

Real relTolerance = 0.01;
Real eurExpected = d.market->discountCurve(“EUR”)->discount(20.);
BOOST_CHECK_MESSAGE(fabs(eur – eurExpected) / eurExpected < relTolerance,
“EUR 20Y Discount mismatch: ” << eur << ” vs ” << eurExpected);

Doing this results in a “shock” inverse scenario with very low discount factors at the short end (giving a ~60000% zero rate) and moderately low rates at the long end (~2% zero rate) … well, it’s the highest CAD discount rate in all scenarios …

Furthermore, I’ve seen that the index curve needs to be interpreted as discount factors, also needing above correction with the numeraire.

-regards,
Roland