@@ -342,12 +342,10 @@ void SensitivityScenarioGenerator::generateFxScenarios(bool up) {
342342
343343 storeShiftData (key, rate, newRate);
344344
345- // Give the scenario a label
346- scenario->label (to_string (scenarioDescriptions_.back ()));
347345
348346 scenarios_.push_back (scenario);
349347 scenarioDescriptions_.push_back (fxScenarioDescription (ccypair, up, getShiftScheme (data)));
350-
348+ scenario-> label ( to_string (scenarioDescriptions_. back ()));
351349 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label ()
352350 << " created: " << newRate);
353351 }
@@ -385,11 +383,9 @@ void SensitivityScenarioGenerator::generateEquityScenarios(bool up) {
385383
386384 storeShiftData (key, rate, newRate);
387385
388- // Give the scenario a label
389- scenario->label (to_string (scenarioDescriptions_.back ()));
390-
391386 scenarios_.push_back (scenario);
392387 scenarioDescriptions_.push_back (equityScenarioDescription (equity, up, getShiftScheme (data)));
388+ scenario->label (to_string (scenarioDescriptions_.back ()));
393389 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label ()
394390 << " created: " << newRate);
395391 }
@@ -457,6 +453,7 @@ void SensitivityScenarioGenerator::generateDiscountCurveScenarios(bool up) {
457453 for (Size j = 0 ; j < n_ten; ++j) {
458454 Date d = asof + simMarketData_->yieldCurveTenors (ccy)[j];
459455 times[j] = dc.yearFraction (asof, d);
456+ DLOG (" tenor " << j << " date " << d << " time " << times[j]);
460457
461458 RiskFactorKey key (RiskFactorKey::KeyType::DiscountCurve, ccy, j);
462459 valid = valid && tryGetBaseScenarioValue (baseScenarioAbsolute_, key, quote, continueOnError_);
@@ -481,9 +478,6 @@ void SensitivityScenarioGenerator::generateDiscountCurveScenarios(bool up) {
481478 for (Size j = 0 ; j < shiftTenors.size (); ++j) {
482479
483480 boost::shared_ptr<Scenario> scenario = sensiScenarioFactory_->buildScenario (asof);
484- DLOG (" generate discount curve scenario, ccy " << ccy << " , bucket " << j << " , up " << up << " , desc "
485- << scenarioDescriptions_.back ());
486-
487481 // apply zero rate shift at tenor point j
488482 applyShift (j, shiftSize, up, shiftType, shiftTimes, zeros, times, shiftedZeros, true );
489483
@@ -496,6 +490,8 @@ void SensitivityScenarioGenerator::generateDiscountCurveScenarios(bool up) {
496490 if (sensitivityData_->useSpreadedTermStructures ()) {
497491 Real discount = exp (-zeros[k] * times[k]);
498492 scenario->add (key, shiftedDiscount / discount);
493+ DLOG (key << " ," << std::setprecision (12 ) << shiftTimes[k] << " ," << discount << " ,"
494+ << shiftedDiscount);
499495 } else {
500496 scenario->add (key, shiftedDiscount);
501497 }
@@ -507,12 +503,10 @@ void SensitivityScenarioGenerator::generateDiscountCurveScenarios(bool up) {
507503 }
508504 }
509505
510- // Give the scenario a label
511- scenario->label (to_string (scenarioDescriptions_.back ()));
512-
513506 // add this scenario to the scenario vector
514507 scenarios_.push_back (scenario);
515508 scenarioDescriptions_.push_back (discountScenarioDescription (ccy, j, up, getShiftScheme (data)));
509+ scenario->label (to_string (scenarioDescriptions_.back ()));
516510 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
517511
518512 } // end of shift curve tenors
@@ -610,12 +604,10 @@ void SensitivityScenarioGenerator::generateIndexCurveScenarios(bool up) {
610604 }
611605 }
612606
613- // Give the scenario a label
614- scenario->label (to_string (scenarioDescriptions_.back ()));
615-
616607 // add this scenario to the scenario vector
617608 scenarios_.push_back (scenario);
618609 scenarioDescriptions_.push_back (indexScenarioDescription (indexName, j, up, getShiftScheme (data)));
610+ scenario->label (to_string (scenarioDescriptions_.back ()));
619611 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label ()
620612 << " created for indexName " << indexName);
621613
@@ -712,12 +704,10 @@ void SensitivityScenarioGenerator::generateYieldCurveScenarios(bool up) {
712704 }
713705 }
714706
715- // Give the scenario a label
716- scenario->label (to_string (scenarioDescriptions_.back ()));
717-
718707 // add this scenario to the scenario vector
719708 scenarios_.push_back (scenario);
720709 scenarioDescriptions_.push_back (yieldScenarioDescription (name, j, up, getShiftScheme (data)));
710+ scenario->label (to_string (scenarioDescriptions_.back ()));
721711 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
722712
723713 } // end of shift curve tenors
@@ -815,12 +805,10 @@ void SensitivityScenarioGenerator::generateDividendYieldScenarios(bool up) {
815805 }
816806 }
817807
818- // Give the scenario a label
819- scenario->label (to_string (scenarioDescriptions_.back ()));
820-
821808 // add this scenario to the scenario vector
822809 scenarios_.push_back (scenario);
823810 scenarioDescriptions_.push_back (dividendYieldScenarioDescription (name, j, up, getShiftScheme (data)));
811+ scenario->label (to_string (scenarioDescriptions_.back ()));
824812 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
825813
826814 } // end of shift curve tenors
@@ -933,13 +921,11 @@ void SensitivityScenarioGenerator::generateFxVolScenarios(bool up) {
933921 }
934922 }
935923
936- // Give the scenario a label
937- scenario->label (to_string (scenarioDescriptions_.back ()));
938-
939924 // add this scenario to the scenario vector
940925 scenarios_.push_back (scenario);
941926 scenarioDescriptions_.push_back (
942927 fxVolScenarioDescription (ccyPair, j, strikeBucket, up, getShiftScheme (data)));
928+ scenario->label (to_string (scenarioDescriptions_.back ()));
943929 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
944930 }
945931 }
@@ -1055,13 +1041,11 @@ void SensitivityScenarioGenerator::generateEquityVolScenarios(bool up) {
10551041 }
10561042 }
10571043
1058- // Give the scenario a label
1059- scenario->label (to_string (scenarioDescriptions_.back ()));
1060-
10611044 // add this scenario to the scenario vector
10621045 scenarios_.push_back (scenario);
10631046 scenarioDescriptions_.push_back (
10641047 equityVolScenarioDescription (equity, j, strikeBucket, up, getShiftScheme (data)));
1048+ scenario->label (to_string (scenarioDescriptions_.back ()));
10651049 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
10661050 }
10671051 }
@@ -1257,12 +1241,10 @@ void SensitivityScenarioGenerator::generateGenericYieldVolScenarios(bool up, Ris
12571241 }
12581242 }
12591243
1260- // Give the scenario a label
1261- scenario->label (to_string (scenarioDescriptions_.back ()));
1262-
12631244 // add this scenario to the scenario vector
12641245 scenarios_.push_back (scenario);
12651246 scenarioDescriptions_.push_back (getScenarioDescription (qualifier, j, k, strikeBucket, up, data));
1247+ scenario->label (to_string (scenarioDescriptions_.back ()));
12661248 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label ()
12671249 << " created for generic yield vol " << qualifier);
12681250 }
@@ -1413,12 +1395,11 @@ void SensitivityScenarioGenerator::generateCapFloorVolScenarios(bool up) {
14131395 }
14141396
14151397 // Give the scenario a label
1416- scenario->label (to_string (scenarioDescriptions_.back ()));
14171398
1418- // add this scenario to the scenario vector
14191399 scenarios_.push_back (scenario);
14201400 scenarioDescriptions_.push_back (
14211401 capFloorVolScenarioDescription (key, j, k, up, sensiIsAtm, getShiftScheme (data)));
1402+ scenario->label (to_string (scenarioDescriptions_.back ()));
14221403 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
14231404 }
14241405 }
@@ -1523,12 +1504,10 @@ void SensitivityScenarioGenerator::generateSurvivalProbabilityScenarios(bool up)
15231504 }
15241505 }
15251506
1526- // Give the scenario a label
1527- scenario->label (to_string (scenarioDescriptions_.back ()));
1528-
15291507 // add this scenario to the scenario vector
15301508 scenarios_.push_back (scenario);
15311509 scenarioDescriptions_.push_back (survivalProbabilityScenarioDescription (name, j, up, getShiftScheme (data)));
1510+ scenario->label (to_string (scenarioDescriptions_.back ()));
15321511 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
15331512
15341513 } // end of shift curve tenors
@@ -1615,12 +1594,10 @@ void SensitivityScenarioGenerator::generateCdsVolScenarios(bool up) {
16151594 }
16161595 }
16171596
1618- // Give the scenario a label
1619- scenario->label (to_string (scenarioDescriptions_.back ()));
1620-
16211597 // add this scenario to the scenario vector
16221598 scenarios_.push_back (scenario);
16231599 scenarioDescriptions_.push_back (CdsVolScenarioDescription (name, j, strikeBucket, up, getShiftScheme (data)));
1600+ scenario->label (to_string (scenarioDescriptions_.back ()));
16241601 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
16251602 }
16261603 }
@@ -1712,12 +1689,10 @@ void SensitivityScenarioGenerator::generateZeroInflationScenarios(bool up) {
17121689 }
17131690 }
17141691
1715- // Give the scenario a label
1716- scenario->label (to_string (scenarioDescriptions_.back ()));
1717-
17181692 // add this scenario to the scenario vector
17191693 scenarios_.push_back (scenario);
17201694 scenarioDescriptions_.push_back (zeroInflationScenarioDescription (indexName, j, up, getShiftScheme (data)));
1695+ scenario->label (to_string (scenarioDescriptions_.back ()));
17211696 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label ()
17221697 << " created for indexName " << indexName);
17231698
@@ -1817,12 +1792,10 @@ void SensitivityScenarioGenerator::generateYoYInflationScenarios(bool up) {
18171792 }
18181793 }
18191794
1820- // Give the scenario a label
1821- scenario->label (to_string (scenarioDescriptions_.back ()));
1822-
18231795 // add this scenario to the scenario vector
18241796 scenarios_.push_back (scenario);
18251797 scenarioDescriptions_.push_back (yoyInflationScenarioDescription (indexName, j, up, getShiftScheme (data)));
1798+ scenario->label (to_string (scenarioDescriptions_.back ()));
18261799 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label ()
18271800 << " created for indexName " << indexName);
18281801
@@ -1930,13 +1903,11 @@ void SensitivityScenarioGenerator::generateYoYInflationCapFloorVolScenarios(bool
19301903 }
19311904 }
19321905
1933- // Give the scenario a label
1934- scenario->label (to_string (scenarioDescriptions_.back ()));
1935-
19361906 // add this scenario to the scenario vector
19371907 scenarios_.push_back (scenario);
19381908 scenarioDescriptions_.push_back (
19391909 yoyInflationCapFloorVolScenarioDescription (name, j, k, up, getShiftScheme (data)));
1910+ scenario->label (to_string (scenarioDescriptions_.back ()));
19401911 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
19411912 }
19421913 }
@@ -2043,13 +2014,11 @@ void SensitivityScenarioGenerator::generateZeroInflationCapFloorVolScenarios(boo
20432014 }
20442015 }
20452016
2046- // Give the scenario a label
2047- scenario->label (to_string (scenarioDescriptions_.back ()));
2048-
20492017 // add this scenario to the scenario vector
20502018 scenarios_.push_back (scenario);
20512019 scenarioDescriptions_.push_back (
20522020 zeroInflationCapFloorVolScenarioDescription (name, j, k, up, getShiftScheme (data)));
2021+ scenario->label (to_string (scenarioDescriptions_.back ()));
20532022 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
20542023 }
20552024 }
@@ -2159,13 +2128,11 @@ void SensitivityScenarioGenerator::generateBaseCorrelationScenarios(bool up) {
21592128 }
21602129 }
21612130
2162- // Give the scenario a label
2163- scenario->label (to_string (scenarioDescriptions_.back ()));
2164-
21652131 // add this scenario to the scenario vector
21662132 scenarios_.push_back (scenario);
21672133 scenarioDescriptions_.push_back (
21682134 baseCorrelationScenarioDescription (name, j, k, up, getShiftScheme (data)));
2135+ scenario->label (to_string (scenarioDescriptions_.back ()));
21692136 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
21702137 }
21712138 }
@@ -2263,12 +2230,10 @@ void SensitivityScenarioGenerator::generateCommodityCurveScenarios(bool up) {
22632230 }
22642231 }
22652232
2266- // Give the scenario a label
2267- scenario->label (to_string (scenarioDescriptions_.back ()));
2268-
22692233 // add this scenario to the scenario vector
22702234 scenarios_.push_back (scenario);
22712235 scenarioDescriptions_.push_back (commodityCurveScenarioDescription (name, j, up, getShiftScheme (data)));
2236+ scenario->label (to_string (scenarioDescriptions_.back ()));
22722237 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
22732238 }
22742239 }
@@ -2375,12 +2340,11 @@ void SensitivityScenarioGenerator::generateCommodityVolScenarios(bool up) {
23752340 }
23762341
23772342 // Give the scenario a label
2378- scenario->label (to_string (scenarioDescriptions_.back ()));
23792343
23802344 // Add the final scenario to the scenario vector
23812345 scenarioDescriptions_.push_back (commodityVolScenarioDescription (name, sj, si, up, getShiftScheme (sd)));
2346+ scenario->label (to_string (scenarioDescriptions_.back ()));
23822347 scenarios_.push_back (scenario);
2383-
23842348 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
23852349 }
23862350 }
@@ -2488,12 +2452,10 @@ void SensitivityScenarioGenerator::generateCorrelationScenarios(bool up) {
24882452 }
24892453 }
24902454
2491- // Give the scenario a label
2492- scenario->label (to_string (scenarioDescriptions_.back ()));
2493-
24942455 // add this scenario to the scenario vector
24952456 scenarios_.push_back (scenario);
24962457 scenarioDescriptions_.push_back (correlationScenarioDescription (label, j, k, up, getShiftScheme (data)));
2458+ scenario->label (to_string (scenarioDescriptions_.back ()));
24972459 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label () << " created" );
24982460 }
24992461 }
@@ -2531,11 +2493,9 @@ void SensitivityScenarioGenerator::generateSecuritySpreadScenarios(bool up) {
25312493
25322494 storeShiftData (key, base_spread, newSpread);
25332495
2534- // Give the scenario a label
2535- scenario->label (to_string (scenarioDescriptions_.back ()));
2536-
25372496 scenarios_.push_back (scenario);
25382497 scenarioDescriptions_.push_back (securitySpreadScenarioDescription (bond, up, getShiftScheme (data)));
2498+ scenario->label (to_string (scenarioDescriptions_.back ()));
25392499 DLOG (" Sensitivity scenario # " << scenarios_.size () << " , label " << scenario->label ()
25402500 << " created: " << newSpread);
25412501 }
0 commit comments