537 {
538 BOOST_TEST_MESSAGE("Testing Portfolio sensitivity");
539
540 SavedSettings backup;
542 ObservationMode::instance().setMode(ObservationMode::Mode::None);
543
544 Date today = Date(14, April, 2016);
545 Settings::instance().evaluationDate() = today;
546
547 BOOST_TEST_MESSAGE("Today is " << today);
548
549
550 QuantLib::ext::shared_ptr<Market> initMarket = QuantLib::ext::make_shared<TestMarket>(today);
551
552
553 QuantLib::ext::shared_ptr<analytics::ScenarioSimMarketParameters> simMarketData =
setupSimMarketData5();
554
555
557
558 QuantLib::ext::shared_ptr<analytics::ScenarioSimMarket> simMarket =
559 QuantLib::ext::make_shared<analytics::ScenarioSimMarket>(initMarket, simMarketData);
560
561
562 QuantLib::ext::shared_ptr<Scenario> baseScenario = simMarket->baseScenario();
563 QuantLib::ext::shared_ptr<ScenarioFactory> scenarioFactory =
564 QuantLib::ext::make_shared<ore::analytics::DeltaScenarioFactory>(baseScenario);
565
566
567 QuantLib::ext::shared_ptr<SensitivityScenarioGenerator> scenarioGenerator =
568 QuantLib::ext::make_shared<SensitivityScenarioGenerator>(sensiData, baseScenario, simMarketData, simMarket,
569 scenarioFactory, false);
570 simMarket->scenarioGenerator() = scenarioGenerator;
571
572
573 QuantLib::ext::shared_ptr<EngineData>
data = QuantLib::ext::make_shared<EngineData>();
574 data->model(
"Swap") =
"DiscountedCashflows";
575 data->engine(
"Swap") =
"DiscountingSwapEngine";
576 data->model(
"CrossCurrencySwap") =
"DiscountedCashflows";
577 data->engine(
"CrossCurrencySwap") =
"DiscountingCrossCurrencySwapEngine";
578 data->model(
"EuropeanSwaption") =
"BlackBachelier";
579 data->engine(
"EuropeanSwaption") =
"BlackBachelierSwaptionEngine";
580 data->model(
"FxForward") =
"DiscountedCashflows";
581 data->engine(
"FxForward") =
"DiscountingFxForwardEngine";
582 data->model(
"FxOption") =
"GarmanKohlhagen";
583 data->engine(
"FxOption") =
"AnalyticEuropeanEngine";
584 data->model(
"CapFloor") =
"IborCapModel";
585 data->engine(
"CapFloor") =
"IborCapEngine";
586 data->model(
"CapFlooredIborLeg") =
"BlackOrBachelier";
587 data->engine(
"CapFlooredIborLeg") =
"BlackIborCouponPricer";
588 data->model(
"YYCapFloor") =
"YYCapModel";
589 data->engine(
"YYCapFloor") =
"YYCapEngine";
590 data->model(
"IndexCreditDefaultSwapOption") =
"Black";
591 data->engine(
"IndexCreditDefaultSwapOption") =
"BlackIndexCdsOptionEngine";
592 map<string, string> engineParamMap1;
593 engineParamMap1["Curve"] = "Underlying";
594 data->engineParameters(
"IndexCreditDefaultSwapOption") = engineParamMap1;
595
596 data->model(
"IndexCreditDefaultSwap") =
"DiscountedCashflows";
597 data->engine(
"IndexCreditDefaultSwap") =
"MidPointIndexCdsEngine";
598 map<string, string> engineParamMap2;
599 engineParamMap2["Curve"] = "Underlying";
600 data->engineParameters(
"IndexCreditDefaultSwap") = engineParamMap2;
601 data->model(
"Bond") =
"DiscountedCashflows";
602 data->engine(
"Bond") =
"DiscountingRiskyBondEngine";
603 data->engineParameters(
"Bond")[
"TimestepPeriod"] =
"6M";
604 data->model(
"EquityOption") =
"BlackScholesMerton";
605 data->engine(
"EquityOption") =
"AnalyticEuropeanEngine";
606 QuantLib::ext::shared_ptr<EngineFactory> factory = QuantLib::ext::make_shared<EngineFactory>(data, simMarket);
607
608
609 QuantLib::ext::shared_ptr<Portfolio> portfolio(
new Portfolio());
610 portfolio->add(
buildSwap(
"1_Swap_EUR",
"EUR",
true, 10000000.0, 0, 10, 0.03, 0.00,
"1Y",
611 "30/360", "6M", "A360", "EUR-EURIBOR-6M"));
612 portfolio->add(
buildSwap(
"2_Swap_USD",
"USD",
true, 10000000.0, 0, 15, 0.02, 0.00,
"6M",
613 "30/360", "3M", "A360", "USD-LIBOR-3M"));
614 portfolio->add(
buildSwap(
"3_Swap_GBP",
"GBP",
true, 10000000.0, 0, 20, 0.04, 0.00,
"6M",
615 "30/360", "3M", "A360", "GBP-LIBOR-6M"));
616 portfolio->add(
buildSwap(
"4_Swap_JPY",
"JPY",
true, 1000000000.0, 0, 5, 0.01, 0.00,
"6M",
617 "30/360", "3M", "A360", "JPY-LIBOR-6M"));
619 0.02, 0.00, "1Y", "30/360", "6M", "A360", "EUR-EURIBOR-6M",
620 "Physical"));
622 0.02, 0.00, "1Y", "30/360", "6M", "A360", "EUR-EURIBOR-6M",
623 "Physical"));
624 portfolio->add(
buildFxOption(
"7_FxOption_EUR_USD",
"Long",
"Call", 3,
"EUR", 10000000.0,
"USD",
625 11000000.0));
626 portfolio->add(
buildFxOption(
"8_FxOption_EUR_GBP",
"Long",
"Call", 7,
"EUR", 10000000.0,
"GBP",
627 11000000.0));
628 portfolio->add(
buildCap(
"9_Cap_EUR",
"EUR",
"Long", 0.05, 1000000.0, 0, 10,
"6M",
"A360",
629 "EUR-EURIBOR-6M"));
630 portfolio->add(
buildFloor(
"10_Floor_USD",
"USD",
"Long", 0.01, 1000000.0, 0, 10,
"3M",
"A360",
631 "USD-LIBOR-3M"));
632
633
634
635
636
637
638
639
640
641
642 portfolio->add(
643 buildEquityOption(
"12_EquityOption_SP5",
"Long",
"Call", 2,
"SP5",
"USD", 2147.56, 1000));
644 portfolio->add(
buildEquityOption(
"13_EquityOption_Lufthansa",
"Long",
"Call", 2,
"Lufthansa",
645 "EUR", 12.75, 775));
646
648 0.02, 0, 10, "1Y", "ACT/ACT", "UKRP1", "2M", 2));
649 portfolio->build(factory);
650
651 BOOST_TEST_MESSAGE("Portfolio size after build: " << portfolio->size());
652
653 QuantLib::ext::shared_ptr<DateGrid> dg = QuantLib::ext::make_shared<DateGrid>(
654 "1,0W");
655 vector<QuantLib::ext::shared_ptr<ValuationCalculator>> calculators;
656 calculators.push_back(QuantLib::ext::make_shared<NPVCalculator>(simMarketData->baseCcy()));
658
659 boost::timer::cpu_timer t;
660 QuantLib::ext::shared_ptr<NPVCube> cube = QuantLib::ext::make_shared<DoublePrecisionInMemoryCube>(
661 today, portfolio->ids(), vector<Date>(1, today), scenarioGenerator->samples());
662 engine.buildCube(portfolio, cube, calculators);
663 double elapsed = t.elapsed().wall * 1e-9;
664
665 struct Results {
666 string id;
667 string label;
668 Real npv;
669 Real sensi;
670 };
671
672 std::vector<Results> cachedResults = {
673 {"1_Swap_EUR", "Up:DiscountCurve/EUR/0/6M", -928826, -2.51631},
674 {"1_Swap_EUR", "Up:DiscountCurve/EUR/1/1Y", -928826, 14.6846},
675 {"1_Swap_EUR", "Up:DiscountCurve/EUR/2/2Y", -928826, 19.0081},
676 {"1_Swap_EUR", "Up:DiscountCurve/EUR/3/3Y", -928826, 46.1186},
677 {"1_Swap_EUR", "Up:DiscountCurve/EUR/4/5Y", -928826, 85.1033},
678 {"1_Swap_EUR", "Up:DiscountCurve/EUR/5/7Y", -928826, 149.43},
679 {"1_Swap_EUR", "Up:DiscountCurve/EUR/6/10Y", -928826, 205.064},
680 {"1_Swap_EUR", "Down:DiscountCurve/EUR/0/6M", -928826, 2.51644},
681 {"1_Swap_EUR", "Down:DiscountCurve/EUR/1/1Y", -928826, -14.6863},
682 {"1_Swap_EUR", "Down:DiscountCurve/EUR/2/2Y", -928826, -19.0137},
683 {"1_Swap_EUR", "Down:DiscountCurve/EUR/3/3Y", -928826, -46.1338},
684 {"1_Swap_EUR", "Down:DiscountCurve/EUR/4/5Y", -928826, -85.1406},
685 {"1_Swap_EUR", "Down:DiscountCurve/EUR/5/7Y", -928826, -149.515},
686 {"1_Swap_EUR", "Down:DiscountCurve/EUR/6/10Y", -928826, -205.239},
687 {"1_Swap_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/0/6M", -928826, -495.013},
688 {"1_Swap_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/1/1Y", -928826, 14.7304},
689 {"1_Swap_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/2/2Y", -928826, 38.7816},
690 {"1_Swap_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/3/3Y", -928826, 94.186},
691 {"1_Swap_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/4/5Y", -928826, 173.125},
692 {"1_Swap_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/5/7Y", -928826, 304.648},
693 {"1_Swap_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/6/10Y", -928826, 8479.55},
694 {"1_Swap_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/0/6M", -928826, 495.037},
695 {"1_Swap_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/1/1Y", -928826, -14.5864},
696 {"1_Swap_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/2/2Y", -928826, -38.4045},
697 {"1_Swap_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/3/3Y", -928826, -93.532},
698 {"1_Swap_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/4/5Y", -928826, -171.969},
699 {"1_Swap_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/5/7Y", -928826, -302.864},
700 {"1_Swap_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/6/10Y", -928826, -8478.14},
701 {"2_Swap_USD", "Up:DiscountCurve/USD/0/6M", 980404, -1.04797},
702 {"2_Swap_USD", "Up:DiscountCurve/USD/1/1Y", 980404, -6.06931},
703 {"2_Swap_USD", "Up:DiscountCurve/USD/2/2Y", 980404, -15.8605},
704 {"2_Swap_USD", "Up:DiscountCurve/USD/3/3Y", 980404, -38.0708},
705 {"2_Swap_USD", "Up:DiscountCurve/USD/4/5Y", 980404, -68.7288},
706 {"2_Swap_USD", "Up:DiscountCurve/USD/5/7Y", 980404, -118.405},
707 {"2_Swap_USD", "Up:DiscountCurve/USD/6/10Y", 980404, -244.946},
708 {"2_Swap_USD", "Up:DiscountCurve/USD/7/15Y", 980404, -202.226},
709 {"2_Swap_USD", "Up:DiscountCurve/USD/8/20Y", 980404, 0.0148314},
710 {"2_Swap_USD", "Down:DiscountCurve/USD/0/6M", 980404, 1.04797},
711 {"2_Swap_USD", "Down:DiscountCurve/USD/1/1Y", 980404, 6.06959},
712 {"2_Swap_USD", "Down:DiscountCurve/USD/2/2Y", 980404, 15.8623},
713 {"2_Swap_USD", "Down:DiscountCurve/USD/3/3Y", 980404, 38.0784},
714 {"2_Swap_USD", "Down:DiscountCurve/USD/4/5Y", 980404, 68.7502},
715 {"2_Swap_USD", "Down:DiscountCurve/USD/5/7Y", 980404, 118.458},
716 {"2_Swap_USD", "Down:DiscountCurve/USD/6/10Y", 980404, 245.108},
717 {"2_Swap_USD", "Down:DiscountCurve/USD/7/15Y", 980404, 202.42},
718 {"2_Swap_USD", "Down:DiscountCurve/USD/8/20Y", 980404, -0.0148314},
719 {"2_Swap_USD", "Up:IndexCurve/USD-LIBOR-3M/0/6M", 980404, -201.015},
720 {"2_Swap_USD", "Up:IndexCurve/USD-LIBOR-3M/1/1Y", 980404, 18.134},
721 {"2_Swap_USD", "Up:IndexCurve/USD-LIBOR-3M/2/2Y", 980404, 47.3066},
722 {"2_Swap_USD", "Up:IndexCurve/USD-LIBOR-3M/3/3Y", 980404, 113.4},
723 {"2_Swap_USD", "Up:IndexCurve/USD-LIBOR-3M/4/5Y", 980404, 205.068},
724 {"2_Swap_USD", "Up:IndexCurve/USD-LIBOR-3M/5/7Y", 980404, 352.859},
725 {"2_Swap_USD", "Up:IndexCurve/USD-LIBOR-3M/6/10Y", 980404, 730.076},
726 {"2_Swap_USD", "Up:IndexCurve/USD-LIBOR-3M/7/15Y", 980404, 8626.78},
727 {"2_Swap_USD", "Up:IndexCurve/USD-LIBOR-3M/8/20Y", 980404, 5.86437},
728 {"2_Swap_USD", "Down:IndexCurve/USD-LIBOR-3M/0/6M", 980404, 201.03},
729 {"2_Swap_USD", "Down:IndexCurve/USD-LIBOR-3M/1/1Y", 980404, -18.0746},
730 {"2_Swap_USD", "Down:IndexCurve/USD-LIBOR-3M/2/2Y", 980404, -47.1526},
731 {"2_Swap_USD", "Down:IndexCurve/USD-LIBOR-3M/3/3Y", 980404, -113.136},
732 {"2_Swap_USD", "Down:IndexCurve/USD-LIBOR-3M/4/5Y", 980404, -204.611},
733 {"2_Swap_USD", "Down:IndexCurve/USD-LIBOR-3M/5/7Y", 980404, -352.166},
734 {"2_Swap_USD", "Down:IndexCurve/USD-LIBOR-3M/6/10Y", 980404, -729.248},
735 {"2_Swap_USD", "Down:IndexCurve/USD-LIBOR-3M/7/15Y", 980404, -8626.13},
736 {"2_Swap_USD", "Down:IndexCurve/USD-LIBOR-3M/8/20Y", 980404, -5.86436},
737 {"2_Swap_USD", "Up:FXSpot/EURUSD/0/spot", 980404, -9706.97},
738 {"2_Swap_USD", "Down:FXSpot/EURUSD/0/spot", 980404, 9903.07},
739 {"3_Swap_GBP", "Up:DiscountCurve/GBP/0/6M", 69795.3, 2.12392},
740 {"3_Swap_GBP", "Up:DiscountCurve/GBP/1/1Y", 69795.3, -0.646097},
741 {"3_Swap_GBP", "Up:DiscountCurve/GBP/2/2Y", 69795.3, -1.75066},
742 {"3_Swap_GBP", "Up:DiscountCurve/GBP/3/3Y", 69795.3, -4.24827},
743 {"3_Swap_GBP", "Up:DiscountCurve/GBP/4/5Y", 69795.3, -7.2252},
744 {"3_Swap_GBP", "Up:DiscountCurve/GBP/5/7Y", 69795.3, -12.5287},
745 {"3_Swap_GBP", "Up:DiscountCurve/GBP/6/10Y", 69795.3, -24.7828},
746 {"3_Swap_GBP", "Up:DiscountCurve/GBP/7/15Y", 69795.3, -39.2456},
747 {"3_Swap_GBP", "Up:DiscountCurve/GBP/8/20Y", 69795.3, 31.2081},
748 {"3_Swap_GBP", "Down:DiscountCurve/GBP/0/6M", 69795.3, -2.12413},
749 {"3_Swap_GBP", "Down:DiscountCurve/GBP/1/1Y", 69795.3, 0.645698},
750 {"3_Swap_GBP", "Down:DiscountCurve/GBP/2/2Y", 69795.3, 1.74981},
751 {"3_Swap_GBP", "Down:DiscountCurve/GBP/3/3Y", 69795.3, 4.2473},
752 {"3_Swap_GBP", "Down:DiscountCurve/GBP/4/5Y", 69795.3, 7.22426},
753 {"3_Swap_GBP", "Down:DiscountCurve/GBP/5/7Y", 69795.3, 12.5298},
754 {"3_Swap_GBP", "Down:DiscountCurve/GBP/6/10Y", 69795.3, 24.7939},
755 {"3_Swap_GBP", "Down:DiscountCurve/GBP/7/15Y", 69795.3, 39.2773},
756 {"3_Swap_GBP", "Down:DiscountCurve/GBP/8/20Y", 69795.3, -31.2925},
757 {"3_Swap_GBP", "Up:IndexCurve/GBP-LIBOR-6M/0/6M", 69795.3, -308.49},
758 {"3_Swap_GBP", "Up:IndexCurve/GBP-LIBOR-6M/1/1Y", 69795.3, 68.819},
759 {"3_Swap_GBP", "Up:IndexCurve/GBP-LIBOR-6M/2/2Y", 69795.3, 81.3735},
760 {"3_Swap_GBP", "Up:IndexCurve/GBP-LIBOR-6M/3/3Y", 69795.3, 239.034},
761 {"3_Swap_GBP", "Up:IndexCurve/GBP-LIBOR-6M/4/5Y", 69795.3, 372.209},
762 {"3_Swap_GBP", "Up:IndexCurve/GBP-LIBOR-6M/5/7Y", 69795.3, 654.949},
763 {"3_Swap_GBP", "Up:IndexCurve/GBP-LIBOR-6M/6/10Y", 69795.3, 1343.01},
764 {"3_Swap_GBP", "Up:IndexCurve/GBP-LIBOR-6M/7/15Y", 69795.3, 2139.68},
765 {"3_Swap_GBP", "Up:IndexCurve/GBP-LIBOR-6M/8/20Y", 69795.3, 12633.8},
766 {"3_Swap_GBP", "Down:IndexCurve/GBP-LIBOR-6M/0/6M", 69795.3, 308.513},
767 {"3_Swap_GBP", "Down:IndexCurve/GBP-LIBOR-6M/1/1Y", 69795.3, -68.7287},
768 {"3_Swap_GBP", "Down:IndexCurve/GBP-LIBOR-6M/2/2Y", 69795.3, -81.1438},
769 {"3_Swap_GBP", "Down:IndexCurve/GBP-LIBOR-6M/3/3Y", 69795.3, -238.649},
770 {"3_Swap_GBP", "Down:IndexCurve/GBP-LIBOR-6M/4/5Y", 69795.3, -371.553},
771 {"3_Swap_GBP", "Down:IndexCurve/GBP-LIBOR-6M/5/7Y", 69795.3, -653.972},
772 {"3_Swap_GBP", "Down:IndexCurve/GBP-LIBOR-6M/6/10Y", 69795.3, -1341.88},
773 {"3_Swap_GBP", "Down:IndexCurve/GBP-LIBOR-6M/7/15Y", 69795.3, -2138.11},
774 {"3_Swap_GBP", "Down:IndexCurve/GBP-LIBOR-6M/8/20Y", 69795.3, -12632.5},
775 {"3_Swap_GBP", "Up:FXSpot/EURGBP/0/spot", 69795.3, -691.043},
776 {"3_Swap_GBP", "Down:FXSpot/EURGBP/0/spot", 69795.3, 705.003},
777 {"4_Swap_JPY", "Up:DiscountCurve/JPY/0/6M", 871.03, -0.00750246},
778 {"4_Swap_JPY", "Up:DiscountCurve/JPY/1/1Y", 871.03, -0.00147994},
779 {"4_Swap_JPY", "Up:DiscountCurve/JPY/2/2Y", 871.03, -0.020079},
780 {"4_Swap_JPY", "Up:DiscountCurve/JPY/3/3Y", 871.03, -0.0667249},
781 {"4_Swap_JPY", "Up:DiscountCurve/JPY/4/5Y", 871.03, 4.75708},
782 {"4_Swap_JPY", "Down:DiscountCurve/JPY/0/6M", 871.03, 0.00747801},
783 {"4_Swap_JPY", "Down:DiscountCurve/JPY/1/1Y", 871.03, 0.00140807},
784 {"4_Swap_JPY", "Down:DiscountCurve/JPY/2/2Y", 871.03, 0.0199001},
785 {"4_Swap_JPY", "Down:DiscountCurve/JPY/3/3Y", 871.03, 0.0664106},
786 {"4_Swap_JPY", "Down:DiscountCurve/JPY/4/5Y", 871.03, -4.75978},
787 {"4_Swap_JPY", "Up:IndexCurve/JPY-LIBOR-6M/0/6M", 871.03, -193.514},
788 {"4_Swap_JPY", "Up:IndexCurve/JPY-LIBOR-6M/1/1Y", 871.03, 2.95767},
789 {"4_Swap_JPY", "Up:IndexCurve/JPY-LIBOR-6M/2/2Y", 871.03, 7.81453},
790 {"4_Swap_JPY", "Up:IndexCurve/JPY-LIBOR-6M/3/3Y", 871.03, 19.3576},
791 {"4_Swap_JPY", "Up:IndexCurve/JPY-LIBOR-6M/4/5Y", 871.03, 3832.83},
792 {"4_Swap_JPY", "Down:IndexCurve/JPY-LIBOR-6M/0/6M", 871.03, 193.528},
793 {"4_Swap_JPY", "Down:IndexCurve/JPY-LIBOR-6M/1/1Y", 871.03, -2.90067},
794 {"4_Swap_JPY", "Down:IndexCurve/JPY-LIBOR-6M/2/2Y", 871.03, -7.6631},
795 {"4_Swap_JPY", "Down:IndexCurve/JPY-LIBOR-6M/3/3Y", 871.03, -19.0907},
796 {"4_Swap_JPY", "Down:IndexCurve/JPY-LIBOR-6M/4/5Y", 871.03, -3832.59},
797 {"4_Swap_JPY", "Up:FXSpot/EURJPY/0/spot", 871.03, -8.62406},
798 {"4_Swap_JPY", "Down:FXSpot/EURJPY/0/spot", 871.03, 8.79829},
799 {"5_Swaption_EUR", "Up:DiscountCurve/EUR/6/10Y", 37524.3, -10.0118},
800 {"5_Swaption_EUR", "Up:DiscountCurve/EUR/7/15Y", 37524.3, -28.0892},
801 {"5_Swaption_EUR", "Up:DiscountCurve/EUR/8/20Y", 37524.3, -17.527},
802 {"5_Swaption_EUR", "Down:DiscountCurve/EUR/6/10Y", 37524.3, 10.0186},
803 {"5_Swaption_EUR", "Down:DiscountCurve/EUR/7/15Y", 37524.3, 28.117},
804 {"5_Swaption_EUR", "Down:DiscountCurve/EUR/8/20Y", 37524.3, 17.5502},
805 {"5_Swaption_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/6/10Y", 37524.3, -395.215},
806 {"5_Swaption_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/7/15Y", 37524.3, 56.7319},
807 {"5_Swaption_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/8/20Y", 37524.3, 722.287},
808 {"5_Swaption_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/6/10Y", 37524.3, 397.907},
809 {"5_Swaption_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/7/15Y", 37524.3, -56.508},
810 {"5_Swaption_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/8/20Y", 37524.3, -713.45},
811 {"5_Swaption_EUR", "Up:SwaptionVolatility/EUR/5/10Y/10Y/ATM", 37524.3, 367.609},
812 {"5_Swaption_EUR", "Down:SwaptionVolatility/EUR/5/10Y/10Y/ATM", 37524.3, -367.608},
813 {"6_Swaption_EUR", "Up:DiscountCurve/EUR/2/2Y", 10738, -0.485552},
814 {"6_Swaption_EUR", "Up:DiscountCurve/EUR/3/3Y", 10738, -1.09018},
815 {"6_Swaption_EUR", "Up:DiscountCurve/EUR/4/5Y", 10738, -1.98726},
816 {"6_Swaption_EUR", "Up:DiscountCurve/EUR/5/7Y", 10738, -0.591243},
817 {"6_Swaption_EUR", "Up:DiscountCurve/EUR/6/10Y", 10738, 0.00670807},
818 {"6_Swaption_EUR", "Down:DiscountCurve/EUR/2/2Y", 10738, 0.485614},
819 {"6_Swaption_EUR", "Down:DiscountCurve/EUR/3/3Y", 10738, 1.09029},
820 {"6_Swaption_EUR", "Down:DiscountCurve/EUR/4/5Y", 10738, 1.9877},
821 {"6_Swaption_EUR", "Down:DiscountCurve/EUR/5/7Y", 10738, 0.591282},
822 {"6_Swaption_EUR", "Down:DiscountCurve/EUR/6/10Y", 10738, -0.00670808},
823 {"6_Swaption_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/2/2Y", 10738, -97.3791},
824 {"6_Swaption_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/3/3Y", 10738, 4.0232},
825 {"6_Swaption_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/4/5Y", 10738, 8.90271},
826 {"6_Swaption_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/5/7Y", 10738, 322.893},
827 {"6_Swaption_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/6/10Y", 10738, 1.23647},
828 {"6_Swaption_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/2/2Y", 10738, 97.9474},
829 {"6_Swaption_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/3/3Y", 10738, -3.98874},
830 {"6_Swaption_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/4/5Y", 10738, -8.83916},
831 {"6_Swaption_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/5/7Y", 10738, -316.846},
832 {"6_Swaption_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/6/10Y", 10738, -1.23638},
833 {"6_Swaption_EUR", "Up:SwaptionVolatility/EUR/0/2Y/5Y/ATM", 10738, 102.503},
834 {"6_Swaption_EUR", "Up:SwaptionVolatility/EUR/2/5Y/5Y/ATM", 10738, 0.187152},
835 {"6_Swaption_EUR", "Down:SwaptionVolatility/EUR/0/2Y/5Y/ATM", 10738, -102.502},
836 {"6_Swaption_EUR", "Down:SwaptionVolatility/EUR/2/5Y/5Y/ATM", 10738, -0.187152},
837 {"7_FxOption_EUR_USD", "Up:DiscountCurve/EUR/3/3Y", 1.36968e+06, -2107.81},
838 {"7_FxOption_EUR_USD", "Up:DiscountCurve/EUR/4/5Y", 1.36968e+06, -3.85768},
839 {"7_FxOption_EUR_USD", "Up:DiscountCurve/USD/3/3Y", 1.36968e+06, 1698.91},
840 {"7_FxOption_EUR_USD", "Up:DiscountCurve/USD/4/5Y", 1.36968e+06, 3.10717},
841 {"7_FxOption_EUR_USD", "Down:DiscountCurve/EUR/3/3Y", 1.36968e+06, 2109.74},
842 {"7_FxOption_EUR_USD", "Down:DiscountCurve/EUR/4/5Y", 1.36968e+06, 3.85768},
843 {"7_FxOption_EUR_USD", "Down:DiscountCurve/USD/3/3Y", 1.36968e+06, -1698.12},
844 {"7_FxOption_EUR_USD", "Down:DiscountCurve/USD/4/5Y", 1.36968e+06, -3.10717},
845 {"7_FxOption_EUR_USD", "Up:FXSpot/EURUSD/0/spot", 1.36968e+06, 56850.7},
846 {"7_FxOption_EUR_USD", "Down:FXSpot/EURUSD/0/spot", 1.36968e+06, -56537.6},
847 {"7_FxOption_EUR_USD", "Up:FXVolatility/EURUSD/0/5Y/ATM", 1.36968e+06, 672236},
848 {"7_FxOption_EUR_USD", "Down:FXVolatility/EURUSD/0/5Y/ATM", 1.36968e+06, -329688},
849 {"8_FxOption_EUR_GBP", "Up:DiscountCurve/EUR/5/7Y", 798336, -2435.22},
850 {"8_FxOption_EUR_GBP", "Up:DiscountCurve/GBP/5/7Y", 798336, 1880.89},
851 {"8_FxOption_EUR_GBP", "Down:DiscountCurve/EUR/5/7Y", 798336, 2441.08},
852 {"8_FxOption_EUR_GBP", "Down:DiscountCurve/GBP/5/7Y", 798336, -1878.05},
853 {"8_FxOption_EUR_GBP", "Up:FXSpot/EURGBP/0/spot", 798336, 27009.9},
854 {"8_FxOption_EUR_GBP", "Down:FXSpot/EURGBP/0/spot", 798336, -26700.2},
855 {"8_FxOption_EUR_GBP", "Up:FXVolatility/EURGBP/0/5Y/ATM", 798336, 1.36635e+06},
856 {"8_FxOption_EUR_GBP", "Down:FXVolatility/EURGBP/0/5Y/ATM", 798336, -798336},
857 {"9_Cap_EUR", "Up:DiscountCurve/EUR/2/2Y", 289.105, -7.28588e-07},
858 {"9_Cap_EUR", "Up:DiscountCurve/EUR/3/3Y", 289.105, -0.000381869},
859 {"9_Cap_EUR", "Up:DiscountCurve/EUR/4/5Y", 289.105, -0.00790528},
860 {"9_Cap_EUR", "Up:DiscountCurve/EUR/5/7Y", 289.105, -0.0764893},
861 {"9_Cap_EUR", "Up:DiscountCurve/EUR/6/10Y", 289.105, -0.162697},
862 {"9_Cap_EUR", "Down:DiscountCurve/EUR/2/2Y", 289.105, 7.28664e-07},
863 {"9_Cap_EUR", "Down:DiscountCurve/EUR/3/3Y", 289.105, 0.000381934},
864 {"9_Cap_EUR", "Down:DiscountCurve/EUR/4/5Y", 289.105, 0.00790776},
865 {"9_Cap_EUR", "Down:DiscountCurve/EUR/5/7Y", 289.105, 0.0765231},
866 {"9_Cap_EUR", "Down:DiscountCurve/EUR/6/10Y", 289.105, 0.162824},
867 {"9_Cap_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/1/1Y", 289.105, -1.81582e-05},
868 {"9_Cap_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/2/2Y", 289.105, -0.00670729},
869 {"9_Cap_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/3/3Y", 289.105, -0.330895},
870 {"9_Cap_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/4/5Y", 289.105, -2.03937},
871 {"9_Cap_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/5/7Y", 289.105, -6.42991},
872 {"9_Cap_EUR", "Up:IndexCurve/EUR-EURIBOR-6M/6/10Y", 289.105, 15.5182},
873 {"9_Cap_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/1/1Y", 289.105, 1.97218e-05},
874 {"9_Cap_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/2/2Y", 289.105, 0.00746096},
875 {"9_Cap_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/3/3Y", 289.105, 0.353405},
876 {"9_Cap_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/4/5Y", 289.105, 2.24481},
877 {"9_Cap_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/5/7Y", 289.105, 7.1522},
878 {"9_Cap_EUR", "Down:IndexCurve/EUR-EURIBOR-6M/6/10Y", 289.105, -14.6675},
879 {"9_Cap_EUR", "Up:OptionletVolatility/EUR/4/1Y/0.05", 289.105, 8.49293e-05},
880 {"9_Cap_EUR", "Up:OptionletVolatility/EUR/9/2Y/0.05", 289.105, 0.0150901},
881 {"9_Cap_EUR", "Up:OptionletVolatility/EUR/14/3Y/0.05", 289.105, 0.620393},
882 {"9_Cap_EUR", "Up:OptionletVolatility/EUR/19/5Y/0.05", 289.105, 17.2057},
883 {"9_Cap_EUR", "Up:OptionletVolatility/EUR/24/10Y/0.05", 289.105, 24.4267},
884 {"9_Cap_EUR", "Down:OptionletVolatility/EUR/4/1Y/0.05", 289.105, -6.97789e-05},
885 {"9_Cap_EUR", "Down:OptionletVolatility/EUR/9/2Y/0.05", 289.105, -0.0125099},
886 {"9_Cap_EUR", "Down:OptionletVolatility/EUR/14/3Y/0.05", 289.105, -0.554344},
887 {"9_Cap_EUR", "Down:OptionletVolatility/EUR/19/5Y/0.05", 289.105, -16.1212},
888 {"9_Cap_EUR", "Down:OptionletVolatility/EUR/24/10Y/0.05", 289.105, -23.0264},
889 {"10_Floor_USD", "Up:DiscountCurve/USD/0/6M", 3406.46, -7.03494e-09},
890 {"10_Floor_USD", "Up:DiscountCurve/USD/1/1Y", 3406.46, -8.41429e-05},
891 {"10_Floor_USD", "Up:DiscountCurve/USD/2/2Y", 3406.46, -0.00329744},
892 {"10_Floor_USD", "Up:DiscountCurve/USD/3/3Y", 3406.46, -0.053884},
893 {"10_Floor_USD", "Up:DiscountCurve/USD/4/5Y", 3406.46, -0.269714},
894 {"10_Floor_USD", "Up:DiscountCurve/USD/5/7Y", 3406.46, -0.989583},
895 {"10_Floor_USD", "Up:DiscountCurve/USD/6/10Y", 3406.46, -1.26544},
896 {"10_Floor_USD", "Down:DiscountCurve/USD/0/6M", 3406.46, 7.0354e-09},
897 {"10_Floor_USD", "Down:DiscountCurve/USD/1/1Y", 3406.46, 8.41464e-05},
898 {"10_Floor_USD", "Down:DiscountCurve/USD/2/2Y", 3406.46, 0.00329786},
899 {"10_Floor_USD", "Down:DiscountCurve/USD/3/3Y", 3406.46, 0.0538949},
900 {"10_Floor_USD", "Down:DiscountCurve/USD/4/5Y", 3406.46, 0.269802},
901 {"10_Floor_USD", "Down:DiscountCurve/USD/5/7Y", 3406.46, 0.990038},
902 {"10_Floor_USD", "Down:DiscountCurve/USD/6/10Y", 3406.46, 1.26635},
903 {"10_Floor_USD", "Up:IndexCurve/USD-LIBOR-3M/0/6M", 3406.46, 0.00150733},
904 {"10_Floor_USD", "Up:IndexCurve/USD-LIBOR-3M/1/1Y", 3406.46, 0.240284},
905 {"10_Floor_USD", "Up:IndexCurve/USD-LIBOR-3M/2/2Y", 3406.46, 2.17175},
906 {"10_Floor_USD", "Up:IndexCurve/USD-LIBOR-3M/3/3Y", 3406.46, 7.77249},
907 {"10_Floor_USD", "Up:IndexCurve/USD-LIBOR-3M/4/5Y", 3406.46, 12.9642},
908 {"10_Floor_USD", "Up:IndexCurve/USD-LIBOR-3M/5/7Y", 3406.46, 16.8269},
909 {"10_Floor_USD", "Up:IndexCurve/USD-LIBOR-3M/6/10Y", 3406.46, -81.4363},
910 {"10_Floor_USD", "Down:IndexCurve/USD-LIBOR-3M/0/6M", 3406.46, -0.00139804},
911 {"10_Floor_USD", "Down:IndexCurve/USD-LIBOR-3M/1/1Y", 3406.46, -0.230558},
912 {"10_Floor_USD", "Down:IndexCurve/USD-LIBOR-3M/2/2Y", 3406.46, -2.00123},
913 {"10_Floor_USD", "Down:IndexCurve/USD-LIBOR-3M/3/3Y", 3406.46, -7.14862},
914 {"10_Floor_USD", "Down:IndexCurve/USD-LIBOR-3M/4/5Y", 3406.46, -11.2003},
915 {"10_Floor_USD", "Down:IndexCurve/USD-LIBOR-3M/5/7Y", 3406.46, -13.7183},
916 {"10_Floor_USD", "Down:IndexCurve/USD-LIBOR-3M/6/10Y", 3406.46, 84.0113},
917 {"10_Floor_USD", "Up:FXSpot/EURUSD/0/spot", 3406.46, -33.7273},
918 {"10_Floor_USD", "Down:FXSpot/EURUSD/0/spot", 3406.46, 34.4087},
919 {"10_Floor_USD", "Up:OptionletVolatility/USD/0/1Y/0.01", 3406.46, 0.402913},
920 {"10_Floor_USD", "Up:OptionletVolatility/USD/5/2Y/0.01", 3406.46, 3.32861},
921 {"10_Floor_USD", "Up:OptionletVolatility/USD/10/3Y/0.01", 3406.46, 16.8798},
922 {"10_Floor_USD", "Up:OptionletVolatility/USD/15/5Y/0.01", 3406.46, 96.415},
923 {"10_Floor_USD", "Up:OptionletVolatility/USD/20/10Y/0.01", 3406.46, 92.2212},
924 {"10_Floor_USD", "Down:OptionletVolatility/USD/0/1Y/0.01", 3406.46, -0.37428},
925 {"10_Floor_USD", "Down:OptionletVolatility/USD/5/2Y/0.01", 3406.46, -3.14445},
926 {"10_Floor_USD", "Down:OptionletVolatility/USD/10/3Y/0.01", 3406.46, -16.3074},
927 {"10_Floor_USD", "Down:OptionletVolatility/USD/15/5Y/0.01", 3406.46, -94.5309},
928 {"10_Floor_USD", "Down:OptionletVolatility/USD/20/10Y/0.01", 3406.46, -90.9303},
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955 { "12_EquityOption_SP5", "Up:DiscountCurve/USD/2/2Y", 278936, 158.718 },
956 { "12_EquityOption_SP5", "Up:DiscountCurve/USD/3/3Y", 278936, 1.31198 },
957 { "12_EquityOption_SP5", "Down:DiscountCurve/USD/2/2Y", 278936, -158.676 },
958 { "12_EquityOption_SP5", "Down:DiscountCurve/USD/3/3Y", 278936, -1.31197 },
959 { "12_EquityOption_SP5", "Up:FXSpot/EURUSD/0/spot", 278936, -2761.74 },
960 { "12_EquityOption_SP5", "Down:FXSpot/EURUSD/0/spot", 278936, 2817.53 },
961 { "12_EquityOption_SP5", "Up:EquitySpot/SP5/0/spot", 278936, 10869.4 },
962 { "12_EquityOption_SP5", "Down:EquitySpot/SP5/0/spot", 278936, -10681 },
963 { "12_EquityOption_SP5", "Up:EquityVolatility/SP5/5/2Y/ATM", 278936, 2388.21 },
964 { "12_EquityOption_SP5", "Down:EquityVolatility/SP5/5/2Y/ATM", 278936, -2388.67 },
965 { "13_EquityOption_Lufthansa", "Up:DiscountCurve/EUR/2/2Y", 1830.8, 0.854602 },
966 { "13_EquityOption_Lufthansa", "Up:DiscountCurve/EUR/3/3Y", 1830.8, 0.0070644 },
967 { "13_EquityOption_Lufthansa", "Down:DiscountCurve/EUR/2/2Y", 1830.8, -0.854422 },
968 { "13_EquityOption_Lufthansa", "Down:DiscountCurve/EUR/3/3Y", 1830.8, -0.00706439 },
969 { "13_EquityOption_Lufthansa", "Up:EquitySpot/Lufthansa/0/spot", 1830.8, 61.7512 },
970 { "13_EquityOption_Lufthansa", "Down:EquitySpot/Lufthansa/0/spot", 1830.8, -60.866 },
971 { "13_EquityOption_Lufthansa", "Up:EquityVolatility/Lufthansa/5/2Y/ATM", 1830.8, 15.975 },
972 { "13_EquityOption_Lufthansa", "Down:EquityVolatility/Lufthansa/5/2Y/ATM", 1830.8, -15.9808 },
973 {"14_YoYInflationCap_UKRPI", "Up:DiscountCurve/GBP/1/1Y", 3495.36, -0.0190824},
974 {"14_YoYInflationCap_UKRPI", "Up:DiscountCurve/GBP/2/2Y", 3495.36, -0.0518755},
975 {"14_YoYInflationCap_UKRPI", "Up:DiscountCurve/GBP/3/3Y", 3495.36, -0.159743},
976 {"14_YoYInflationCap_UKRPI", "Up:DiscountCurve/GBP/4/5Y", 3495.36, -0.346412},
977 {"14_YoYInflationCap_UKRPI", "Up:DiscountCurve/GBP/5/7Y", 3495.36, -0.701974},
978 {"14_YoYInflationCap_UKRPI", "Up:DiscountCurve/GBP/6/10Y", 3495.36, -0.837257},
979 {"14_YoYInflationCap_UKRPI", "Down:DiscountCurve/GBP/1/1Y", 3495.36, 0.0190843},
980 {"14_YoYInflationCap_UKRPI", "Down:DiscountCurve/GBP/2/2Y", 3495.36, 0.0518857},
981 {"14_YoYInflationCap_UKRPI", "Down:DiscountCurve/GBP/3/3Y", 3495.36, 0.159784},
982 {"14_YoYInflationCap_UKRPI", "Down:DiscountCurve/GBP/4/5Y", 3495.36, 0.346541},
983 {"14_YoYInflationCap_UKRPI", "Down:DiscountCurve/GBP/5/7Y", 3495.36, 0.702328},
984 {"14_YoYInflationCap_UKRPI", "Down:DiscountCurve/GBP/6/10Y", 3495.36, 0.83791},
985 {"14_YoYInflationCap_UKRPI", "Up:FXSpot/EURGBP/0/spot", 3495.36, -34.6075},
986 {"14_YoYInflationCap_UKRPI", "Down:FXSpot/EURGBP/0/spot", 3495.36, 35.3067},
987 {"14_YoYInflationCap_UKRPI", "Up:YoYInflationCurve/UKRP1/0/1Y", 3495.36, 6.11718},
988 {"14_YoYInflationCap_UKRPI", "Up:YoYInflationCurve/UKRP1/1/2Y", 3495.36, 5.77751},
989 {"14_YoYInflationCap_UKRPI", "Up:YoYInflationCurve/UKRP1/2/3Y", 3495.36, 8.22785},
990 {"14_YoYInflationCap_UKRPI", "Up:YoYInflationCurve/UKRP1/3/5Y", 3495.36, 10.2605},
991 {"14_YoYInflationCap_UKRPI", "Up:YoYInflationCurve/UKRP1/4/7Y", 3495.36, 11.7006},
992 {"14_YoYInflationCap_UKRPI", "Up:YoYInflationCurve/UKRP1/5/10Y", 3495.36, 8.6242},
993 {"14_YoYInflationCap_UKRPI", "Down:YoYInflationCurve/UKRP1/0/1Y", 3495.36, -5.99639},
994 {"14_YoYInflationCap_UKRPI", "Down:YoYInflationCurve/UKRP1/1/2Y", 3495.36, -5.6966},
995 {"14_YoYInflationCap_UKRPI", "Down:YoYInflationCurve/UKRP1/2/3Y", 3495.36, -8.15092},
996 {"14_YoYInflationCap_UKRPI", "Down:YoYInflationCurve/UKRP1/3/5Y", 3495.36, -10.1917},
997 {"14_YoYInflationCap_UKRPI", "Down:YoYInflationCurve/UKRP1/4/7Y", 3495.36, -11.6375},
998 {"14_YoYInflationCap_UKRPI", "Down:YoYInflationCurve/UKRP1/5/10Y", 3495.36, -8.58138},
999 {"14_YoYInflationCap_UKRPI", "Up:YoYInflationCapFloorVolatility/UKRP1/4/1Y/0.02", 3495.36, 0.706362},
1000 {"14_YoYInflationCap_UKRPI", "Up:YoYInflationCapFloorVolatility/UKRP1/10/2Y/0.02", 3495.36, 0.575052},
1001 {"14_YoYInflationCap_UKRPI", "Up:YoYInflationCapFloorVolatility/UKRP1/16/3Y/0.02", 3495.36, 1.21162},
1002 {"14_YoYInflationCap_UKRPI", "Up:YoYInflationCapFloorVolatility/UKRP1/22/5Y/0.02", 3495.36, 1.83575},
1003 {"14_YoYInflationCap_UKRPI", "Up:YoYInflationCapFloorVolatility/UKRP1/28/7Y/0.02", 3495.36, 2.52242},
1004 {"14_YoYInflationCap_UKRPI", "Up:YoYInflationCapFloorVolatility/UKRP1/34/10Y/0.02", 3495.36, 1.8872},
1005 {"14_YoYInflationCap_UKRPI", "Down:YoYInflationCapFloorVolatility/UKRP1/4/1Y/0.02", 3495.36, -0.706362},
1006 {"14_YoYInflationCap_UKRPI", "Down:YoYInflationCapFloorVolatility/UKRP1/10/2Y/0.02", 3495.36, -0.575052},
1007 {"14_YoYInflationCap_UKRPI", "Down:YoYInflationCapFloorVolatility/UKRP1/16/3Y/0.02", 3495.36, -1.21162},
1008 {"14_YoYInflationCap_UKRPI", "Down:YoYInflationCapFloorVolatility/UKRP1/22/5Y/0.02", 3495.36, -1.83575},
1009 {"14_YoYInflationCap_UKRPI", "Down:YoYInflationCapFloorVolatility/UKRP1/28/7Y/0.02", 3495.36, -2.52242},
1010 {"14_YoYInflationCap_UKRPI", "Down:YoYInflationCapFloorVolatility/UKRP1/34/10Y/0.02", 3495.36, -1.8872}};
1011
1012 std::map<pair<string, string>, Real> npvMap, sensiMap;
1013 for (Size i = 0; i < cachedResults.size(); ++i) {
1014 pair<string, string> p(cachedResults[i].id, cachedResults[i].label);
1015 npvMap[p] = cachedResults[i].npv;
1016 sensiMap[p] = cachedResults[i].sensi;
1017 }
1018 vector<pair<string, string>> ids;
1019 Real tiny = 1.0e-10;
1020 Real tolerance = 0.01;
1022 vector<ShiftScenarioGenerator::ScenarioDescription> desc = scenarioGenerator->scenarioDescriptions();
1023 size_t currentTradeIdx = 0;
1024 for (const auto& [tradeId, _] : portfolio->trades()) {
1025 Real npv0 = cube->getT0(currentTradeIdx, 0);
1026 for (Size j = 1; j < scenarioGenerator->samples(); ++j) {
1027 Real npv = cube->get(currentTradeIdx, 0, j, 0);
1028 Real sensi = npv - npv0;
1030 if (fabs(sensi) > tiny) {
1032
1033 pair<string, string> p(tradeId, label);
1034 ids.push_back(p);
1035 QL_REQUIRE(npvMap.find(p) != npvMap.end(),
1036 "pair (" << p.first << ", " << p.second << ") not found in npv map");
1037 QL_REQUIRE(sensiMap.find(p) != sensiMap.end(),
1038 "pair (" << p.first << ", " << p.second << ") not found in sensi map");
1039 BOOST_CHECK_MESSAGE(fabs(npv0 - npvMap[p]) < tolerance || fabs((npv0 - npvMap[p]) / npv0) < tolerance,
1040 "npv regression failed for pair (" << p.first << ", " << p.second << "): " << npv0
1041 << " vs " << npvMap[p]);
1042 BOOST_CHECK_MESSAGE(fabs(sensi - sensiMap[p]) < tolerance ||
1043 fabs((sensi - sensiMap[p]) / sensi) < tolerance,
1044 "sensitivity regression failed for pair ("
1045 << p.first << ", " << p.second << "): " << sensi << " vs " << sensiMap[p]);
1046
1047
1048
1049 }
1050 }
1051 currentTradeIdx++;
1052 }
1053 BOOST_CHECK_MESSAGE(count == cachedResults.size(), "number of non-zero sensitivities ("
1054 << count << ") do not match regression data ("
1055 << cachedResults.size() << ")");
1056
1057 BOOST_TEST_MESSAGE("Cube generated in " << elapsed << " seconds");
1058 ObservationMode::instance().setMode(backupMode);
1059 IndexManager::instance().clearHistories();
1060}
std::string to_string(const LocationInfo &l)
QuantLib::ext::shared_ptr< Trade > buildCap(string id, string ccy, string longShort, Real capRate, Real notional, int start, Size term, string floatFreq, string floatDC, string index, Calendar calendar, Natural spotDays, bool spotStartLag)
QuantLib::ext::shared_ptr< Trade > buildFxOption(string id, string longShort, string putCall, Size expiry, string boughtCcy, Real boughtAmount, string soldCcy, Real soldAmount, Real premium, string premiumCcy, string premiumDate)
QuantLib::ext::shared_ptr< Trade > buildSwap(string id, string ccy, bool isPayer, Real notional, int start, Size term, Real rate, Real spread, string fixedFreq, string fixedDC, string floatFreq, string floatDC, string index, Calendar calendar, Natural spotDays, bool spotStartLag)
QuantLib::ext::shared_ptr< Trade > buildEquityOption(string id, string longShort, string putCall, Size expiry, string equityName, string currency, Real strike, Real quantity, Real premium, string premiumCcy, string premiumDate)
QuantLib::ext::shared_ptr< Trade > buildFloor(string id, string ccy, string longShort, Real floorRate, Real notional, int start, Size term, string floatFreq, string floatDC, string index, Calendar calendar, Natural spotDays, bool spotStartLag)
QuantLib::ext::shared_ptr< Trade > buildEuropeanSwaption(string id, string longShort, string ccy, bool isPayer, Real notional, int start, Size term, Real rate, Real spread, string fixedFreq, string fixedDC, string floatFreq, string floatDC, string index, string cashPhysical, Real premium, string premiumCcy, string premiumDate)
QuantLib::ext::shared_ptr< Trade > buildYYInflationCapFloor(string id, string ccy, Real notional, bool isCap, bool isLong, Real capFloorRate, int start, Size term, string yyFreq, string yyDC, string yyIndex, string observationLag, Size fixDays)
QuantLib::ext::shared_ptr< SensitivityScenarioData > setupSensitivityScenarioData5(bool parConversion)
QuantLib::ext::shared_ptr< analytics::ScenarioSimMarketParameters > setupSimMarketData5()