TemplatedFundingCurveBuilder.java

  1. package org.drip.sample.funding;

  2. import org.drip.analytics.date.*;
  3. import org.drip.analytics.support.*;
  4. import org.drip.market.otc.*;
  5. import org.drip.numerical.common.FormatUtil;
  6. import org.drip.param.creator.*;
  7. import org.drip.param.period.*;
  8. import org.drip.param.valuation.*;
  9. import org.drip.product.definition.*;
  10. import org.drip.product.rates.*;
  11. import org.drip.service.env.EnvManager;
  12. import org.drip.state.creator.ScenarioDiscountCurveBuilder;
  13. import org.drip.state.discount.MergedDiscountForwardCurve;
  14. import org.drip.state.identifier.ForwardLabel;

  15. /*
  16.  * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  17.  */

  18. /*!
  19.  * Copyright (C) 2019 Lakshmi Krishnamurthy
  20.  * Copyright (C) 2018 Lakshmi Krishnamurthy
  21.  * Copyright (C) 2017 Lakshmi Krishnamurthy
  22.  * Copyright (C) 2016 Lakshmi Krishnamurthy
  23.  * Copyright (C) 2015 Lakshmi Krishnamurthy
  24.  * Copyright (C) 2014 Lakshmi Krishnamurthy
  25.  * Copyright (C) 2013 Lakshmi Krishnamurthy
  26.  *
  27.  *  This file is part of DROP, an open-source library targeting risk, transaction costs, exposure, margin
  28.  *      calculations, valuation adjustment, and portfolio construction within and across fixed income,
  29.  *      credit, commodity, equity, FX, and structured products.
  30.  *  
  31.  *      https://lakshmidrip.github.io/DROP/
  32.  *  
  33.  *  DROP is composed of three modules:
  34.  *  
  35.  *  - DROP Analytics Core - https://lakshmidrip.github.io/DROP-Analytics-Core/
  36.  *  - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
  37.  *  - DROP Numerical Core - https://lakshmidrip.github.io/DROP-Numerical-Core/
  38.  *
  39.  *  DROP Analytics Core implements libraries for the following:
  40.  *  - Fixed Income Analytics
  41.  *  - Asset Backed Analytics
  42.  *  - XVA Analytics
  43.  *  - Exposure and Margin Analytics
  44.  *
  45.  *  DROP Portfolio Core implements libraries for the following:
  46.  *  - Asset Allocation Analytics
  47.  *  - Transaction Cost Analytics
  48.  *
  49.  *  DROP Numerical Core implements libraries for the following:
  50.  *  - Statistical Learning
  51.  *  - Numerical Optimizer
  52.  *  - Spline Builder
  53.  *  - Algorithm Support
  54.  *
  55.  *  Documentation for DROP is Spread Over:
  56.  *
  57.  *  - Main                     => https://lakshmidrip.github.io/DROP/
  58.  *  - Wiki                     => https://github.com/lakshmiDRIP/DROP/wiki
  59.  *  - GitHub                   => https://github.com/lakshmiDRIP/DROP
  60.  *  - Repo Layout Taxonomy     => https://github.com/lakshmiDRIP/DROP/blob/master/Taxonomy.md
  61.  *  - Javadoc                  => https://lakshmidrip.github.io/DROP/Javadoc/index.html
  62.  *  - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
  63.  *  - Release Versions         => https://lakshmidrip.github.io/DROP/version.html
  64.  *  - Community Credits        => https://lakshmidrip.github.io/DROP/credits.html
  65.  *  - Issues Catalog           => https://github.com/lakshmiDRIP/DROP/issues
  66.  *  - JUnit                    => https://lakshmidrip.github.io/DROP/junit/index.html
  67.  *  - Jacoco                   => https://lakshmidrip.github.io/DROP/jacoco/index.html
  68.  *
  69.  *  Licensed under the Apache License, Version 2.0 (the "License");
  70.  *      you may not use this file except in compliance with the License.
  71.  *  
  72.  *  You may obtain a copy of the License at
  73.  *      http://www.apache.org/licenses/LICENSE-2.0
  74.  *  
  75.  *  Unless required by applicable law or agreed to in writing, software
  76.  *      distributed under the License is distributed on an "AS IS" BASIS,
  77.  *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  78.  *  
  79.  *  See the License for the specific language governing permissions and
  80.  *      limitations under the License.
  81.  */

  82. /**
  83.  * <i>TemplatedFundingCurveBuilder</i> sample demonstrates the usage of the different pre-built Funding Curve
  84.  * Builders. It shows the following:
  85.  *  
  86.  * <br><br>
  87.  *  <ul>
  88.  *      <li>
  89.  *          Construct the Array of Cash Instruments and their Quotes from the given set of parameters.
  90.  *      </li>
  91.  *      <li>
  92.  *          Construct the Array of Swap Instruments and their Quotes from the given set of parameters.
  93.  *      </li>
  94.  *      <li>
  95.  *          Construct the Cubic Tension KLK Hyperbolic Discount Factor Shape Preserver.
  96.  *      </li>
  97.  *      <li>
  98.  *          Construct the Cubic Tension KLK Hyperbolic Discount Factor Shape Preserver with Zero Rate
  99.  *              Smoothening applied.
  100.  *      </li>
  101.  *      <li>
  102.  *          Construct the Cubic Polynomial Discount Factor Shape Preserver.
  103.  *      </li>
  104.  *      <li>
  105.  *          Construct the Cubic Polynomial Discount Factor Shape Preserver with Zero Rate Smoothening
  106.  *              applied.
  107.  *      </li>
  108.  *      <li>
  109.  *          Construct the Discount Curve using the Bear Sterns' DENSE Methodology.
  110.  *      </li>
  111.  *      <li>
  112.  *          Construct the Discount Curve using the Bear Sterns' DUALDENSE Methodology.
  113.  *      </li>
  114.  *      <li>
  115.  *          Cross-Comparison of the Cash Calibration Instrument "Rate" metric across the different curve
  116.  *              construction methodologies.
  117.  *      </li>
  118.  *      <li>
  119.  *          Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve
  120.  *              construction methodologies.
  121.  *      </li>
  122.  *      <li>
  123.  *          Cross-Comparison of the generated Discount Factor across the different curve construction
  124.  *              Methodologies for different node points.
  125.  *      </li>
  126.  *  </ul>
  127.  *  
  128.  * <br><br>
  129.  *  <ul>
  130.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/AnalyticsCore.md">Analytics Core Module</a></li>
  131.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FixedIncomeAnalyticsLibrary.md">Fixed Income Analytics Library</a></li>
  132.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/README.md">Sample</a></li>
  133.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/funding/README.md">Funding Curve Builder</a></li>
  134.  *  </ul>
  135.  * <br><br>
  136.  *
  137.  * @author Lakshmi Krishnamurthy
  138.  */

  139. public class TemplatedFundingCurveBuilder {

  140.     private static final FixFloatComponent OTCIRS (
  141.         final JulianDate dtSpot,
  142.         final String strCurrency,
  143.         final String strMaturityTenor,
  144.         final double dblCoupon)
  145.     {
  146.         FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction (
  147.             strCurrency,
  148.             "ALL",
  149.             strMaturityTenor,
  150.             "MAIN"
  151.         );

  152.         return ffConv.createFixFloatComponent (
  153.             dtSpot,
  154.             strMaturityTenor,
  155.             dblCoupon,
  156.             0.,
  157.             1.
  158.         );
  159.     }

  160.     /*
  161.      * Construct the Array of Deposit Instruments from the given set of parameters
  162.      *
  163.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  164.      */

  165.     private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays (
  166.         final JulianDate dtEffective,
  167.         final String strCurrency,
  168.         final int[] aiDay)
  169.         throws Exception
  170.     {
  171.         SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length];

  172.         ComposableFloatingUnitSetting cfus = new ComposableFloatingUnitSetting (
  173.             "3M",
  174.             CompositePeriodBuilder.EDGE_DATE_SEQUENCE_SINGLE,
  175.             null,
  176.             ForwardLabel.Create (
  177.                 strCurrency,
  178.                 "3M"
  179.             ),
  180.             CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE,
  181.             0.
  182.         );

  183.         CompositePeriodSetting cps = new CompositePeriodSetting (
  184.             4,
  185.             "3M",
  186.             strCurrency,
  187.             null,
  188.             1.,
  189.             null,
  190.             null,
  191.             null,
  192.             null
  193.         );

  194.         CashSettleParams csp = new CashSettleParams (
  195.             0,
  196.             strCurrency,
  197.             0
  198.         );

  199.         for (int i = 0; i < aiDay.length; ++i) {
  200.             aDeposit[i] = new SingleStreamComponent (
  201.                 "DEPOSIT_" + aiDay[i],
  202.                 new Stream (
  203.                     CompositePeriodBuilder.FloatingCompositeUnit (
  204.                         CompositePeriodBuilder.EdgePair (
  205.                             dtEffective,
  206.                             dtEffective.addBusDays (
  207.                                 aiDay[i],
  208.                                 strCurrency
  209.                             )
  210.                         ),
  211.                         cps,
  212.                         cfus
  213.                     )
  214.                 ),
  215.                 csp
  216.             );

  217.             aDeposit[i].setPrimaryCode (aiDay[i] + "D");
  218.         }

  219.         return aDeposit;
  220.     }

  221.     /*
  222.      * Construct the Array of Swap Instruments from the given set of parameters
  223.      *
  224.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  225.      */

  226.     private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor (
  227.         final JulianDate dtSpot,
  228.         final String strCurrency,
  229.         final String[] astrMaturityTenor)
  230.         throws Exception
  231.     {
  232.         FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length];

  233.         for (int i = 0; i < astrMaturityTenor.length; ++i) {
  234.             FixFloatComponent irs = OTCIRS (
  235.                 dtSpot,
  236.                 strCurrency,
  237.                 astrMaturityTenor[i],
  238.                 0.
  239.             );

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

  241.             aIRS[i] = irs;
  242.         }

  243.         return aIRS;
  244.     }

  245.     /*
  246.      * Compute the desired component Metric
  247.      *
  248.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  249.      */

  250.     private static final double ComponentMetric (
  251.         final Component comp,
  252.         final ValuationParams valParams,
  253.         final MergedDiscountForwardCurve dc,
  254.         final String strMeasure)
  255.         throws Exception
  256.     {
  257.         return comp.measureValue (
  258.             valParams,
  259.             null,
  260.             MarketParamsBuilder.Create (
  261.                 dc,
  262.                 null,
  263.                 null,
  264.                 null,
  265.                 null,
  266.                 null,
  267.                 null
  268.             ),
  269.             null,
  270.             strMeasure
  271.         );
  272.     }

  273.     /*
  274.      * This sample demonstrates the usage of the different pre-built Discount Curve Builders. It shows the
  275.      *  following:
  276.      *  - Construct the Array of Cash Instruments and their Quotes from the given set of parameters.
  277.      *  - Construct the Array of Swap Instruments and their Quotes from the given set of parameters.
  278.      *  - Construct the Cubic Tension KLK Hyperbolic Discount Factor Shape Preserver.
  279.      *  - Construct the Cubic Tension KLK Hyperbolic Discount Factor Shape Preserver with Zero Rate
  280.      *      Smoothening applied.
  281.      *  - Construct the Cubic Polynomial Discount Factor Shape Preserver.
  282.      *  - Construct the Cubic Polynomial Discount Factor Shape Preserver with Zero Rate Smoothening applied.
  283.      *  - Construct the Discount Curve using the Bear Sterns' DENSE Methodology.
  284.      *  - Construct the Discount Curve using the Bear Sterns' DUALDENSE Methodology.
  285.      *  - Cross-Comparison of the Cash Calibration Instrument "Rate" metric across the different curve
  286.      *      construction methodologies.
  287.      *  - Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve
  288.      *      construction methodologies.
  289.      *  - Cross-Comparison of the generated Discount Factor across the different curve construction
  290.      *      Methodologies for different node points.
  291.      *
  292.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  293.      */

  294.     public static final void TemplatedDiscountCurveBuilderSample (
  295.         final JulianDate dtSpot,
  296.         final String strCurrency)
  297.         throws Exception
  298.     {
  299.         ValuationParams valParams = new ValuationParams (
  300.             dtSpot,
  301.             dtSpot,
  302.             strCurrency
  303.         );

  304.         /*
  305.          * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters
  306.          */

  307.         SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays (
  308.             dtSpot,
  309.             strCurrency,
  310.             new int[] {
  311.                 2, 7, 14, 30, 60, 90, 180, 270, 360, 450, 540, 630, 720
  312.             }
  313.         );

  314.         double[] adblDepositQuote = new double[] {
  315.             0.0017, 0.0017, 0.0018, 0.0020, 0.0023, 0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160
  316.         };

  317.         String[] astrDepositManifestMeasure = new String[] {
  318.             "ForwardRate",
  319.             "ForwardRate",
  320.             "ForwardRate",
  321.             "ForwardRate",
  322.             "ForwardRate",
  323.             "ForwardRate",
  324.             "ForwardRate",
  325.             "ForwardRate",
  326.             "ForwardRate",
  327.             "ForwardRate",
  328.             "ForwardRate",
  329.             "ForwardRate",
  330.             "ForwardRate"
  331.         };

  332.         /*
  333.          * Construct the Array of Swap Instruments and their Quotes from the given set of parameters
  334.          */

  335.         FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor (
  336.             dtSpot,
  337.             strCurrency,
  338.             new java.lang.String[] {
  339.                 "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"
  340.             }
  341.         );

  342.         double[] adblSwapQuote = new double[] {
  343.             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
  344.         };

  345.         String[] astrSwapManifestMeasure = new String[] {
  346.             "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate", "SwapRate"
  347.         };

  348.         /*
  349.          * Construct the Cubic Tension KLK Hyperbolic Discount Factor Shape Preserver
  350.          */

  351.         MergedDiscountForwardCurve dcKLKHyperbolicShapePreserver = ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver (
  352.             "KLK_HYPERBOLIC_SHAPE_TEMPLATE",
  353.             valParams,
  354.             aDepositComp,
  355.             adblDepositQuote,
  356.             astrDepositManifestMeasure,
  357.             aSwapComp,
  358.             adblSwapQuote,
  359.             astrSwapManifestMeasure,
  360.             false
  361.         );

  362.         /*
  363.          * Construct the Cubic Tension KLK Hyperbolic Discount Factor Shape Preserver with Zero Rate
  364.          *  Smoothening applied
  365.          */

  366.         MergedDiscountForwardCurve dcKLKHyperbolicSmoother = ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver (
  367.             "KLK_HYPERBOLIC_SMOOTH_TEMPLATE",
  368.             valParams,
  369.             aDepositComp,
  370.             adblDepositQuote,
  371.             astrDepositManifestMeasure,
  372.             aSwapComp,
  373.             adblSwapQuote,
  374.             astrSwapManifestMeasure,
  375.             true
  376.         );

  377.         /*
  378.          * Construct the Cubic Polynomial Discount Factor Shape Preserver
  379.          */

  380.         MergedDiscountForwardCurve dcCubicPolyShapePreserver = ScenarioDiscountCurveBuilder.CubicPolyDFRateShapePreserver (
  381.             "CUBIC_POLY_SHAPE_TEMPLATE",
  382.             valParams,
  383.             aDepositComp,
  384.             adblDepositQuote,
  385.             astrDepositManifestMeasure,
  386.             aSwapComp,
  387.             adblSwapQuote,
  388.             astrSwapManifestMeasure,
  389.             false
  390.         );

  391.         /*
  392.          * Construct the Cubic Polynomial Discount Factor Shape Preserver with Zero Rate Smoothening applied.
  393.          */

  394.         MergedDiscountForwardCurve dcCubicPolySmoother = ScenarioDiscountCurveBuilder.CubicPolyDFRateShapePreserver (
  395.             "CUBIC_POLY_SMOOTH_TEMPLATE",
  396.             valParams,
  397.             aDepositComp,
  398.             adblDepositQuote,
  399.             astrDepositManifestMeasure,
  400.             aSwapComp,
  401.             adblSwapQuote,
  402.             astrSwapManifestMeasure,
  403.             true
  404.         );

  405.         /*
  406.          * Construct the Discount Curve using the Bear Sterns' DENSE Methodology.
  407.          */

  408.         MergedDiscountForwardCurve dcDENSE = ScenarioDiscountCurveBuilder.DENSE (
  409.             "DENSE",
  410.             valParams,
  411.             aDepositComp,
  412.             adblDepositQuote,
  413.             astrDepositManifestMeasure,
  414.             aSwapComp,
  415.             adblSwapQuote,
  416.             astrSwapManifestMeasure,
  417.             null
  418.         );

  419.         /*
  420.          * Construct the Discount Curve using the Bear Sterns' DUAL DENSE Methodology.
  421.          */

  422.         MergedDiscountForwardCurve dcDualDENSE = ScenarioDiscountCurveBuilder.DUALDENSE (
  423.             "DENSE",
  424.             valParams,
  425.             aDepositComp,
  426.             adblDepositQuote,
  427.             "1M",
  428.             astrDepositManifestMeasure,
  429.             aSwapComp,
  430.             adblSwapQuote,
  431.             "3M",
  432.             astrSwapManifestMeasure,
  433.             null
  434.         );

  435.         /*
  436.          * Cross-Comparison of the Deposit Calibration Instrument "Rate" metric across the different curve
  437.          *  construction methodologies.
  438.          */

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

  440.         System.out.println ("\t\t\t\t\t\t\tDEPOSIT INSTRUMENTS CALIBRATION RECOVERY");

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

  442.         System.out.println ("\t   MATURITY  | KLK HYPER SHAPE | KLK HYPER SMOTH | CUBE POLY SHAPE | CUBE POLY SMOTH |      DENSE      |   DUAL  DENSE   |      INPUT");

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

  444.         for (int i = 0; i < aDepositComp.length; ++i)
  445.             System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] =    " +
  446.                 FormatUtil.FormatDouble (ComponentMetric (aDepositComp[i], valParams, dcKLKHyperbolicShapePreserver, "Rate"), 1, 6, 1.) + "    |    " +
  447.                 FormatUtil.FormatDouble (ComponentMetric (aDepositComp[i], valParams, dcKLKHyperbolicSmoother, "Rate"), 1, 6, 1.) + "    |    " +
  448.                 FormatUtil.FormatDouble (ComponentMetric (aDepositComp[i], valParams, dcCubicPolyShapePreserver, "Rate"), 1, 6, 1.) + "    |    " +
  449.                 FormatUtil.FormatDouble (ComponentMetric (aDepositComp[i], valParams, dcCubicPolySmoother, "Rate"), 1, 6, 1.) + "    |    " +
  450.                 FormatUtil.FormatDouble (ComponentMetric (aDepositComp[i], valParams, dcDENSE, "Rate"), 1, 6, 1.) + "    |    " +
  451.                 FormatUtil.FormatDouble (ComponentMetric (aDepositComp[i], valParams, dcDualDENSE, "Rate"), 1, 6, 1.) + "    |    " +
  452.                 FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)
  453.             );

  454.         /*
  455.          * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve
  456.          *  construction methodologies.
  457.          */

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

  459.         System.out.println ("\t\t\t\t\t\t\tSWAP INSTRUMENTS CALIBRATION RECOVERY");

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

  461.         System.out.println ("\t   MATURITY  | KLK HYPER SHAPE | KLK HYPER SMOTH | CUBE POLY SHAPE | CUBE POLY SMOTH |      DENSE      |   DUAL  DENSE   |      INPUT");

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

  463.         for (int i = 0; i < aSwapComp.length; ++i)
  464.             System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] =    " +
  465.                 FormatUtil.FormatDouble (ComponentMetric (aSwapComp[i], valParams, dcKLKHyperbolicShapePreserver, "CalibSwapRate"), 1, 6, 1.) + "    |    " +
  466.                 FormatUtil.FormatDouble (ComponentMetric (aSwapComp[i], valParams, dcKLKHyperbolicSmoother, "CalibSwapRate"), 1, 6, 1.) + "    |    " +
  467.                 FormatUtil.FormatDouble (ComponentMetric (aSwapComp[i], valParams, dcCubicPolyShapePreserver, "CalibSwapRate"), 1, 6, 1.) + "    |    " +
  468.                 FormatUtil.FormatDouble (ComponentMetric (aSwapComp[i], valParams, dcCubicPolySmoother, "CalibSwapRate"), 1, 6, 1.) + "    |    " +
  469.                 FormatUtil.FormatDouble (ComponentMetric (aSwapComp[i], valParams, dcDENSE, "CalibSwapRate"), 1, 6, 1.) + "    |    " +
  470.                 FormatUtil.FormatDouble (ComponentMetric (aSwapComp[i], valParams, dcDualDENSE, "CalibSwapRate"), 1, 6, 1.) + "    |    " +
  471.                 FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.)
  472.             );

  473.         /*
  474.          * Cross-Comparison of the generated Discount Factor across the different curve construction
  475.          *  methodologies for different node points.
  476.          */

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

  478.         System.out.println ("\t      DF     |   KLK HYPER SHAPE |  KLK HYPER SMOTH  |  CUBE POLY SHAPE  |  CUBE POLY SMOTH  |       DENSE       |     DUAL DENSE    ");

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

  480.         int iStartDate = aDepositComp[0].maturityDate().julian();

  481.         int iEndDate = aSwapComp[aSwapComp.length - 1].maturityDate().julian();

  482.         int iDateIncrement = (iEndDate - iStartDate) / 20;

  483.         for (int iDate = iStartDate; iDate <= iEndDate; iDate += iDateIncrement) {
  484.             System.out.println ("\t[" + new JulianDate (iDate) + "] =    " +
  485.                 FormatUtil.FormatDouble (dcKLKHyperbolicShapePreserver.df (iDate), 1, 8, 1.) + "    |    " +
  486.                 FormatUtil.FormatDouble (dcKLKHyperbolicSmoother.df (iDate), 1, 8, 1.) + "    |    " +
  487.                 FormatUtil.FormatDouble (dcCubicPolyShapePreserver.df (iDate), 1, 8, 1.) + "    |    " +
  488.                 FormatUtil.FormatDouble (dcCubicPolySmoother.df (iDate), 1, 8, 1.) + "    |    " +
  489.                 FormatUtil.FormatDouble (dcDENSE.df (iDate), 1, 8, 1.) + "    |    " +
  490.                 FormatUtil.FormatDouble (dcDualDENSE.df (iDate), 1, 8, 1.)
  491.             );
  492.         }
  493.     }

  494.     public static final void main (
  495.         final String[] astrArgs)
  496.         throws Exception
  497.     {
  498.         /*
  499.          * Initialize the Credit Analytics Library
  500.          */

  501.         EnvManager.InitEnv ("");

  502.         String strCurrency = "EUR";

  503.         JulianDate dtToday = DateUtil.Today().addTenorAndAdjust (
  504.             "0D",
  505.             strCurrency
  506.         );

  507.         TemplatedDiscountCurveBuilderSample (
  508.             dtToday,
  509.             strCurrency
  510.         );

  511.         EnvManager.TerminateEnv();
  512.     }
  513. }