FundingCurveQuoteSensitivity.java

  1. package org.drip.sample.sensitivity;

  2. import org.drip.analytics.date.*;
  3. import org.drip.function.r1tor1.QuadraticRationalShapeControl;
  4. import org.drip.market.otc.*;
  5. import org.drip.numerical.common.FormatUtil;
  6. import org.drip.numerical.differentiation.WengertJacobian;
  7. import org.drip.param.creator.*;
  8. import org.drip.param.valuation.*;
  9. import org.drip.product.creator.*;
  10. import org.drip.product.definition.*;
  11. import org.drip.product.rates.*;
  12. import org.drip.service.env.EnvManager;
  13. import org.drip.spline.basis.*;
  14. import org.drip.spline.params.*;
  15. import org.drip.spline.stretch.*;
  16. import org.drip.state.creator.ScenarioDiscountCurveBuilder;
  17. import org.drip.state.discount.*;
  18. import org.drip.state.estimator.LatentStateStretchBuilder;
  19. import org.drip.state.identifier.*;
  20. import org.drip.state.inference.*;

  21. /*
  22.  * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  23.  */

  24. /*!
  25.  * Copyright (C) 2018 Lakshmi Krishnamurthy
  26.  * Copyright (C) 2017 Lakshmi Krishnamurthy
  27.  * Copyright (C) 2016 Lakshmi Krishnamurthy
  28.  * Copyright (C) 2015 Lakshmi Krishnamurthy
  29.  * Copyright (C) 2014 Lakshmi Krishnamurthy
  30.  * Copyright (C) 2013 Lakshmi Krishnamurthy
  31.  *
  32.  *  This file is part of DRIP, a free-software/open-source library for buy/side financial/trading model
  33.  *      libraries targeting analysts and developers
  34.  *      https://lakshmidrip.github.io/DRIP/
  35.  *  
  36.  *  DRIP is composed of four main libraries:
  37.  *  
  38.  *  - DRIP Fixed Income - https://lakshmidrip.github.io/DRIP-Fixed-Income/
  39.  *  - DRIP Asset Allocation - https://lakshmidrip.github.io/DRIP-Asset-Allocation/
  40.  *  - DRIP Numerical Optimizer - https://lakshmidrip.github.io/DRIP-Numerical-Optimizer/
  41.  *  - DRIP Statistical Learning - https://lakshmidrip.github.io/DRIP-Statistical-Learning/
  42.  *
  43.  *  - DRIP Fixed Income: Library for Instrument/Trading Conventions, Treasury Futures/Options,
  44.  *      Funding/Forward/Overnight Curves, Multi-Curve Construction/Valuation, Collateral Valuation and XVA
  45.  *      Metric Generation, Calibration and Hedge Attributions, Statistical Curve Construction, Bond RV
  46.  *      Metrics, Stochastic Evolution and Option Pricing, Interest Rate Dynamics and Option Pricing, LMM
  47.  *      Extensions/Calibrations/Greeks, Algorithmic Differentiation, and Asset Backed Models and Analytics.
  48.  *
  49.  *  - DRIP Asset Allocation: Library for model libraries for MPT framework, Black Litterman Strategy
  50.  *      Incorporator, Holdings Constraint, and Transaction Costs.
  51.  *
  52.  *  - DRIP Numerical Optimizer: Library for Numerical Optimization and Spline Functionality.
  53.  *
  54.  *  - DRIP Statistical Learning: Library for Statistical Evaluation and Machine Learning.
  55.  *
  56.  *  Licensed under the Apache License, Version 2.0 (the "License");
  57.  *      you may not use this file except in compliance with the License.
  58.  *  
  59.  *  You may obtain a copy of the License at
  60.  *      http://www.apache.org/licenses/LICENSE-2.0
  61.  *  
  62.  *  Unless required by applicable law or agreed to in writing, software
  63.  *      distributed under the License is distributed on an "AS IS" BASIS,
  64.  *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  65.  *  
  66.  *  See the License for the specific language governing permissions and
  67.  *      limitations under the License.
  68.  */

  69. /**
  70.  * FundingCurveQuoteSensitivity demonstrates the calculation of the Funding curve sensitivity to the
  71.  *  calibration instrument quotes. It does the following:
  72.  *  - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters.
  73.  *  - Construct the Cash/Swap Instrument Set Stretch Builder.
  74.  *  - Set up the Linear Curve Calibrator using the following parameters:
  75.  *      - Cubic Exponential Mixture Basis Spline Set
  76.  *      - Ck = 2, Segment Curvature Penalty = 2
  77.  *      - Quadratic Rational Shape Controller
  78.  *      - Natural Boundary Setting
  79.  *  - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array
  80.  *      of Cash and Swap Stretches.
  81.  *  - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve
  82.  *      construction methodologies.
  83.  *  - Display of the Cash Instrument Discount Factor Quote Jacobian Sensitivities.
  84.  *  - Display of the Swap Instrument Discount Factor Quote Jacobian Sensitivities.
  85.  *
  86.  * @author Lakshmi Krishnamurthy
  87.  */

  88. public class FundingCurveQuoteSensitivity {

  89.     private static final FixFloatComponent OTCIRS (
  90.         final JulianDate dtSpot,
  91.         final String strCurrency,
  92.         final String strMaturityTenor,
  93.         final double dblCoupon)
  94.     {
  95.         FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction (
  96.             strCurrency,
  97.             "ALL",
  98.             strMaturityTenor,
  99.             "MAIN"
  100.         );

  101.         return ffConv.createFixFloatComponent (
  102.             dtSpot,
  103.             strMaturityTenor,
  104.             dblCoupon,
  105.             0.,
  106.             1.
  107.         );
  108.     }

  109.     /*
  110.      * Construct the Array of Deposit Instruments from the given set of parameters
  111.      *
  112.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  113.      */

  114.     private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays (
  115.         final JulianDate dtEffective,
  116.         final String strCurrency,
  117.         final int[] aiDay)
  118.         throws Exception
  119.     {
  120.         SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length];

  121.         for (int i = 0; i < aiDay.length; ++i)
  122.             aDeposit[i] = SingleStreamComponentBuilder.Deposit (
  123.                 dtEffective,
  124.                 dtEffective.addBusDays (
  125.                     aiDay[i],
  126.                     strCurrency
  127.                 ),
  128.                 OvernightLabel.Create (
  129.                     strCurrency
  130.                 )
  131.             );

  132.         return aDeposit;
  133.     }

  134.     /*
  135.      * Construct the Array of Swap Instruments from the given set of parameters
  136.      *
  137.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  138.      */

  139.     private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor (
  140.         final JulianDate dtSpot,
  141.         final String strCurrency,
  142.         final String[] astrMaturityTenor)
  143.         throws Exception
  144.     {
  145.         FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length];

  146.         for (int i = 0; i < astrMaturityTenor.length; ++i) {
  147.             FixFloatComponent irs = OTCIRS (
  148.                 dtSpot,
  149.                 strCurrency,
  150.                 astrMaturityTenor[i],
  151.                 0.
  152.             );

  153.             irs.setPrimaryCode ("IRS." + astrMaturityTenor[i] + "." + strCurrency);

  154.             aIRS[i] = irs;
  155.         }

  156.         return aIRS;
  157.     }

  158.     private static final void TenorJack (
  159.         final JulianDate dtStart,
  160.         final String strTenor,
  161.         final String strCurrency,
  162.         final String strManifestMeasure,
  163.         final MergedDiscountForwardCurve dc)
  164.         throws Exception
  165.     {
  166.         CalibratableComponent irsBespoke = OTCIRS (
  167.             dtStart,
  168.             strCurrency,
  169.             strTenor,
  170.             0.
  171.         );

  172.         WengertJacobian wjDFQuoteBespokeMat = dc.jackDDFDManifestMeasure (
  173.             irsBespoke.maturityDate(),
  174.             strManifestMeasure
  175.         );

  176.         System.out.println (strTenor + " => " + wjDFQuoteBespokeMat.displayString());
  177.     }

  178.     private static final void Forward6MRateJack (
  179.         final JulianDate dtStart,
  180.         final String strStartTenor,
  181.         final String strManifestMeasure,
  182.         final MergedDiscountForwardCurve dc)
  183.     {
  184.         JulianDate dtBegin = dtStart.addTenor (strStartTenor);

  185.         WengertJacobian wjForwardRate = dc.jackDForwardDManifestMeasure (
  186.             dtBegin,
  187.             "6M",
  188.             strManifestMeasure,
  189.             0.5
  190.         );

  191.         System.out.println ("[" + dtBegin + " | 6M] => " + wjForwardRate.displayString());
  192.     }

  193.     /*
  194.      * This sample demonstrates the calculation of the discount curve sensitivity to the calibration
  195.      *  instrument quotes. It does the following:
  196.      *  - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters.
  197.      *  - Construct the Cash/Swap Instrument Set Stretch Builder.
  198.      *  - Set up the Linear Curve Calibrator using the following parameters:
  199.      *      - Cubic Exponential Mixture Basis Spline Set
  200.      *      - Ck = 2, Segment Curvature Penalty = 2
  201.      *      - Quadratic Rational Shape Controller
  202.      *      - Natural Boundary Setting
  203.      *  - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array
  204.      *      of Cash and Swap Stretches.
  205.      *  - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve
  206.      *      construction methodologies.
  207.      *  - Display of the Cash Instrument Discount Factor Quote Jacobian Sensitivities.
  208.      *  - Display of the Swap Instrument Discount Factor Quote Jacobian Sensitivities.
  209.      *
  210.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  211.      */

  212.     private static final void DiscountCurveQuoteSensitivitySample (
  213.         final JulianDate dtSpot,
  214.         final String strCurrency)
  215.         throws Exception
  216.     {
  217.         /*
  218.          * Construct the Array of DEPOSIT Instruments and their Quotes from the given set of parameters
  219.          */

  220.         SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays (
  221.             dtSpot,
  222.             strCurrency,
  223.             new int[] {
  224.                 1, 2, 7, 14, 30, 60
  225.             }
  226.         );

  227.         double[] adblDepositQuote = new double[] {
  228.             0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023
  229.         }; // Cash Rate

  230.         /*
  231.          * Construct the Deposit Instrument Set Stretch Builder
  232.          */

  233.         LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec (
  234.             "DEPOSIT",
  235.             aDepositComp,
  236.             "ForwardRate",
  237.             adblDepositQuote
  238.         );

  239.         /*
  240.          * Construct the Array of FUTURE Instruments and their Quotes from the given set of parameters
  241.          */

  242.         SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack (
  243.             dtSpot,
  244.             8,
  245.             strCurrency
  246.         );

  247.         double[] adblEDFQuote = new double[] {
  248.             0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160
  249.         };

  250.         /*
  251.          * Construct the EDF Instrument Set Stretch Builder
  252.          */

  253.         LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec (
  254.             "EDF",
  255.             aEDFComp,
  256.             "ForwardRate",
  257.             adblEDFQuote
  258.         );

  259.         /*
  260.          * Construct the Array of SWAP Instruments and their Quotes from the given set of parameters
  261.          */

  262.         FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor (
  263.             dtSpot,
  264.             strCurrency,
  265.             new java.lang.String[] {
  266.                 "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"
  267.             }
  268.         );

  269.         double[] adblSwapQuote = new double[] {
  270.             0.0166, 0.0206, 0.0241, 0.0269, 0.0292, 0.0311, 0.0326, 0.0340, 0.0351, 0.0375, 0.0393, 0.0402, 0.0407, 0.0409, 0.0409
  271.         };

  272.         /*
  273.          * Construct the Swap Instrument Set Stretch Builder
  274.          */

  275.         LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec (
  276.             "SWAP",
  277.             aSwapComp,
  278.             "SwapRate",
  279.             adblSwapQuote
  280.         );

  281.         LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] {
  282.             depositStretch,
  283.             edfStretch,
  284.             swapStretch
  285.         };

  286.         /*
  287.          * Set up the Linear Curve Calibrator using the following Default Segment Control parameters:
  288.          *  - Cubic Exponential Mixture Basis Spline Set
  289.          *  - Ck = 2, Segment Curvature Penalty = 2
  290.          *  - Quadratic Rational Shape Controller
  291.          *  - Prior Quote Sensitivity Control with first derivative tail fade, with FADE ON
  292.          *  - Natural Boundary Setting
  293.          */

  294.         LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator (
  295.             new SegmentCustomBuilderControl (
  296.                 MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION,
  297.                 new ExponentialTensionSetParams (2.),
  298.                 SegmentInelasticDesignControl.Create (
  299.                     2,
  300.                     2
  301.                 ),
  302.                 new ResponseScalingShapeControl (
  303.                     true,
  304.                     new QuadraticRationalShapeControl (0.)
  305.                 ),
  306.                 new org.drip.spline.params.PreceedingManifestSensitivityControl (
  307.                     true,
  308.                     1,
  309.                     null
  310.                 )
  311.             ),
  312.             BoundarySettings.NaturalStandard(),
  313.             MultiSegmentSequence.CALIBRATE,
  314.             null,
  315.             null
  316.         );

  317.         /*
  318.          * Set up the DEPOSIT Segment Control parameters with the following details:
  319.          *  - Cubic Exponential Mixture Basis Spline Set
  320.          *  - Ck = 2, Segment Curvature Penalty = 2
  321.          *  - Quadratic Rational Shape Controller
  322.          *  - Prior Quote Sensitivity Control with first derivative tail fade, with FADE ON
  323.          *  - Natural Boundary Setting
  324.          */

  325.         lcc.setStretchSegmentBuilderControl (
  326.             depositStretch.name(),
  327.             new SegmentCustomBuilderControl (
  328.                 MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION,
  329.                 new ExponentialTensionSetParams (2.),
  330.                 SegmentInelasticDesignControl.Create (
  331.                     2,
  332.                     2
  333.                 ),
  334.                 new ResponseScalingShapeControl (
  335.                     true,
  336.                     new QuadraticRationalShapeControl (0.)
  337.                 ),
  338.                 new org.drip.spline.params.PreceedingManifestSensitivityControl (
  339.                     true,
  340.                     1,
  341.                     null
  342.                 )
  343.             )
  344.         );

  345.         /*
  346.          * Set up the FUTURE Segment Control parameters with the following details:
  347.          *  - Cubic Exponential Mixture Basis Spline Set
  348.          *  - Ck = 2, Segment Curvature Penalty = 2
  349.          *  - Quadratic Rational Shape Controller
  350.          *  - Prior Quote Sensitivity Control with first derivative tail fade, with FADE OFF, RETAIN ON
  351.          *  - Natural Boundary Setting
  352.          */

  353.         lcc.setStretchSegmentBuilderControl (
  354.             edfStretch.name(),
  355.             new SegmentCustomBuilderControl (
  356.                 MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION,
  357.                 new ExponentialTensionSetParams (2.),
  358.                 SegmentInelasticDesignControl.Create (
  359.                     2,
  360.                     2
  361.                 ),
  362.                 new ResponseScalingShapeControl (
  363.                     true,
  364.                     new QuadraticRationalShapeControl (0.)
  365.                 ),
  366.                 new org.drip.spline.params.PreceedingManifestSensitivityControl (
  367.                     false,
  368.                     1,
  369.                     null
  370.                 )
  371.             )
  372.         );

  373.         /*
  374.          * Set up the SWAP Segment Control parameters with the following details:
  375.          *  - Cubic Exponential Mixture Basis Spline Set
  376.          *  - Ck = 2, Segment Curvature Penalty = 2
  377.          *  - Quadratic Rational Shape Controller
  378.          *  - Prior Quote Sensitivity Control with first derivative tail fade, with FADE ON
  379.          *  - Natural Boundary Setting
  380.          */

  381.         lcc.setStretchSegmentBuilderControl (
  382.             swapStretch.name(),
  383.             new SegmentCustomBuilderControl (
  384.                 MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION,
  385.                 new ExponentialTensionSetParams (2.),
  386.                 SegmentInelasticDesignControl.Create (
  387.                     2,
  388.                     2
  389.                 ),
  390.                 new ResponseScalingShapeControl (
  391.                     true,
  392.                     new QuadraticRationalShapeControl (0.)
  393.                 ),
  394.                 new org.drip.spline.params.PreceedingManifestSensitivityControl (
  395.                     true,
  396.                     1,
  397.                     null
  398.                 )
  399.             )
  400.         );

  401.         ValuationParams valParams = new ValuationParams (
  402.             dtSpot,
  403.             dtSpot,
  404.             strCurrency
  405.         );

  406.         /*
  407.          * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array
  408.          *  of Deposit, Futures, and Swap Stretches.
  409.          */

  410.         MergedDiscountForwardCurve dc = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild (
  411.             strCurrency,
  412.             lcc,
  413.             aStretchSpec,
  414.             valParams,
  415.             null,
  416.             null,
  417.             null,
  418.             1.
  419.         );

  420.         /*
  421.          * Cross-Comparison of the DEPOSIT Calibration Instrument "Rate" metric across the different curve
  422.          *  construction methodologies.
  423.          */

  424.         System.out.println ("\n\t----------------------------------------------------------------");

  425.         System.out.println ("\t     DEPOSIT INSTRUMENTS CALIBRATION RECOVERY");

  426.         System.out.println ("\t----------------------------------------------------------------");

  427.         for (int i = 0; i < aDepositComp.length; ++i)
  428.             System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " +
  429.                 FormatUtil.FormatDouble (aDepositComp[i].measureValue (valParams, null,
  430.                     MarketParamsBuilder.Create (dc, null, null, null, null, null, null),
  431.                         null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.));

  432.         /*
  433.          * Cross-Comparison of the FUTURE Calibration Instrument "Rate" metric across the different curve
  434.          *  construction methodologies.
  435.          */

  436.         System.out.println ("\n\t----------------------------------------------------------------");

  437.         System.out.println ("\t     FUTURE INSTRUMENTS CALIBRATION RECOVERY");

  438.         System.out.println ("\t----------------------------------------------------------------");

  439.         for (int i = 0; i < aEDFComp.length; ++i)
  440.             System.out.println ("\t[" + aEDFComp[i].maturityDate() + "] = " +
  441.                 FormatUtil.FormatDouble (aEDFComp[i].measureValue (valParams, null,
  442.                     MarketParamsBuilder.Create (dc, null, null, null, null, null, null),
  443.                         null, "Rate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblEDFQuote[i], 1, 6, 1.));

  444.         /*
  445.          * Cross-Comparison of the SWAP Calibration Instrument "Rate" metric across the different curve
  446.          *  construction methodologies.
  447.          */

  448.         System.out.println ("\n\t----------------------------------------------------------------");

  449.         System.out.println ("\t     SWAP INSTRUMENTS CALIBRATION RECOVERY");

  450.         System.out.println ("\t----------------------------------------------------------------");

  451.         for (int i = 0; i < aSwapComp.length; ++i)
  452.             System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " +
  453.                 FormatUtil.FormatDouble (aSwapComp[i].measureValue (valParams, null,
  454.                     MarketParamsBuilder.Create (dc, null, null, null, null, null, null),
  455.                         null, "CalibSwapRate"), 1, 6, 1.) + " | " + FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.));

  456.         /*
  457.          * Display of the DEPOSIT Instrument Discount Factor Quote Jacobian Sensitivities.
  458.          */

  459.         System.out.println ("\n\t----------------------------------------------------------------");

  460.         System.out.println ("\t     DEPOSIT MATURITY DISCOUNT FACTOR JACOBIAN");

  461.         System.out.println ("\t----------------------------------------------------------------");

  462.         for (int i = 0; i < aDepositComp.length; ++i) {
  463.             org.drip.numerical.differentiation.WengertJacobian wj = dc.jackDDFDManifestMeasure (aDepositComp[i].maturityDate(), "PV");

  464.             System.out.println (aDepositComp[i].maturityDate() + " => " + wj.displayString());
  465.         }

  466.         /*
  467.          * Display of the FUTURE Instrument Discount Factor Quote Jacobian Sensitivities.
  468.          */

  469.         System.out.println ("\n\t----------------------------------------------------------------");

  470.         System.out.println ("\t     FUTURE MATURITY DISCOUNT FACTOR JACOBIAN");

  471.         System.out.println ("\t----------------------------------------------------------------");

  472.         for (int i = 0; i < aEDFComp.length; ++i) {
  473.             org.drip.numerical.differentiation.WengertJacobian wj = dc.jackDDFDManifestMeasure (
  474.                 aEDFComp[i].maturityDate(),
  475.                 "PV"
  476.             );

  477.             System.out.println (aEDFComp[i].maturityDate() + " => " + wj.displayString());
  478.         }

  479.         /*
  480.          * Display of the SWAP Instrument Discount Factor Quote Jacobian Sensitivities.
  481.          */

  482.         System.out.println ("\n\t----------------------------------------------------------------");

  483.         System.out.println ("\t     SWAP MATURITY DISCOUNT FACTOR JACOBIAN");

  484.         System.out.println ("\t----------------------------------------------------------------");

  485.         for (int i = 0; i < aSwapComp.length; ++i) {
  486.             org.drip.numerical.differentiation.WengertJacobian wjDFQuote = dc.jackDDFDManifestMeasure (
  487.                 aSwapComp[i].maturityDate(),
  488.                 "PV"
  489.             );

  490.             System.out.println (aSwapComp[i].maturityDate() + " => " + wjDFQuote.displayString());
  491.         }

  492.         System.out.println ("\n\t----------------------------------------------------------------");

  493.         System.out.println ("\t     COMPONENT-BY-COMPONENT QUOTE JACOBIAN");

  494.         System.out.println ("\t----------------------------------------------------------------");

  495.         WengertJacobian wj = dc.compJackDPVDManifestMeasure (dtSpot);

  496.         System.out.println (wj.displayString());

  497.         System.out.println ("\n\t----------------------------------------------------------------");

  498.         System.out.println ("\t     BESPOKE 35Y SWAP QUOTE JACOBIAN");

  499.         System.out.println ("\t----------------------------------------------------------------");

  500.         CalibratableComponent irs35Y = OTCIRS (
  501.             dtSpot,
  502.             strCurrency,
  503.             "35Y",
  504.             0.
  505.         );

  506.         WengertJacobian wjIRSBespokeQuoteJack = irs35Y.jackDDirtyPVDManifestMeasure (
  507.             valParams,
  508.             null,
  509.             MarketParamsBuilder.Create (
  510.                 dc,
  511.                 null,
  512.                 null,
  513.                 null,
  514.                 null,
  515.                 null,
  516.                 null,
  517.                 null
  518.             ),
  519.             null
  520.         );

  521.         System.out.println (wjIRSBespokeQuoteJack.displayString());

  522.         System.out.println ("\n\t----------------------------------------------------------------");

  523.         System.out.println ("\t     BESPOKE SWAP MATURITY QUOTE JACOBIAN");

  524.         System.out.println ("\t----------------------------------------------------------------");

  525.         TenorJack (dtSpot, "30Y", strCurrency, "PV", dc);

  526.         TenorJack (dtSpot, "32Y", strCurrency, "PV", dc);

  527.         TenorJack (dtSpot, "34Y", strCurrency, "PV", dc);

  528.         TenorJack (dtSpot, "36Y", strCurrency, "PV", dc);

  529.         TenorJack (dtSpot, "38Y", strCurrency, "PV", dc);

  530.         TenorJack (dtSpot, "40Y", strCurrency, "PV", dc);

  531.         System.out.println ("\n\t----------------------------------------------------------------");

  532.         System.out.println ("\t     DISCOUNT CURVE IMPLIED 6M FORWARD RATE QUOTE JACOBIAN");

  533.         System.out.println ("\t----------------------------------------------------------------");

  534.         Forward6MRateJack (dtSpot, "1D", "PV", dc);

  535.         Forward6MRateJack (dtSpot, "3M", "PV", dc);

  536.         Forward6MRateJack (dtSpot, "6M", "PV", dc);

  537.         Forward6MRateJack (dtSpot, "1Y", "PV", dc);

  538.         Forward6MRateJack (dtSpot, "2Y", "PV", dc);

  539.         Forward6MRateJack (dtSpot, "5Y", "PV", dc);
  540.     }

  541.     public static final void main (
  542.         final String[] astrArgs)
  543.         throws Exception
  544.     {
  545.         /*
  546.          * Initialize the Credit Analytics Library
  547.          */

  548.         EnvManager.InitEnv ("");

  549.         String strCurrency = "USD";

  550.         DiscountCurveQuoteSensitivitySample (
  551.             DateUtil.Today(),
  552.             strCurrency
  553.         );
  554.     }
  555. }