ShapeZeroLocalSmooth.java

  1. package org.drip.sample.funding;

  2. import org.drip.analytics.date.*;
  3. import org.drip.analytics.definition.LatentStateStatic;
  4. import org.drip.function.r1tor1.QuadraticRationalShapeControl;
  5. import org.drip.market.otc.*;
  6. import org.drip.numerical.common.FormatUtil;
  7. import org.drip.param.creator.*;
  8. import org.drip.param.valuation.*;
  9. import org.drip.product.creator.*;
  10. import org.drip.product.definition.CalibratableComponent;
  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.pchip.LocalMonotoneCkGenerator;
  16. import org.drip.spline.stretch.*;
  17. import org.drip.state.creator.ScenarioDiscountCurveBuilder;
  18. import org.drip.state.discount.*;
  19. import org.drip.state.estimator.*;
  20. import org.drip.state.identifier.*;
  21. import org.drip.state.inference.*;

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

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

  89. /**
  90.  * <i>ShapeZeroLocalSmooth</i> demonstrates the usage of different local smoothing techniques involved in the
  91.  * funding curve creation. It shows the following:
  92.  *  
  93.  * <br><br>
  94.  *  <ul>
  95.  *      <li>
  96.  *          Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters.
  97.  *      </li>
  98.  *      <li>
  99.  *          Construct the Cash/Swap Instrument Set Stretch Builder.
  100.  *      </li>
  101.  *      <li>
  102.  *          Set up the Linear Curve Calibrator using the following parameters:
  103.  *          <ul>
  104.  *              <li>
  105.  *                  Cubic Exponential Mixture Basis Spline Set
  106.  *              </li>
  107.  *              <li>
  108.  *                  C<sub>k</sub> = 2
  109.  *                  Segment Curvature Penalty = 2
  110.  *              </li>
  111.  *              <li>
  112.  *                  Quadratic Rational Shape Controller
  113.  *              </li>
  114.  *              <li>
  115.  *                  Natural Boundary Setting
  116.  *              </li>
  117.  *          </ul>
  118.  *      </li>
  119.  *      <li>
  120.  *          Set up the Akima Local Curve Control parameters as follows:
  121.  *          <ul>
  122.  *              <li>
  123.  *                  C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering
  124.  *                      applied
  125.  *              </li>
  126.  *              <li>
  127.  *                  Zero Rate Quantification Metric
  128.  *              </li>
  129.  *              <li>
  130.  *                  Cubic Polynomial Basis Spline Set
  131.  *              </li>
  132.  *              <li>
  133.  *                  C<sub>k</sub> = 2
  134.  *                  Segment Curvature Penalty = 2
  135.  *              </li>
  136.  *              <li>
  137.  *                  Quadratic Rational Shape Controller
  138.  *              </li>
  139.  *              <li>
  140.  *                  Natural Boundary Setting
  141.  *              </li>
  142.  *          </ul>
  143.  *      </li>
  144.  *      <li>
  145.  *          Set up the Harmonic Local Curve Control parameters as follows:
  146.  *          <ul>
  147.  *              <li>
  148.  *                  C1 Harmonic Monotone Smoothener with spurious extrema elimination and monotone filtering
  149.  *                      applied
  150.  *              </li>
  151.  *              <li>
  152.  *                  Zero Rate Quantification Metric
  153.  *              </li>
  154.  *              <li>
  155.  *                  Cubic Polynomial Basis Spline Set
  156.  *              </li>
  157.  *              <li>
  158.  *                  C<sub>k</sub> = 2
  159.  *                  Segment Curvature Penalty = 2
  160.  *              </li>
  161.  *              <li>
  162.  *                  Quadratic Rational Shape Controller
  163.  *              </li>
  164.  *              <li>
  165.  *                  Natural Boundary Setting
  166.  *              </li>
  167.  *          </ul>
  168.  *      </li>
  169.  *      <li>
  170.  *          Set up the Hyman 1983 Local Curve Control parameters as follows:
  171.  *          <ul>
  172.  *              <li>
  173.  *                  C1 Hyman 1983 Monotone Smoothener with spurious extrema elimination and monotone
  174.  *                      filtering applied
  175.  *              </li>
  176.  *              <li>
  177.  *                  Zero Rate Quantification Metric
  178.  *              </li>
  179.  *              <li>
  180.  *                  Cubic Polynomial Basis Spline Set
  181.  *              </li>
  182.  *              <li>
  183.  *                  C<sub>k</sub> = 2
  184.  *                  Segment Curvature Penalty = 2
  185.  *              </li>
  186.  *              <li>
  187.  *                  Quadratic Rational Shape Controller
  188.  *              </li>
  189.  *              <li>
  190.  *                  Natural Boundary Setting
  191.  *              </li>
  192.  *          </ul>
  193.  *      </li>
  194.  *      <li>
  195.  *          Set up the Hyman 1989 Local Curve Control parameters as follows:
  196.  *          <ul>
  197.  *              <li>
  198.  *                  C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering
  199.  *                      applied
  200.  *              </li>
  201.  *              <li>
  202.  *                  Zero Rate Quantification Metric
  203.  *              </li>
  204.  *              <li>
  205.  *                  Cubic Polynomial Basis Spline Set
  206.  *              </li>
  207.  *              <li>
  208.  *                  C<sub>k</sub> = 2
  209.  *                  Segment Curvature Penalty = 2
  210.  *              </li>
  211.  *              <li>
  212.  *                  Quadratic Rational Shape Controller
  213.  *              </li>
  214.  *              <li>
  215.  *                  Natural Boundary Setting
  216.  *              </li>
  217.  *          </ul>
  218.  *      </li>
  219.  *      <li>
  220.  *          Set up the Huynh-Le Floch Delimited Local Curve Control parameters as follows:
  221.  *          <ul>
  222.  *              <li>
  223.  *                  C1 Huynh-Le Floch Delimited Monotone Smoothener with spurious extrema elimination and
  224.  *                      monotone filtering applied
  225.  *              </li>
  226.  *              <li>
  227.  *                  Zero Rate Quantification Metric
  228.  *              </li>
  229.  *              <li>
  230.  *                  Cubic Polynomial Basis Spline Set
  231.  *              </li>
  232.  *              <li>
  233.  *                  C<sub>k</sub> = 2
  234.  *                  Segment Curvature Penalty = 2
  235.  *              </li>
  236.  *              <li>
  237.  *                  Quadratic Rational Shape Controller
  238.  *              </li>
  239.  *              <li>
  240.  *                  Natural Boundary Setting
  241.  *              </li>
  242.  *          </ul>
  243.  *      </li>
  244.  *      <li>
  245.  *          Set up the Kruger Local Curve Control parameters as follows:
  246.  *          <ul>
  247.  *              <li>
  248.  *                  C1 Kruger Monotone Smoothener with spurious extrema elimination and monotone filtering
  249.  *                      applied
  250.  *              </li>
  251.  *              <li>
  252.  *                  Zero Rate Quantification Metric
  253.  *              </li>
  254.  *              <li>
  255.  *                  Cubic Polynomial Basis Spline Set
  256.  *              </li>
  257.  *              <li>
  258.  *                  C<sub>k</sub> = 2
  259.  *                  Segment Curvature Penalty = 2
  260.  *              </li>
  261.  *              <li>
  262.  *                  Quadratic Rational Shape Controller
  263.  *              </li>
  264.  *              <li>
  265.  *                  Natural Boundary Setting
  266.  *              </li>
  267.  *          </ul>
  268.  *      </li>
  269.  *      <li>
  270.  *          Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the
  271.  *              array of Cash and Swap Stretches.
  272.  *      </li>
  273.  *      <li>
  274.  *          Construct the Akima Locally Smoothened Discount Curve by applying the linear curve calibrator and
  275.  *              the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape
  276.  *              preserving discount curve.
  277.  *      </li>
  278.  *      <li>
  279.  *          Construct the Harmonic Locally Smoothened Discount Curve by applying the linear curve calibrator
  280.  *              and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape
  281.  *              preserving discount curve.
  282.  *      </li>
  283.  *      <li>
  284.  *          Construct the Hyman 1983 Locally Smoothened Discount Curve by applying the linear curve
  285.  *              calibrator and the Local Curve Control parameters to the array of Cash and Swap Stretches and
  286.  *              the shape preserving discount curve.
  287.  *      </li>
  288.  *      <li>
  289.  *          Construct the Hyman 1989 Locally Smoothened Discount Curve by applying the linear curve
  290.  *              calibrator and the Local Curve Control parameters to the array of Cash and Swap Stretches and
  291.  *              the shape preserving discount curve.
  292.  *      </li>
  293.  *      <li>
  294.  *          Construct the Huynh-Le Floch Delimiter Locally Smoothened Discount Curve by applying the linear
  295.  *              curve calibrator and the Local Curve Control parameters to the array of Cash and Swap
  296.  *              Stretches and the shape preserving discount curve.
  297.  *      </li>
  298.  *      <li>
  299.  *          Construct the Kruger Locally Smoothened Discount Curve by applying the linear curve calibrator
  300.  *              and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape
  301.  *              preserving discount curve.
  302.  *      </li>
  303.  *      <li>
  304.  *          Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve
  305.  *              construction methodologies.
  306.  *      </li>
  307.  *      <li>
  308.  *          Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve
  309.  *              construction methodologies for a sequence of bespoke swap instruments.
  310.  *      </li>
  311.  *  </ul>
  312.  *  
  313.  * <br><br>
  314.  *  <ul>
  315.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/AnalyticsCore.md">Analytics Core Module</a></li>
  316.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FixedIncomeAnalyticsLibrary.md">Fixed Income Analytics Library</a></li>
  317.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/README.md">Sample</a></li>
  318.  *      <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>
  319.  *  </ul>
  320.  * <br><br>
  321.  *
  322.  * @author Lakshmi Krishnamurthy
  323.  */

  324. public class ShapeZeroLocalSmooth {

  325.     private static final FixFloatComponent OTCIRS (
  326.         final JulianDate dtSpot,
  327.         final String strCurrency,
  328.         final String strMaturityTenor,
  329.         final double dblCoupon)
  330.     {
  331.         FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction (
  332.             strCurrency,
  333.             "ALL",
  334.             strMaturityTenor,
  335.             "MAIN"
  336.         );

  337.         return ffConv.createFixFloatComponent (
  338.             dtSpot,
  339.             strMaturityTenor,
  340.             dblCoupon,
  341.             0.,
  342.             1.
  343.         );
  344.     }

  345.     /*
  346.      * Construct the Array of Deposit Instruments from the given set of parameters
  347.      *
  348.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  349.      */

  350.     private static final SingleStreamComponent[] DepositInstrumentsFromMaturityDays (
  351.         final JulianDate dtEffective,
  352.         final String strCurrency,
  353.         final int[] aiDay)
  354.         throws Exception
  355.     {
  356.         SingleStreamComponent[] aDeposit = new SingleStreamComponent[aiDay.length];

  357.         for (int i = 0; i < aiDay.length; ++i)
  358.             aDeposit[i] = SingleStreamComponentBuilder.Deposit (
  359.                 dtEffective,
  360.                 dtEffective.addBusDays (
  361.                     aiDay[i],
  362.                     strCurrency
  363.                 ),
  364.                 ForwardLabel.Create (
  365.                     "USD",
  366.                     "3M"
  367.                 )
  368.             );

  369.         return aDeposit;
  370.     }

  371.     /*
  372.      * Construct the Array of Swap Instruments from the given set of parameters
  373.      *
  374.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  375.      */

  376.     private static final FixFloatComponent[] SwapInstrumentsFromMaturityTenor (
  377.         final JulianDate dtSpot,
  378.         final String strCurrency,
  379.         final String[] astrMaturityTenor)
  380.         throws Exception
  381.     {
  382.         FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length];

  383.         for (int i = 0; i < astrMaturityTenor.length; ++i)
  384.             aIRS[i] = OTCIRS (
  385.                 dtSpot,
  386.                 strCurrency,
  387.                 astrMaturityTenor[i],
  388.                 0.
  389.             );

  390.         return aIRS;
  391.     }

  392.     /*
  393.      * This sample demonstrates the usage of different local smoothing techniques involved in the discount
  394.      *  curve creation. It shows the following:
  395.      *  - Construct the Array of Cash/Swap Instruments and their Quotes from the given set of parameters.
  396.      *  - Construct the Cash/Swap Instrument Set Stretch Builder.
  397.      *  - Set up the Linear Curve Calibrator using the following parameters:
  398.      *      - Cubic Exponential Mixture Basis Spline Set
  399.      *      - Ck = 2, Segment Curvature Penalty = 2
  400.      *      - Quadratic Rational Shape Controller
  401.      *      - Natural Boundary Setting
  402.      *  - Set up the Akima Local Curve Control parameters as follows:
  403.      *      - C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering applied
  404.      *      - Zero Rate Quantification Metric
  405.      *      - Cubic Polynomial Basis Spline Set
  406.      *      - Ck = 2, Segment Curvature Penalty = 2
  407.      *      - Quadratic Rational Shape Controller
  408.      *      - Natural Boundary Setting
  409.      *  - Set up the Harmonic Local Curve Control parameters as follows:
  410.      *      - C1 Harmonic Monotone Smoothener with spurious extrema elimination and monotone filtering applied
  411.      *      - Zero Rate Quantification Metric
  412.      *      - Cubic Polynomial Basis Spline Set
  413.      *      - Ck = 2, Segment Curvature Penalty = 2
  414.      *      - Quadratic Rational Shape Controller
  415.      *      - Natural Boundary Setting
  416.      *  - Set up the Hyman 1983 Local Curve Control parameters as follows:
  417.      *      - C1 Hyman 1983 Monotone Smoothener with spurious extrema elimination and monotone filtering applied
  418.      *      - Zero Rate Quantification Metric
  419.      *      - Cubic Polynomial Basis Spline Set
  420.      *      - Ck = 2, Segment Curvature Penalty = 2
  421.      *      - Quadratic Rational Shape Controller
  422.      *      - Natural Boundary Setting
  423.      *  - Set up the Hyman 1989 Local Curve Control parameters as follows:
  424.      *      - C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering applied
  425.      *      - Zero Rate Quantification Metric
  426.      *      - Cubic Polynomial Basis Spline Set
  427.      *      - Ck = 2, Segment Curvature Penalty = 2
  428.      *      - Quadratic Rational Shape Controller
  429.      *      - Natural Boundary Setting
  430.      *  - Set up the Huynh-Le Floch Delimited Local Curve Control parameters as follows:
  431.      *      - C1 Huynh-Le Floch Delimited Monotone Smoothener with spurious extrema elimination and monotone filtering applied
  432.      *      - Zero Rate Quantification Metric
  433.      *      - Cubic Polynomial Basis Spline Set
  434.      *      - Ck = 2, Segment Curvature Penalty = 2
  435.      *      - Quadratic Rational Shape Controller
  436.      *      - Natural Boundary Setting
  437.      *  - Set up the Kruger Local Curve Control parameters as follows:
  438.      *      - C1 Kruger Monotone Smoothener with spurious extrema elimination and monotone filtering applied
  439.      *      - Zero Rate Quantification Metric
  440.      *      - Cubic Polynomial Basis Spline Set
  441.      *      - Ck = 2, Segment Curvature Penalty = 2
  442.      *      - Quadratic Rational Shape Controller
  443.      *      - Natural Boundary Setting
  444.      *  - Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array
  445.      *      of Cash and Swap Stretches.
  446.      *  - Construct the Akima Locally Smoothened Discount Curve by applying the linear curve calibrator and
  447.      *      the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape
  448.      *      preserving discount curve.
  449.      *  - Construct the Harmonic Locally Smoothened Discount Curve by applying the linear curve calibrator
  450.      *      and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape
  451.      *      preserving discount curve.
  452.      *  - Construct the Hyman 1983 Locally Smoothened Discount Curve by applying the linear curve calibrator
  453.      *      and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape
  454.      *      preserving discount curve.
  455.      *  - Construct the Hyman 1989 Locally Smoothened Discount Curve by applying the linear curve calibrator
  456.      *      and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape
  457.      *      preserving discount curve.
  458.      *  - Construct the Huynh-Le Floch Delimiter Locally Smoothened Discount Curve by applying the linear
  459.      *      curve calibrator and the Local Curve Control parameters to the array of Cash and Swap Stretches
  460.      *      and the shape preserving discount curve.
  461.      *  - Construct the Kruger Locally Smoothened Discount Curve by applying the linear curve calibrator and
  462.      *      the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape
  463.      *      preserving discount curve.
  464.      *  - Cross-Comparison of the Cash/Swap Calibration Instrument "Rate" metric across the different curve
  465.      *      construction methodologies.
  466.      *  - Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve
  467.      *      construction methodologies for a sequence of bespoke swap instruments.
  468.      *
  469.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  470.      */

  471.     private static final void ShapeDFZeroLocalSmoothSample (
  472.         final JulianDate dtSpot,
  473.         final String strCurrency)
  474.         throws Exception
  475.     {
  476.         /*
  477.          * Construct the Array of Deposit Instruments and their Quotes from the given set of parameters
  478.          */

  479.         SingleStreamComponent[] aDepositComp = DepositInstrumentsFromMaturityDays (
  480.             dtSpot,
  481.             strCurrency,
  482.             new int[] {
  483.                 1, 2, 7, 14, 30, 60
  484.             }
  485.         );

  486.         double[] adblDepositQuote = new double[] {
  487.             0.0013, 0.0017, 0.0017, 0.0018, 0.0020, 0.0023
  488.         };

  489.         /*
  490.          * Construct the Deposit Instrument Set Stretch Builder
  491.          */

  492.         LatentStateStretchSpec depositStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec (
  493.             "DEPOSIT",
  494.             aDepositComp,
  495.             "ForwardRate",
  496.             adblDepositQuote
  497.         );

  498.         /*
  499.          * Construct the Array of EDF Instruments and their Quotes from the given set of parameters
  500.          */

  501.         SingleStreamComponent[] aEDFComp = SingleStreamComponentBuilder.ForwardRateFuturesPack (
  502.             dtSpot,
  503.             8,
  504.             strCurrency
  505.         );

  506.         double[] adblEDFQuote = new double[] {
  507.             0.0027, 0.0032, 0.0041, 0.0054, 0.0077, 0.0104, 0.0134, 0.0160
  508.         };

  509.         /*
  510.          * Construct the EDF Instrument Set Stretch Builder
  511.          */

  512.         LatentStateStretchSpec edfStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec (
  513.             "EDF",
  514.             aEDFComp,
  515.             "ForwardRate",
  516.             adblEDFQuote
  517.         );

  518.         /*
  519.          * Construct the Array of Swap Instruments and their Quotes from the given set of parameters
  520.          */

  521.         FixFloatComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor (
  522.             dtSpot,
  523.             strCurrency,
  524.             new java.lang.String[] {
  525.                 "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"
  526.             }
  527.         );

  528.         double[] adblSwapQuote = new double[] {
  529.             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
  530.         };

  531.         /*
  532.          * Construct the Swap Instrument Set Stretch Builder
  533.          */

  534.         LatentStateStretchSpec swapStretch = LatentStateStretchBuilder.ForwardFundingStretchSpec (
  535.             "SWAP",
  536.             aSwapComp,
  537.             "SwapRate",
  538.             adblSwapQuote
  539.         );

  540.         LatentStateStretchSpec[] aStretchSpec = new LatentStateStretchSpec[] {
  541.             depositStretch,
  542.             edfStretch,
  543.             swapStretch
  544.         };

  545.         /*
  546.          * Set up the Linear Curve Calibrator using the following parameters:
  547.          *  - Cubic Exponential Mixture Basis Spline Set
  548.          *  - Ck = 2, Segment Curvature Penalty = 2
  549.          *  - Quadratic Rational Shape Controller
  550.          *  - Natural Boundary Setting
  551.          */

  552.         LinearLatentStateCalibrator lcc = new LinearLatentStateCalibrator (
  553.             new SegmentCustomBuilderControl (
  554.                 MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL,
  555.                 new PolynomialFunctionSetParams (4),
  556.                 SegmentInelasticDesignControl.Create (
  557.                     2,
  558.                     2
  559.                 ),
  560.                 new ResponseScalingShapeControl (
  561.                     true,
  562.                     new QuadraticRationalShapeControl (0.)
  563.                 ),
  564.                 null
  565.             ),
  566.             BoundarySettings.NaturalStandard(),
  567.             MultiSegmentSequence.CALIBRATE,
  568.             null,
  569.             null
  570.         );

  571.         ValuationParams valParams = new ValuationParams (
  572.             dtSpot,
  573.             dtSpot,
  574.             strCurrency
  575.         );

  576.         /*
  577.          * Construct the Shape Preserving Discount Curve by applying the linear curve calibrator to the array
  578.          *  of Deposit, Futures, and Swap Stretches.
  579.          */

  580.         MergedDiscountForwardCurve dcShapePreserving = ScenarioDiscountCurveBuilder.ShapePreservingDFBuild (
  581.             strCurrency,
  582.             lcc,
  583.             aStretchSpec,
  584.             valParams,
  585.             null,
  586.             null,
  587.             null,
  588.             1.
  589.         );

  590.         /*
  591.          * Set up the Akima Local Curve Control parameters as follows:
  592.          *  - C1 Akima Monotone Smoothener with spurious extrema elimination and monotone filtering applied
  593.          *  - Zero Rate Quantification Metric
  594.          *  - Cubic Polynomial Basis Spline Set
  595.          *  - Ck = 2, Segment Curvature Penalty = 2
  596.          *  - Quadratic Rational Shape Controller
  597.          *  - Natural Boundary Setting
  598.          */

  599.         LocalControlCurveParams lccpAkima = new LocalControlCurveParams (
  600.             LocalMonotoneCkGenerator.C1_AKIMA,
  601.             LatentStateStatic.DISCOUNT_QM_ZERO_RATE,
  602.             new SegmentCustomBuilderControl (
  603.                 MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL,
  604.                 new PolynomialFunctionSetParams (4),
  605.                 SegmentInelasticDesignControl.Create (
  606.                     2,
  607.                     2
  608.                 ),
  609.                 new ResponseScalingShapeControl (
  610.                     true,
  611.                     new QuadraticRationalShapeControl (0.)
  612.                 ),
  613.                 null
  614.             ),
  615.             MultiSegmentSequence.CALIBRATE,
  616.             null,
  617.             null,
  618.             true,
  619.             true
  620.         );

  621.         /*
  622.          * Set up the Harmonic Local Curve Control parameters as follows:
  623.          *  - C1 Harmonic Monotone Smoothener with spurious extrema elimination and monotone filtering
  624.          *      applied
  625.          *  - Zero Rate Quantification Metric
  626.          *  - Cubic Polynomial Basis Spline Set
  627.          *  - Ck = 2, Segment Curvature Penalty = 2
  628.          *  - Quadratic Rational Shape Controller
  629.          *  - Natural Boundary Setting
  630.          */

  631.         LocalControlCurveParams lccpHarmonic = new LocalControlCurveParams (
  632.             LocalMonotoneCkGenerator.C1_HARMONIC,
  633.             LatentStateStatic.DISCOUNT_QM_ZERO_RATE,
  634.             new SegmentCustomBuilderControl (
  635.                 MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL,
  636.                 new PolynomialFunctionSetParams (4),
  637.                 SegmentInelasticDesignControl.Create (
  638.                     2,
  639.                     2
  640.                 ),
  641.                 new ResponseScalingShapeControl (
  642.                     true,
  643.                     new QuadraticRationalShapeControl (0.)
  644.                 ),
  645.                 null
  646.             ),
  647.             MultiSegmentSequence.CALIBRATE,
  648.             null,
  649.             null,
  650.             true,
  651.             true
  652.         );

  653.         /*
  654.          * Set up the Hyman 1983 Local Curve Control parameters as follows:
  655.          *  - C1 Hyman 1983 Monotone Smoothener with spurious extrema elimination and monotone filtering
  656.          *      applied
  657.          *  - Zero Rate Quantification Metric
  658.          *  - Cubic Polynomial Basis Spline Set
  659.          *  - Ck = 2, Segment Curvature Penalty = 2
  660.          *  - Quadratic Rational Shape Controller
  661.          *  - Natural Boundary Setting
  662.          */

  663.         LocalControlCurveParams lccpHyman83 = new LocalControlCurveParams (
  664.             LocalMonotoneCkGenerator.C1_HYMAN83,
  665.             LatentStateStatic.DISCOUNT_QM_ZERO_RATE,
  666.             new SegmentCustomBuilderControl (
  667.                 MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL,
  668.                 new PolynomialFunctionSetParams (4),
  669.                 SegmentInelasticDesignControl.Create (
  670.                     2,
  671.                     2
  672.                 ),
  673.                 new ResponseScalingShapeControl (
  674.                     true,
  675.                     new QuadraticRationalShapeControl (0.)
  676.                 ),
  677.                 null
  678.             ),
  679.             MultiSegmentSequence.CALIBRATE,
  680.             null,
  681.             null,
  682.             true,
  683.             true
  684.         );

  685.         /*
  686.          * Set up the Hyman 1989 Local Curve Control parameters as follows:
  687.          *  - C1 Hyman 1989 Monotone Smoothener with spurious extrema elimination and monotone filtering
  688.          *      applied
  689.          *  - Zero Rate Quantification Metric
  690.          *  - Cubic Polynomial Basis Spline Set
  691.          *  - Ck = 2, Segment Curvature Penalty = 2
  692.          *  - Quadratic Rational Shape Controller
  693.          *  - Natural Boundary Setting
  694.          */

  695.         LocalControlCurveParams lccpHyman89 = new LocalControlCurveParams (
  696.             LocalMonotoneCkGenerator.C1_HYMAN89,
  697.             LatentStateStatic.DISCOUNT_QM_ZERO_RATE,
  698.             new SegmentCustomBuilderControl (
  699.                 MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL,
  700.                 new PolynomialFunctionSetParams (4),
  701.                 SegmentInelasticDesignControl.Create (
  702.                     2,
  703.                     2
  704.                 ),
  705.                 new ResponseScalingShapeControl (
  706.                     true,
  707.                     new QuadraticRationalShapeControl (0.)
  708.                 ),
  709.                 null
  710.             ),
  711.             MultiSegmentSequence.CALIBRATE,
  712.             null,
  713.             null,
  714.             true,
  715.             true
  716.         );

  717.         /*
  718.          * Set up the Huynh-LeFloch Limiter Local Curve Control parameters as follows:
  719.          *  - C1 Huynh-LeFloch Limiter Monotone Smoothener with spurious extrema elimination and monotone
  720.          *      filtering applied
  721.          *  - Zero Rate Quantification Metric
  722.          *  - Cubic Polynomial Basis Spline Set
  723.          *  - Ck = 2, Segment Curvature Penalty = 2
  724.          *  - Quadratic Rational Shape Controller
  725.          *  - Natural Boundary Setting
  726.          */

  727.         LocalControlCurveParams lccpHuynhLeFloch = new LocalControlCurveParams (
  728.             LocalMonotoneCkGenerator.C1_HUYNH_LE_FLOCH,
  729.             LatentStateStatic.DISCOUNT_QM_ZERO_RATE,
  730.             new SegmentCustomBuilderControl (
  731.                 MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL,
  732.                 new PolynomialFunctionSetParams (4),
  733.                 SegmentInelasticDesignControl.Create (
  734.                     2,
  735.                     2
  736.                 ),
  737.                 new ResponseScalingShapeControl (
  738.                     true,
  739.                     new QuadraticRationalShapeControl (0.)
  740.                 ),
  741.                 null
  742.             ),
  743.             MultiSegmentSequence.CALIBRATE,
  744.             null,
  745.             null,
  746.             true,
  747.             true
  748.         );

  749.         /*
  750.          * Set up the Kruger Local Curve Control parameters as follows:
  751.          *  - C1 Kruger Monotone Smoothener with spurious extrema elimination and monotone filtering applied
  752.          *  - Zero Rate Quantification Metric
  753.          *  - Cubic Polynomial Basis Spline Set
  754.          *  - Ck = 2, Segment Curvature Penalty = 2
  755.          *  - Quadratic Rational Shape Controller
  756.          *  - Natural Boundary Setting
  757.          */

  758.         LocalControlCurveParams lccpKruger = new LocalControlCurveParams (
  759.             LocalMonotoneCkGenerator.C1_KRUGER,
  760.             LatentStateStatic.DISCOUNT_QM_ZERO_RATE,
  761.             new SegmentCustomBuilderControl (
  762.                 MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL,
  763.                 new PolynomialFunctionSetParams (4),
  764.                 SegmentInelasticDesignControl.Create (
  765.                     2,
  766.                     2
  767.                 ),
  768.                 new ResponseScalingShapeControl (
  769.                     true,
  770.                     new QuadraticRationalShapeControl (0.)
  771.                 ),
  772.                 null
  773.             ),
  774.             MultiSegmentSequence.CALIBRATE,
  775.             null,
  776.             null,
  777.             true,
  778.             true
  779.         );

  780.         /*
  781.          * Construct the Akima Locally Smoothened Discount Curve by applying the linear curve calibrator and
  782.          *  the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape
  783.          *  preserving discount curve.
  784.          */

  785.         MergedDiscountForwardCurve dcLocalAkima = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild (
  786.             dcShapePreserving,
  787.             lcc,
  788.             lccpAkima,
  789.             valParams,
  790.             null,
  791.             null,
  792.             null
  793.         );

  794.         /*
  795.          * Construct the Harmonic Locally Smoothened Discount Curve by applying the linear curve calibrator
  796.          *  and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape
  797.          *  preserving discount curve.
  798.          */

  799.         MergedDiscountForwardCurve dcLocalHarmonic = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild (
  800.             dcShapePreserving,
  801.             lcc,
  802.             lccpHarmonic,
  803.             valParams,
  804.             null,
  805.             null,
  806.             null
  807.         );

  808.         /*
  809.          * Construct the Hyman 1983 Locally Smoothened Discount Curve by applying the linear curve calibrator
  810.          *  and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape
  811.          *  preserving discount curve.
  812.          */

  813.         MergedDiscountForwardCurve dcLocalHyman83 = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild (
  814.             dcShapePreserving,
  815.             lcc,
  816.             lccpHyman83,
  817.             valParams,
  818.             null,
  819.             null,
  820.             null
  821.         );

  822.         /*
  823.          * Construct the Hyman 1989 Locally Smoothened Discount Curve by applying the linear curve calibrator
  824.          *  and the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape
  825.          *  preserving discount curve.
  826.          */

  827.         MergedDiscountForwardCurve dcLocalHyman89 = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild (
  828.             dcShapePreserving,
  829.             lcc,
  830.             lccpHyman89,
  831.             valParams,
  832.             null,
  833.             null,
  834.             null
  835.         );

  836.         /*
  837.          * Construct the Huynh-Le Floch delimited Locally Smoothened Discount Curve by applying the linear
  838.          *  curve calibrator and the Local Curve Control parameters to the array of Cash and Swap Stretches
  839.          *  and the shape preserving discount curve.
  840.          */

  841.         MergedDiscountForwardCurve dcLocalHuynhLeFloch = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild (
  842.             dcShapePreserving,
  843.             lcc,
  844.             lccpHuynhLeFloch,
  845.             valParams,
  846.             null,
  847.             null,
  848.             null
  849.         );

  850.         /*
  851.          * Construct the Kruger Locally Smoothened Discount Curve by applying the linear curve calibrator and
  852.          *  the Local Curve Control parameters to the array of Cash and Swap Stretches and the shape
  853.          *  preserving discount curve.
  854.          */

  855.         MergedDiscountForwardCurve dcLocalKruger = ScenarioDiscountCurveBuilder.SmoothingLocalControlBuild (
  856.             dcShapePreserving,
  857.             lcc,
  858.             lccpKruger,
  859.             valParams,
  860.             null,
  861.             null,
  862.             null
  863.         );

  864.         /*
  865.          * Cross-Comparison of the Cash Calibration Instrument "Rate" metric across the different curve
  866.          *  construction methodologies.
  867.          */

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

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

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

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

  872.         System.out.println ("\t        SHAPE PRESERVING   |  LOCAL AKIMA  | LOCAL HARMONIC | LOCAL HYMAN83 | LOCAL HYMAN89 | LOCAL HUYNHLF | LOCAL KRUGER  |  INPUT QUOTE  ");

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

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

  875.         for (int i = 0; i < aDepositComp.length; ++i)
  876.             System.out.println ("\t[" + aDepositComp[i].maturityDate() + "] = " +
  877.                 FormatUtil.FormatDouble (
  878.                     aDepositComp[i].measureValue (
  879.                         valParams,
  880.                         null,
  881.                         MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null),
  882.                         null,
  883.                         "Rate"),
  884.                     1, 6, 1.) + "   |   " +
  885.                 FormatUtil.FormatDouble (
  886.                     aDepositComp[i].measureValue (
  887.                         valParams,
  888.                         null,
  889.                         MarketParamsBuilder.Create (dcLocalAkima, null, null, null, null, null, null),
  890.                         null,
  891.                         "Rate"),
  892.                     1, 6, 1.) + "   |   " +
  893.                 FormatUtil.FormatDouble (
  894.                     aDepositComp[i].measureValue (
  895.                         valParams,
  896.                         null,
  897.                         MarketParamsBuilder.Create (dcLocalHarmonic, null, null, null, null, null, null),
  898.                         null,
  899.                         "Rate"),
  900.                     1, 6, 1.) + "    |   " +
  901.                 FormatUtil.FormatDouble (
  902.                     aDepositComp[i].measureValue (
  903.                         valParams,
  904.                         null,
  905.                         MarketParamsBuilder.Create (dcLocalHyman83, null, null, null, null, null, null),
  906.                         null,
  907.                         "Rate"),
  908.                     1, 6, 1.) + "   |   " +
  909.                 FormatUtil.FormatDouble (
  910.                     aDepositComp[i].measureValue (
  911.                         valParams,
  912.                         null,
  913.                         MarketParamsBuilder.Create (dcLocalHyman89, null, null, null, null, null, null),
  914.                         null,
  915.                         "Rate"),
  916.                     1, 6, 1.) + "   |   " +
  917.                 FormatUtil.FormatDouble (
  918.                     aDepositComp[i].measureValue (
  919.                         valParams,
  920.                         null,
  921.                         MarketParamsBuilder.Create (dcLocalHuynhLeFloch, null, null, null, null, null, null),
  922.                         null,
  923.                         "Rate"),
  924.                     1, 6, 1.) + "   |   " +
  925.                 FormatUtil.FormatDouble (
  926.                     aDepositComp[i].measureValue (
  927.                         valParams,
  928.                         null,
  929.                         MarketParamsBuilder.Create (dcLocalKruger, null, null, null, null, null, null),
  930.                         null,
  931.                         "Rate"),
  932.                     1, 6, 1.) + "   |   " +
  933.                 FormatUtil.FormatDouble (adblDepositQuote[i], 1, 6, 1.)
  934.             );

  935.         /*
  936.          * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve
  937.          *  construction methodologies.
  938.          */

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

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

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

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

  943.         System.out.println ("\t        SHAPE PRESERVING   |  LOCAL AKIMA  | LOCAL HARMONIC | LOCAL HYMAN83 | LOCAL HYMAN89 | LOCAL HUYNHLF | LOCAL KRUGER  |  INPUT QUOTE  ");

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

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

  946.         for (int i = 0; i < aSwapComp.length; ++i)
  947.             System.out.println ("\t[" + aSwapComp[i].maturityDate() + "] = " +
  948.                 FormatUtil.FormatDouble (
  949.                     aSwapComp[i].measureValue (
  950.                         valParams,
  951.                         null,
  952.                         MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null),
  953.                         null,
  954.                         "CalibSwapRate"),
  955.                     1, 6, 1.) + "   |   " +
  956.                 FormatUtil.FormatDouble (
  957.                     aSwapComp[i].measureValue (
  958.                         valParams,
  959.                         null,
  960.                         MarketParamsBuilder.Create (dcLocalAkima, null, null, null, null, null, null),
  961.                         null,
  962.                         "CalibSwapRate"),
  963.                     1, 6, 1.) + "   |   " +
  964.                 FormatUtil.FormatDouble (
  965.                     aSwapComp[i].measureValue (
  966.                         valParams,
  967.                         null,
  968.                         MarketParamsBuilder.Create (dcLocalHarmonic, null, null, null, null, null, null),
  969.                         null,
  970.                         "CalibSwapRate"),
  971.                     1, 6, 1.) + "    |   " +
  972.                 FormatUtil.FormatDouble (
  973.                     aSwapComp[i].measureValue (
  974.                         valParams,
  975.                         null,
  976.                         MarketParamsBuilder.Create (dcLocalHyman83, null, null, null, null, null, null),
  977.                         null,
  978.                         "CalibSwapRate"),
  979.                     1, 6, 1.) + "   |   " +
  980.                 FormatUtil.FormatDouble (
  981.                     aSwapComp[i].measureValue (
  982.                         valParams,
  983.                         null,
  984.                         MarketParamsBuilder.Create (dcLocalHyman89, null, null, null, null, null, null),
  985.                         null,
  986.                         "CalibSwapRate"),
  987.                     1, 6, 1.) + "   |   " +
  988.                 FormatUtil.FormatDouble (
  989.                     aSwapComp[i].measureValue (
  990.                         valParams,
  991.                         null,
  992.                         MarketParamsBuilder.Create (dcLocalHuynhLeFloch, null, null, null, null, null, null),
  993.                         null,
  994.                         "CalibSwapRate"),
  995.                     1, 6, 1.) + "   |   " +
  996.                 FormatUtil.FormatDouble (
  997.                     aSwapComp[i].measureValue (
  998.                         valParams,
  999.                         null,
  1000.                         MarketParamsBuilder.Create (dcLocalKruger, null, null, null, null, null, null),
  1001.                         null,
  1002.                         "CalibSwapRate"),
  1003.                     1, 6, 1.) + "   |   " +
  1004.                 FormatUtil.FormatDouble (adblSwapQuote[i], 1, 6, 1.)
  1005.             );

  1006.         /*
  1007.          * Cross-Comparison of the Swap Calibration Instrument "Rate" metric across the different curve
  1008.          *  construction methodologies for a sequence of bespoke swap instruments.
  1009.          */

  1010.         CalibratableComponent[] aCC = SwapInstrumentsFromMaturityTenor (
  1011.             dtSpot,
  1012.             strCurrency,
  1013.             new java.lang.String[] {
  1014.                 "3Y", "6Y", "9Y", "12Y", "15Y", "18Y", "21Y", "24Y", "27Y", "30Y"
  1015.             }
  1016.         );

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

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

  1019.         System.out.println ("\t                                                BESPOKE SWAPS PAR RATE");

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

  1021.         System.out.println ("\t        SHAPE PRESERVING   |  LOCAL AKIMA  | LOCAL HARMONIC | LOCAL HYMAN83  | LOCAL HYMAN89  | LOCAL HUYNHLF  | LOCAL KRUGER ");

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

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

  1024.         for (int i = 0; i < aCC.length; ++i)
  1025.             System.out.println ("\t[" + aCC[i].maturityDate() + "] = " +
  1026.                 FormatUtil.FormatDouble (
  1027.                     aCC[i].measureValue (
  1028.                         valParams,
  1029.                         null,
  1030.                     MarketParamsBuilder.Create (dcShapePreserving, null, null, null, null, null, null),
  1031.                     null,
  1032.                     "CalibSwapRate"),
  1033.                 1, 6, 1.) + "   |   " +
  1034.                 FormatUtil.FormatDouble (
  1035.                     aCC[i].measureValue (
  1036.                         valParams,
  1037.                         null,
  1038.                     MarketParamsBuilder.Create (dcLocalAkima, null, null, null, null, null, null),
  1039.                     null,
  1040.                     "CalibSwapRate"),
  1041.                 1, 6, 1.) + "   |   " +
  1042.                 FormatUtil.FormatDouble (
  1043.                     aCC[i].measureValue (
  1044.                         valParams,
  1045.                         null,
  1046.                     MarketParamsBuilder.Create (dcLocalHarmonic, null, null, null, null, null, null),
  1047.                     null,
  1048.                     "CalibSwapRate"),
  1049.                 1, 6, 1.) + "    |   " +
  1050.                 FormatUtil.FormatDouble (
  1051.                     aCC[i].measureValue (
  1052.                         valParams,
  1053.                         null,
  1054.                     MarketParamsBuilder.Create (dcLocalHyman83, null, null, null, null, null, null),
  1055.                     null,
  1056.                     "CalibSwapRate"),
  1057.                     1, 6, 1.) + "    |   " +
  1058.                 FormatUtil.FormatDouble (
  1059.                     aCC[i].measureValue (
  1060.                         valParams,
  1061.                         null,
  1062.                     MarketParamsBuilder.Create (dcLocalHyman89, null, null, null, null, null, null),
  1063.                     null,
  1064.                     "CalibSwapRate"),
  1065.                     1, 6, 1.) + "    |   " +
  1066.                 FormatUtil.FormatDouble (
  1067.                     aCC[i].measureValue (
  1068.                         valParams,
  1069.                         null,
  1070.                     MarketParamsBuilder.Create (dcLocalHuynhLeFloch, null, null, null, null, null, null),
  1071.                     null,
  1072.                     "CalibSwapRate"),
  1073.                     1, 6, 1.) + "    |   " +
  1074.                 FormatUtil.FormatDouble (
  1075.                     aCC[i].measureValue (
  1076.                         valParams,
  1077.                         null,
  1078.                     MarketParamsBuilder.Create (dcLocalKruger, null, null, null, null, null, null),
  1079.                     null,
  1080.                     "CalibSwapRate"),
  1081.                 1, 6, 1.)
  1082.             );
  1083.     }

  1084.     public static final void main (
  1085.         final String[] astrArgs)
  1086.         throws Exception
  1087.     {
  1088.         /*
  1089.          * Initialize the Credit Analytics Library
  1090.          */

  1091.         EnvManager.InitEnv ("");

  1092.         JulianDate dtToday = DateUtil.Today().addTenor ("0D");

  1093.         String strCurrency = "USD";

  1094.         ShapeDFZeroLocalSmoothSample (
  1095.             dtToday,
  1096.             strCurrency
  1097.         );

  1098.         EnvManager.TerminateEnv();
  1099.     }
  1100. }