Reconciler_Sink.java

  1. package org.drip.sample.bondmetrics;

  2. import java.util.*;

  3. import org.drip.analytics.date.*;
  4. import org.drip.numerical.common.Array2D;
  5. import org.drip.numerical.common.FormatUtil;
  6. import org.drip.param.creator.MarketParamsBuilder;
  7. import org.drip.param.market.CurveSurfaceQuoteContainer;
  8. import org.drip.param.valuation.*;
  9. import org.drip.product.creator.BondBuilder;
  10. import org.drip.product.credit.BondComponent;
  11. import org.drip.product.params.EmbeddedOptionSchedule;
  12. import org.drip.service.env.EnvManager;
  13. import org.drip.service.scenario.*;
  14. import org.drip.service.template.LatentMarketStateBuilder;
  15. import org.drip.state.credit.CreditCurve;
  16. import org.drip.state.discount.MergedDiscountForwardCurve;
  17. import org.drip.state.govvie.GovvieCurve;

  18. /*
  19.  * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  20.  */

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

  92. /**
  93.  * <i>Reconciler_Sink</i> demonstrates the Analytics Calculation/Reconciliation for the the Sinking Fund Bond
  94.  * YSW0U6.
  95.  *  
  96.  * <br><br>
  97.  *  <ul>
  98.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ProductCore.md">Product Core Module</a></li>
  99.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FixedIncomeAnalyticsLibrary.md">Fixed Income Analytics</a></li>
  100.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/README.md">DROP API Construction and Usage</a></li>
  101.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/bondmetrics/README.md">Bond Relative Value Replication Demonstration</a></li>
  102.  *  </ul>
  103.  * <br><br>
  104.  *
  105.  * @author Lakshmi Krishnamurthy
  106.  */

  107. public class Reconciler_Sink {

  108.     private static final MergedDiscountForwardCurve FundingCurve (
  109.         final JulianDate dtSpot,
  110.         final String strCurrency,
  111.         final double dblBump)
  112.         throws Exception
  113.     {
  114.         String[] astrDepositMaturityTenor = new String[] {
  115.             "2D"
  116.         };

  117.         double[] adblDepositQuote = new double[] {
  118.             0.0130411 + dblBump // 2D
  119.         };

  120.         double[] adblFuturesQuote = new double[] {
  121.             0.01345 + dblBump,  // 98.655
  122.             0.01470 + dblBump,  // 98.530
  123.             0.01575 + dblBump,  // 98.425
  124.             0.01660 + dblBump,  // 98.340
  125.             0.01745 + dblBump,  // 98.255
  126.             0.01845 + dblBump   // 98.155
  127.         };

  128.         String[] astrFixFloatMaturityTenor = new String[] {
  129.             "02Y",
  130.             "03Y",
  131.             "04Y",
  132.             "05Y",
  133.             "06Y",
  134.             "07Y",
  135.             "08Y",
  136.             "09Y",
  137.             "10Y",
  138.             "11Y",
  139.             "12Y",
  140.             "15Y",
  141.             "20Y",
  142.             "25Y",
  143.             "30Y",
  144.             "40Y",
  145.             "50Y"
  146.         };

  147.         double[] adblFixFloatQuote = new double[] {
  148.             0.016410 + dblBump, //  2Y
  149.             0.017863 + dblBump, //  3Y
  150.             0.019030 + dblBump, //  4Y
  151.             0.020035 + dblBump, //  5Y
  152.             0.020902 + dblBump, //  6Y
  153.             0.021660 + dblBump, //  7Y
  154.             0.022307 + dblBump, //  8Y
  155.             0.022879 + dblBump, //  9Y
  156.             0.023363 + dblBump, // 10Y
  157.             0.023820 + dblBump, // 11Y
  158.             0.024172 + dblBump, // 12Y
  159.             0.024934 + dblBump, // 15Y
  160.             0.025581 + dblBump, // 20Y
  161.             0.025906 + dblBump, // 25Y
  162.             0.025973 + dblBump, // 30Y
  163.             0.025838 + dblBump, // 40Y
  164.             0.025560 + dblBump  // 50Y
  165.         };

  166.         return LatentMarketStateBuilder.SmoothFundingCurve (
  167.             dtSpot,
  168.             strCurrency,
  169.             astrDepositMaturityTenor,
  170.             adblDepositQuote,
  171.             "ForwardRate",
  172.             adblFuturesQuote,
  173.             "ForwardRate",
  174.             astrFixFloatMaturityTenor,
  175.             adblFixFloatQuote,
  176.             "SwapRate"
  177.         );
  178.     }

  179.     private static final Map<String, MergedDiscountForwardCurve> TenorBumpedFundingCurve (
  180.         final JulianDate dtSpot,
  181.         final String strCurrency,
  182.         final double dblBump)
  183.         throws Exception
  184.     {
  185.         String[] astrDepositMaturityTenor = new String[] {
  186.             "2D"
  187.         };

  188.         double[] adblDepositQuote = new double[] {
  189.             0.0130411 // 2D
  190.         };

  191.         double[] adblFuturesQuote = new double[] {
  192.             0.01345,    // 98.655
  193.             0.01470,    // 98.530
  194.             0.01575,    // 98.425
  195.             0.01660,    // 98.340
  196.             0.01745,    // 98.255
  197.             0.01845     // 98.155
  198.         };

  199.         String[] astrFixFloatMaturityTenor = new String[] {
  200.             "02Y",
  201.             "03Y",
  202.             "04Y",
  203.             "05Y",
  204.             "06Y",
  205.             "07Y",
  206.             "08Y",
  207.             "09Y",
  208.             "10Y",
  209.             "11Y",
  210.             "12Y",
  211.             "15Y",
  212.             "20Y",
  213.             "25Y",
  214.             "30Y",
  215.             "40Y",
  216.             "50Y"
  217.         };

  218.         double[] adblFixFloatQuote = new double[] {
  219.             0.016410, //  2Y
  220.             0.017863, //  3Y
  221.             0.019030, //  4Y
  222.             0.020035, //  5Y
  223.             0.020902, //  6Y
  224.             0.021660, //  7Y
  225.             0.022307, //  8Y
  226.             0.022879, //  9Y
  227.             0.023363, // 10Y
  228.             0.023820, // 11Y
  229.             0.024172, // 12Y
  230.             0.024934, // 15Y
  231.             0.025581, // 20Y
  232.             0.025906, // 25Y
  233.             0.025973, // 30Y
  234.             0.025838, // 40Y
  235.             0.025560  // 50Y
  236.         };

  237.         return LatentMarketStateBuilder.BumpedFundingCurve (
  238.             dtSpot,
  239.             strCurrency,
  240.             astrDepositMaturityTenor,
  241.             adblDepositQuote,
  242.             "ForwardRate",
  243.             adblFuturesQuote,
  244.             "ForwardRate",
  245.             astrFixFloatMaturityTenor,
  246.             adblFixFloatQuote,
  247.             "SwapRate",
  248.             LatentMarketStateBuilder.SMOOTH,
  249.             dblBump,
  250.             false
  251.         );
  252.     }

  253.     private static final GovvieCurve GovvieCurve (
  254.         final JulianDate dtSpot,
  255.         final String strCode,
  256.         final double[] adblGovvieYield)
  257.         throws Exception
  258.     {
  259.         return LatentMarketStateBuilder.GovvieCurve (
  260.             strCode,
  261.             dtSpot,
  262.             new JulianDate[] {
  263.                 dtSpot,
  264.                 dtSpot,
  265.                 dtSpot,
  266.                 dtSpot,
  267.                 dtSpot,
  268.                 dtSpot,
  269.                 dtSpot,
  270.                 dtSpot
  271.             },
  272.             new JulianDate[] {
  273.                 dtSpot.addTenor ("1Y"),
  274.                 dtSpot.addTenor ("2Y"),
  275.                 dtSpot.addTenor ("3Y"),
  276.                 dtSpot.addTenor ("5Y"),
  277.                 dtSpot.addTenor ("7Y"),
  278.                 dtSpot.addTenor ("10Y"),
  279.                 dtSpot.addTenor ("20Y"),
  280.                 dtSpot.addTenor ("30Y")
  281.             },
  282.             adblGovvieYield,
  283.             adblGovvieYield,
  284.             "Yield",
  285.             LatentMarketStateBuilder.SHAPE_PRESERVING
  286.         );
  287.     }

  288.     private static final Map<String, GovvieCurve> TenorBumpedGovvieCurve (
  289.         final JulianDate dtSpot,
  290.         final String strCode,
  291.         final double dblBump,
  292.         final double[] adblGovvieYield)
  293.         throws Exception
  294.     {
  295.         return LatentMarketStateBuilder.BumpedGovvieCurve (
  296.             strCode,
  297.             dtSpot,
  298.             new JulianDate[] {
  299.                 dtSpot,
  300.                 dtSpot,
  301.                 dtSpot,
  302.                 dtSpot,
  303.                 dtSpot,
  304.                 dtSpot,
  305.                 dtSpot,
  306.                 dtSpot
  307.             },
  308.             new JulianDate[] {
  309.                 dtSpot.addTenor ("1Y"),
  310.                 dtSpot.addTenor ("2Y"),
  311.                 dtSpot.addTenor ("3Y"),
  312.                 dtSpot.addTenor ("5Y"),
  313.                 dtSpot.addTenor ("7Y"),
  314.                 dtSpot.addTenor ("10Y"),
  315.                 dtSpot.addTenor ("20Y"),
  316.                 dtSpot.addTenor ("30Y")
  317.             },
  318.             adblGovvieYield,
  319.             adblGovvieYield,
  320.             "Yield",
  321.             LatentMarketStateBuilder.SHAPE_PRESERVING,
  322.             dblBump,
  323.             false
  324.         );
  325.     }

  326.     private static final CreditCurve CreditCurve (
  327.         final JulianDate dtSpot,
  328.         final String strCreditCurve,
  329.         final MergedDiscountForwardCurve mdfc,
  330.         final String[] astrCreditTenor,
  331.         final double dblBump)
  332.         throws Exception
  333.     {
  334.         return LatentMarketStateBuilder.CreditCurve (
  335.             dtSpot,
  336.             strCreditCurve,
  337.             astrCreditTenor,
  338.             new double[] {
  339.                  60.,   //  6M
  340.                  68.,   //  1Y
  341.                  88.,   //  2Y
  342.                 102.,   //  3Y
  343.                 121.,   //  4Y
  344.                 138.,   //  5Y
  345.                 168.,   //  7Y
  346.                 188.    // 10Y
  347.             },
  348.             new double[] {
  349.                  60. + dblBump, //  6M
  350.                  68. + dblBump, //  1Y
  351.                  88. + dblBump, //  2Y
  352.                 102. + dblBump, //  3Y
  353.                 121. + dblBump, //  4Y
  354.                 138. + dblBump, //  5Y
  355.                 168. + dblBump, //  7Y
  356.                 188. + dblBump  // 10Y
  357.             },
  358.             "FairPremium",
  359.             mdfc
  360.         );
  361.     }

  362.     private static final Map<String, CreditCurve> TenorBumpedCreditCurve (
  363.         final JulianDate dtSpot,
  364.         final String strCreditCurve,
  365.         final MergedDiscountForwardCurve mdfc,
  366.         final double dblBump)
  367.         throws Exception
  368.     {
  369.         return LatentMarketStateBuilder.BumpedCreditCurve (
  370.             dtSpot,
  371.             strCreditCurve,
  372.             new String[] {
  373.                 "06M",
  374.                 "01Y",
  375.                 "02Y",
  376.                 "03Y",
  377.                 "04Y",
  378.                 "05Y",
  379.                 "07Y",
  380.                 "10Y"
  381.             },
  382.             new double[] {
  383.                  60.,   //  6M
  384.                  68.,   //  1Y
  385.                  88.,   //  2Y
  386.                 102.,   //  3Y
  387.                 121.,   //  4Y
  388.                 138.,   //  5Y
  389.                 168.,   //  7Y
  390.                 188.    // 10Y
  391.             },
  392.             new double[] {
  393.                  60.,   //  6M
  394.                  68.,   //  1Y
  395.                  88.,   //  2Y
  396.                 102.,   //  3Y
  397.                 121.,   //  4Y
  398.                 138.,   //  5Y
  399.                 168.,   //  7Y
  400.                 188.    // 10Y
  401.             },
  402.             "FairPremium",
  403.             mdfc,
  404.             dblBump,
  405.             false
  406.         );
  407.     }

  408.     private static final void SetEOS (
  409.         final BondComponent bond,
  410.         final EmbeddedOptionSchedule eosCall,
  411.         final EmbeddedOptionSchedule eosPut)
  412.         throws java.lang.Exception
  413.     {
  414.         if (null != eosPut) bond.setEmbeddedPutSchedule (eosPut);

  415.         if (null != eosCall) bond.setEmbeddedCallSchedule (eosCall);
  416.     }

  417.     private static final int NextCallDate (
  418.         final BondComponent bond,
  419.         final int iSpotDate)
  420.         throws java.lang.Exception
  421.     {
  422.         EmbeddedOptionSchedule eosCall = bond.callSchedule();

  423.         return null == eosCall ? bond.maturityDate().julian() : eosCall.nextDate (iSpotDate);
  424.     }

  425.     private static final double NextCallFactor (
  426.         final BondComponent bond,
  427.         final int iSpotDate)
  428.         throws java.lang.Exception
  429.     {
  430.         EmbeddedOptionSchedule eosCall = bond.callSchedule();

  431.         return null == eosCall ? 1. : eosCall.nextFactor (iSpotDate);
  432.     }

  433.     public static final void main (
  434.         final String[] astrArgs)
  435.         throws Exception
  436.     {
  437.         EnvManager.InitEnv (
  438.             "",
  439.             true
  440.         );

  441.         JulianDate dtSpot = DateUtil.CreateFromYMD (
  442.             2017,
  443.             DateUtil.JULY,
  444.             10
  445.         );

  446.         String[] astrDepositTenor = new String[] {
  447.             "2D"
  448.         };

  449.         double[] adblDepositQuote = new double[] {
  450.             0.0130411 // 2D
  451.         };

  452.         double[] adblFuturesQuote = new double[] {
  453.             0.01345,    // 98.655
  454.             0.01470,    // 98.530
  455.             0.01575,    // 98.425
  456.             0.01660,    // 98.340
  457.             0.01745,    // 98.255
  458.             0.01845     // 98.155
  459.         };

  460.         String[] astrFixFloatTenor = new String[] {
  461.             "02Y",
  462.             "03Y",
  463.             "04Y",
  464.             "05Y",
  465.             "06Y",
  466.             "07Y",
  467.             "08Y",
  468.             "09Y",
  469.             "10Y",
  470.             "11Y",
  471.             "12Y",
  472.             "15Y",
  473.             "20Y",
  474.             "25Y",
  475.             "30Y",
  476.             "40Y",
  477.             "50Y"
  478.         };

  479.         String[] astrGovvieTenor = new String[] {
  480.             "1Y",
  481.             "2Y",
  482.             "3Y",
  483.             "5Y",
  484.             "7Y",
  485.             "10Y",
  486.             "20Y",
  487.             "30Y"
  488.         };

  489.         double[] adblFixFloatQuote = new double[] {
  490.             0.016410, //  2Y
  491.             0.017863, //  3Y
  492.             0.019030, //  4Y
  493.             0.020035, //  5Y
  494.             0.020902, //  6Y
  495.             0.021660, //  7Y
  496.             0.022307, //  8Y
  497.             0.022879, //  9Y
  498.             0.023363, // 10Y
  499.             0.023820, // 11Y
  500.             0.024172, // 12Y
  501.             0.024934, // 15Y
  502.             0.025581, // 20Y
  503.             0.025906, // 25Y
  504.             0.025973, // 30Y
  505.             0.025838, // 40Y
  506.             0.025560  // 50Y
  507.         };

  508.         double[] adblGovvieYield = new double[] {
  509.             0.01219, //  1Y
  510.             0.01391, //  2Y
  511.             0.01590, //  3Y
  512.             0.01937, //  5Y
  513.             0.02200, //  7Y
  514.             0.02378, // 10Y
  515.             0.02677, // 20Y
  516.             0.02927  // 30Y
  517.         };

  518.         String[] astrCreditTenor = new String[] {
  519.             "06M",
  520.             "01Y",
  521.             "02Y",
  522.             "03Y",
  523.             "04Y",
  524.             "05Y",
  525.             "07Y",
  526.             "10Y"
  527.         };

  528.         double[] adblCreditQuote = new double[] {
  529.              60.,   //  6M
  530.              68.,   //  1Y
  531.              88.,   //  2Y
  532.             102.,   //  3Y
  533.             121.,   //  4Y
  534.             138.,   //  5Y
  535.             168.,   //  7Y
  536.             188.    // 10Y
  537.         };
  538.         double dblFX = 1.;
  539.         int iSettleLag = 3;
  540.         int iCouponFreq = 2;
  541.         String strName = "YSW0U6";
  542.         double dblCleanPrice = 0.4;
  543.         double dblIssuePrice = 0.4;
  544.         String strCurrency = "USD";
  545.         double dblSpreadBump = 20.;
  546.         double dblCouponRate = 0.00000;
  547.         double dblIssueAmount = 903433.6;
  548.         String strTreasuryCode = "UST";
  549.         String strCouponDayCount = "30/360";
  550.         double dblSpreadDurationMultiplier = 5.;
  551.         String strDateFactor = "1/1/2050;903433.6;1/1/2051;843446.4;1/1/2052;787414.4;1/1/2053;735008.0;7/1/2053;170403.2";

  552.         JulianDate dtEffective = DateUtil.CreateFromYMD (
  553.             2013,
  554.             12,
  555.             23
  556.         );

  557.         JulianDate dtMaturity = DateUtil.CreateFromYMD (
  558.             2053,
  559.             7,
  560.             1
  561.         );

  562.         BondComponent bond = BondBuilder.CreateSimpleFixed (
  563.             strName,
  564.             strCurrency,
  565.             strName,
  566.             dblCouponRate,
  567.             iCouponFreq,
  568.             strCouponDayCount,
  569.             dtEffective,
  570.             dtMaturity,
  571.             Array2D.FromDateFactorVertex (
  572.                 strDateFactor,
  573.                 dtMaturity.julian(),
  574.                 dblIssueAmount
  575.             ),
  576.             null
  577.         );

  578.         SetEOS (
  579.             bond,
  580.             null,
  581.             null
  582.         );

  583.         int iSpotDate = dtSpot.julian();

  584.         JulianDate dtSettle = dtSpot.addBusDays (
  585.             iSettleLag,
  586.             strCurrency
  587.         );

  588.         ValuationParams valParams = new ValuationParams (
  589.             dtSpot,
  590.             dtSettle,
  591.             strCurrency
  592.         );

  593.         MergedDiscountForwardCurve mdfcBase = FundingCurve (
  594.             dtSpot,
  595.             strCurrency,
  596.             0.
  597.         );

  598.         GovvieCurve gc = GovvieCurve (
  599.             dtSpot,
  600.             strTreasuryCode,
  601.             adblGovvieYield
  602.         );

  603.         CurveSurfaceQuoteContainer csqcBase = MarketParamsBuilder.Create (
  604.             mdfcBase,
  605.             gc,
  606.             null,
  607.             null,
  608.             null,
  609.             null,
  610.             null
  611.         );

  612.         CurveSurfaceQuoteContainer csqcCreditBase = MarketParamsBuilder.Create (
  613.             mdfcBase,
  614.             gc,
  615.             CreditCurve (
  616.                 dtSpot,
  617.                 strName,
  618.                 mdfcBase,
  619.                 astrCreditTenor,
  620.                 0.
  621.             ),
  622.             null,
  623.             null,
  624.             null,
  625.             null
  626.         );

  627.         CurveSurfaceQuoteContainer csqcBumped01Up = MarketParamsBuilder.Create (
  628.             FundingCurve (
  629.                 dtSpot,
  630.                 strCurrency,
  631.                 0.0001
  632.             ),
  633.             gc,
  634.             null,
  635.             null,
  636.             null,
  637.             null,
  638.             null
  639.         );

  640.         CurveSurfaceQuoteContainer csqcCreditBumped01Up = MarketParamsBuilder.Create (
  641.             mdfcBase,
  642.             gc,
  643.             CreditCurve (
  644.                 dtSpot,
  645.                 strName,
  646.                 mdfcBase,
  647.                 astrCreditTenor,
  648.                 1.
  649.             ),
  650.             null,
  651.             null,
  652.             null,
  653.             null
  654.         );

  655.         double dblAccrued = bond.accrued (
  656.             dtSettle.julian(),
  657.             csqcBase
  658.         );

  659.         WorkoutInfo wi = bond.exerciseYieldFromPrice (
  660.             valParams,
  661.             csqcBase,
  662.             null,
  663.             dblCleanPrice
  664.         );

  665.         double dblBondBasisToMaturity = bond.bondBasisFromPrice (
  666.             valParams,
  667.             csqcBase,
  668.             null,
  669.             dblCleanPrice
  670.         );

  671.         double dblModifiedDurationToMaturity = (
  672.             dblCleanPrice - bond.priceFromBondBasis (
  673.                 valParams,
  674.                 csqcBumped01Up,
  675.                 null,
  676.                 dblBondBasisToMaturity
  677.             )
  678.         ) / dblCleanPrice;

  679.         double dblYieldToMaturity = bond.yieldFromPrice (
  680.             valParams,
  681.             csqcBase,
  682.             null,
  683.             dblCleanPrice
  684.         );

  685.         double dblBondEquivalentYieldToMaturity = bond.yieldFromPrice (
  686.             valParams,
  687.             csqcBase,
  688.             ValuationCustomizationParams.BondEquivalent (strCurrency),
  689.             dblCleanPrice
  690.         );

  691.         double dblFlatForwardRateYieldToMaturity = bond.yieldFromPrice (
  692.             valParams,
  693.             csqcBase,
  694.             new ValuationCustomizationParams (
  695.                 strCouponDayCount,
  696.                 iCouponFreq,
  697.                 false,
  698.                 null,
  699.                 strCurrency,
  700.                 false,
  701.                 true
  702.             ),
  703.             dblCleanPrice
  704.         );

  705.         double dblYieldToExercise = bond.yieldFromPrice (
  706.             valParams,
  707.             csqcBase,
  708.             null,
  709.             wi.date(),
  710.             wi.factor(),
  711.             dblCleanPrice
  712.         );

  713.         double dblYieldToNextCall = bond.yieldFromPrice (
  714.             valParams,
  715.             csqcBase,
  716.             null,
  717.             NextCallDate (
  718.                 bond,
  719.                 iSpotDate
  720.             ),
  721.             NextCallFactor (
  722.                 bond,
  723.                 iSpotDate
  724.             ),
  725.             dblCleanPrice
  726.         );

  727.         double dblNominalYield = bond.yieldFromPrice (
  728.             valParams,
  729.             csqcBase,
  730.             null,
  731.             dblIssuePrice
  732.         );

  733.         double dblOASToMaturity = bond.oasFromPrice (
  734.             valParams,
  735.             csqcBase,
  736.             null,
  737.             dblCleanPrice
  738.         );

  739.         double dblOASToExercise = bond.oasFromPrice (
  740.             valParams,
  741.             csqcBase,
  742.             null,
  743.             wi.date(),
  744.             wi.factor(),
  745.             dblCleanPrice
  746.         );

  747.         double dblZSpreadToMaturity = bond.zSpreadFromPrice (
  748.             valParams,
  749.             csqcBase,
  750.             null,
  751.             dblCleanPrice
  752.         );

  753.         double dblZSpreadToExercise = bond.zSpreadFromPrice (
  754.             valParams,
  755.             csqcBase,
  756.             null,
  757.             wi.date(),
  758.             wi.factor(),
  759.             dblCleanPrice
  760.         );

  761.         double dblParZSpreadToExercise = bond.zSpreadFromPrice (
  762.             valParams,
  763.             csqcBase,
  764.             null,
  765.             wi.date(),
  766.             wi.factor(),
  767.             1.
  768.         );

  769.         double dblParOASToExercise = bond.oasFromPrice (
  770.             valParams,
  771.             csqcBase,
  772.             null,
  773.             wi.date(),
  774.             wi.factor(),
  775.             1.
  776.         );

  777.         double dblMacaulayDurationToMaturity = bond.macaulayDurationFromPrice (
  778.             valParams,
  779.             csqcBase,
  780.             null,
  781.             dblCleanPrice
  782.         );

  783.         double dblBondBasisToExercise = bond.bondBasisFromPrice (
  784.             valParams,
  785.             csqcBase,
  786.             null,
  787.             wi.date(),
  788.             wi.factor(),
  789.             dblCleanPrice
  790.         );

  791.         double dblModifiedDurationToWorst = (
  792.             dblCleanPrice - bond.priceFromBondBasis (
  793.                 valParams,
  794.                 csqcBumped01Up,
  795.                 null,
  796.                 wi.date(),
  797.                 wi.factor(),
  798.                 dblBondBasisToExercise
  799.             )
  800.         ) / dblCleanPrice;

  801.         double dblDV01 = 0.5 * (
  802.             bond.priceFromYield (
  803.                 valParams,
  804.                 csqcBase,
  805.                 null,
  806.                 wi.date(),
  807.                 wi.factor(),
  808.                 dblYieldToExercise - 0.0001 * dblSpreadBump
  809.             ) -
  810.             bond.priceFromYield (
  811.                 valParams,
  812.                 csqcBase,
  813.                 null,
  814.                 wi.date(),
  815.                 wi.factor(),
  816.                 dblYieldToExercise + 0.0001 * dblSpreadBump
  817.             )
  818.         ) / dblSpreadBump;

  819.         double dblEffectiveDuration = dblDV01 / dblCleanPrice;

  820.         double dblCreditBasisToExercise = bond.creditBasisFromPrice (
  821.             valParams,
  822.             csqcCreditBase,
  823.             null,
  824.             wi.date(),
  825.             wi.factor(),
  826.             dblCleanPrice
  827.         );

  828.         double dblParCreditBasisToExercise = bond.creditBasisFromPrice (
  829.             valParams,
  830.             csqcCreditBase,
  831.             null,
  832.             wi.date(),
  833.             wi.factor(),
  834.             1.
  835.         );

  836.         double dblEffectiveDurationAdj = 0.5 * (
  837.             bond.priceFromCreditBasis (
  838.                 valParams,
  839.                 csqcCreditBase,
  840.                 null,
  841.                 wi.date(),
  842.                 wi.factor(),
  843.                 dblCreditBasisToExercise - dblSpreadBump
  844.             ) -
  845.             bond.priceFromCreditBasis (
  846.                 valParams,
  847.                 csqcCreditBase,
  848.                 null,
  849.                 wi.date(),
  850.                 wi.factor(),
  851.                 dblCreditBasisToExercise + dblSpreadBump
  852.             )
  853.         ) / dblCleanPrice / dblSpreadBump;

  854.         double dblSpreadDuration = dblSpreadDurationMultiplier * (dblCleanPrice -
  855.             bond.priceFromZSpread (
  856.                 valParams,
  857.                 csqcBase,
  858.                 null,
  859.                 wi.date(),
  860.                 wi.factor(),
  861.                 dblZSpreadToExercise + 0.0001 * dblSpreadBump
  862.             )
  863.         ) / dblCleanPrice;

  864.         double dblCV01 = dblCleanPrice - bond.priceFromCreditBasis (
  865.             valParams,
  866.             csqcCreditBumped01Up,
  867.             null,
  868.             wi.date(),
  869.             wi.factor(),
  870.             dblCreditBasisToExercise
  871.         );

  872.         Map<String, Double> mapLIBORKRD = new HashMap<String, Double>();

  873.         Map<String, Double> mapLIBORKPRD = new HashMap<String, Double>();

  874.         Map<String, MergedDiscountForwardCurve> mapFundingCurve = TenorBumpedFundingCurve (
  875.             dtSpot,
  876.             strCurrency,
  877.             0.0001
  878.         );

  879.         for (Map.Entry<String, MergedDiscountForwardCurve> meFunding : mapFundingCurve.entrySet()) {
  880.             CurveSurfaceQuoteContainer csqcFunding = MarketParamsBuilder.Create (
  881.                 meFunding.getValue(),
  882.                 gc,
  883.                 null,
  884.                 null,
  885.                 null,
  886.                 null,
  887.                 null
  888.             );

  889.             mapLIBORKRD.put (
  890.                 meFunding.getKey(),
  891.                 (dblCleanPrice - bond.priceFromZSpread (
  892.                     valParams,
  893.                     csqcFunding,
  894.                     null,
  895.                     wi.date(),
  896.                     wi.factor(),
  897.                     dblZSpreadToExercise
  898.                 )) / dblCleanPrice
  899.             );

  900.             mapLIBORKPRD.put (
  901.                 meFunding.getKey(),
  902.                 1. - bond.priceFromZSpread (
  903.                     valParams,
  904.                     csqcFunding,
  905.                     null,
  906.                     wi.date(),
  907.                     wi.factor(),
  908.                     dblParZSpreadToExercise
  909.                 )
  910.             );
  911.         }

  912.         Map<String, Double> mapGovvieKRD = new HashMap<String, Double>();

  913.         Map<String, Double> mapGovvieKPRD = new HashMap<String, Double>();

  914.         Map<String, GovvieCurve> mapGovvieCurve = TenorBumpedGovvieCurve (
  915.             dtSpot,
  916.             strTreasuryCode,
  917.             0.0001,
  918.             adblGovvieYield
  919.         );

  920.         for (Map.Entry<String, GovvieCurve> meGovvie : mapGovvieCurve.entrySet()) {
  921.             CurveSurfaceQuoteContainer csqcGovvie = MarketParamsBuilder.Create (
  922.                 mdfcBase,
  923.                 meGovvie.getValue(),
  924.                 null,
  925.                 null,
  926.                 null,
  927.                 null,
  928.                 null
  929.             );

  930.             mapGovvieKRD.put (
  931.                 meGovvie.getKey(),
  932.                 (dblCleanPrice - bond.priceFromOAS (
  933.                     valParams,
  934.                     csqcGovvie,
  935.                     null,
  936.                     wi.date(),
  937.                     wi.factor(),
  938.                     dblOASToExercise
  939.                 )) / dblCleanPrice
  940.             );

  941.             mapGovvieKPRD.put (
  942.                 meGovvie.getKey(),
  943.                 1. - bond.priceFromOAS (
  944.                     valParams,
  945.                     csqcGovvie,
  946.                     null,
  947.                     wi.date(),
  948.                     wi.factor(),
  949.                     dblParOASToExercise
  950.                 )
  951.             );
  952.         }

  953.         Map<String, Double> mapCreditKRD = new HashMap<String, Double>();

  954.         Map<String, Double> mapCreditKPRD = new HashMap<String, Double>();

  955.         Map<String, CreditCurve> mapCreditCurve = TenorBumpedCreditCurve (
  956.             dtSpot,
  957.             strName,
  958.             mdfcBase,
  959.             1.
  960.         );

  961.         for (Map.Entry<String, CreditCurve> meCredit : mapCreditCurve.entrySet()) {
  962.             CurveSurfaceQuoteContainer csqcCredit = MarketParamsBuilder.Create (
  963.                 mdfcBase,
  964.                 gc,
  965.                 meCredit.getValue(),
  966.                 null,
  967.                 null,
  968.                 null,
  969.                 null
  970.             );

  971.             mapCreditKRD.put (
  972.                 meCredit.getKey(),
  973.                 (dblCleanPrice - bond.priceFromCreditBasis (
  974.                     valParams,
  975.                     csqcCredit,
  976.                     null,
  977.                     wi.date(),
  978.                     wi.factor(),
  979.                     dblCreditBasisToExercise
  980.                 )) / dblCleanPrice
  981.             );

  982.             mapCreditKPRD.put (
  983.                 meCredit.getKey(),
  984.                 1. - bond.priceFromCreditBasis (
  985.                     valParams,
  986.                     csqcCredit,
  987.                     null,
  988.                     wi.date(),
  989.                     wi.factor(),
  990.                     dblParCreditBasisToExercise
  991.                 )
  992.             );
  993.         }

  994.         double dblConvexityToExercise = bond.convexityFromPrice (
  995.             valParams,
  996.             csqcBase,
  997.             null,
  998.             wi.date(),
  999.             wi.factor(),
  1000.             dblCleanPrice
  1001.         );

  1002.         double dblDiscountMarginToExercise = dblYieldToExercise - mdfcBase.libor (
  1003.             dtSpot,
  1004.             "1M"
  1005.         );

  1006.         double dblESpreadToExercise = bond.zSpreadFromPrice (
  1007.             valParams,
  1008.             MarketParamsBuilder.Create (
  1009.                 LatentMarketStateBuilder.SmoothFundingCurve (
  1010.                     dtSpot,
  1011.                     strCurrency,
  1012.                     astrDepositTenor,
  1013.                     adblDepositQuote,
  1014.                     "ForwardRate",
  1015.                     adblFuturesQuote,
  1016.                     "ForwardRate",
  1017.                     null,
  1018.                     null,
  1019.                     "SwapRate"
  1020.                 ),
  1021.                 gc,
  1022.                 null,
  1023.                 null,
  1024.                 null,
  1025.                 null,
  1026.                 null
  1027.             ),
  1028.             null,
  1029.             wi.date(),
  1030.             wi.factor(),
  1031.             dblCleanPrice
  1032.         );

  1033.         double dblISpreadToExercise = bond.iSpreadFromPrice (
  1034.             valParams,
  1035.             csqcBase,
  1036.             null,
  1037.             wi.date(),
  1038.             wi.factor(),
  1039.             dblCleanPrice
  1040.         );

  1041.         double dblJSpreadToExercise = bond.jSpreadFromPrice (
  1042.             valParams,
  1043.             csqcBase,
  1044.             null,
  1045.             wi.date(),
  1046.             wi.factor(),
  1047.             dblCleanPrice
  1048.         );

  1049.         double dblWALToExercise = bond.weightedAverageLife (
  1050.             valParams,
  1051.             csqcBase,
  1052.             wi.date(),
  1053.             wi.factor()
  1054.         );

  1055.         double dblWALPrincipalOnlyToExercise = bond.weightedAverageLifePrincipalOnly (
  1056.             valParams,
  1057.             csqcBase,
  1058.             wi.date(),
  1059.             wi.factor()
  1060.         );

  1061.         double dblWALLossOnlyToExercise = bond.weightedAverageLifeLossOnly (
  1062.             valParams,
  1063.             csqcCreditBase,
  1064.             wi.date(),
  1065.             wi.factor()
  1066.         );

  1067.         double dblWALCouponOnlyToExercise = bond.weightedAverageLifeCouponOnly (
  1068.             valParams,
  1069.             csqcBase,
  1070.             wi.date(),
  1071.             wi.factor()
  1072.         );

  1073.         System.out.println();

  1074.         BondReplicator ar = BondReplicator.CorporateSenior (
  1075.             dblCleanPrice,
  1076.             dblIssuePrice,
  1077.             dblIssueAmount,
  1078.             dtSpot,
  1079.             astrDepositTenor,
  1080.             adblDepositQuote,
  1081.             adblFuturesQuote,
  1082.             astrFixFloatTenor,
  1083.             adblFixFloatQuote,
  1084.             dblSpreadBump,
  1085.             dblSpreadDurationMultiplier,
  1086.             strTreasuryCode,
  1087.             astrGovvieTenor,
  1088.             adblGovvieYield,
  1089.             astrCreditTenor,
  1090.             adblCreditQuote,
  1091.             dblFX,
  1092.             Double.NaN,
  1093.             iSettleLag,
  1094.             bond
  1095.         );

  1096.         BondReplicationRun arr = ar.generateRun();

  1097.         Map<String, NamedField> mapNF = arr.namedField();

  1098.         Map<String, NamedFieldMap> mapNFM = arr.namedFieldMap();

  1099.         NamedFieldMap nfmLIBORKRD = mapNFM.get ("LIBOR KRD");

  1100.         NamedFieldMap nfmLIBORKPRD = mapNFM.get ("LIBOR KPRD");

  1101.         NamedFieldMap nfmGovvieKRD = mapNFM.get ("Govvie KRD");

  1102.         NamedFieldMap nfmGovvieKPRD = mapNFM.get ("Govvie KPRD");

  1103.         NamedFieldMap nfmCreditKRD = mapNFM.get ("Credit KRD");

  1104.         NamedFieldMap nfmCreditKPRD = mapNFM.get ("Credit KPRD");

  1105.         System.out.println ("\t||------------------------------------------------||");

  1106.         System.out.println (
  1107.             "\t|| ID                      =>  " +
  1108.             strName + "-" + strCurrency
  1109.         );

  1110.         System.out.println (
  1111.             "\t|| Price                   => " +
  1112.             FormatUtil.FormatDouble (dblCleanPrice, 3, 3, 100.) + " | " +
  1113.             FormatUtil.FormatDouble (mapNF.get ("Price").value(), 3, 3, 100.)
  1114.         );

  1115.         System.out.println (
  1116.             "\t|| Market Value            => " +
  1117.             FormatUtil.FormatDouble (dblCleanPrice * dblIssueAmount, 7, 2, 1.) + " | " +
  1118.             FormatUtil.FormatDouble (mapNF.get ("Market Value").value(), 7, 2, 1.)
  1119.         );

  1120.         System.out.println (
  1121.             "\t|| Accrued                 => " +
  1122.             FormatUtil.FormatDouble (dblAccrued, 1, 4, 1.) + " | " +
  1123.             FormatUtil.FormatDouble (mapNF.get ("Accrued").value(), 1, 4, 1.)
  1124.         );

  1125.         System.out.println (
  1126.             "\t|| Accrued                 => " +
  1127.             FormatUtil.FormatDouble (dblAccrued * dblIssueAmount, 5, 2, 1.) + " | " +
  1128.             FormatUtil.FormatDouble (mapNF.get ("Accrued$").value(), 5, 2, 1.)
  1129.         );

  1130.         System.out.println (
  1131.             "\t|| Accrued Interest Factor => " +
  1132.             FormatUtil.FormatDouble (dblAccrued * dblFX, 1, 4, 1.) + " | " +
  1133.             FormatUtil.FormatDouble (mapNF.get ("Accrued Interest Factor").value(), 1, 4, 1.)
  1134.         );

  1135.         System.out.println (
  1136.             "\t|| Yield To Maturity       => " +
  1137.             FormatUtil.FormatDouble (dblYieldToMaturity, 1, 2, 100.) + "% | " +
  1138.             FormatUtil.FormatDouble (mapNF.get ("Yield To Maturity").value(), 1, 2, 100.) + "%"
  1139.         );

  1140.         System.out.println (
  1141.             "\t|| Yield To Maturity CBE   => " +
  1142.             FormatUtil.FormatDouble (dblBondEquivalentYieldToMaturity, 1, 2, 100.) + "% | " +
  1143.             FormatUtil.FormatDouble (mapNF.get ("Yield To Maturity CBE").value(), 1, 2, 100.) + "%"
  1144.         );

  1145.         System.out.println (
  1146.             "\t|| YTM fwdCpn              => " +
  1147.             FormatUtil.FormatDouble (dblFlatForwardRateYieldToMaturity, 1, 2, 100.) + "% | " +
  1148.             FormatUtil.FormatDouble (mapNF.get ("YTM fwdCpn").value(), 1, 2, 100.) + "%"
  1149.         );

  1150.         System.out.println (
  1151.             "\t|| Yield To Worst          => " +
  1152.             FormatUtil.FormatDouble (dblYieldToExercise, 1, 2, 100.) + "% | " +
  1153.             FormatUtil.FormatDouble (mapNF.get ("Yield To Worst").value(), 1, 2, 100.) + "%"
  1154.         );

  1155.         System.out.println (
  1156.             "\t|| YIELD TO CALL           => " +
  1157.             FormatUtil.FormatDouble (dblYieldToNextCall, 1, 2, 100.) + "% | " +
  1158.             FormatUtil.FormatDouble (mapNF.get ("YIELD TO CALL").value(), 1, 2, 100.) + "%"
  1159.         );

  1160.         System.out.println (
  1161.             "\t|| Nominal Yield           => " +
  1162.             FormatUtil.FormatDouble (dblNominalYield, 1, 2, 100.) + "% | " +
  1163.             FormatUtil.FormatDouble (mapNF.get ("Nominal Yield").value(), 1, 2, 100.) + "%"
  1164.         );

  1165.         System.out.println (
  1166.             "\t|| Z_Spread                => " +
  1167.             FormatUtil.FormatDouble (dblOASToMaturity, 3, 1, 10000.) + " | " +
  1168.             FormatUtil.FormatDouble (mapNF.get ("Z_Spread").value(), 3, 1, 10000.)
  1169.         );

  1170.         System.out.println (
  1171.             "\t|| Z_Vol_OAS               => " +
  1172.             FormatUtil.FormatDouble (dblZSpreadToMaturity, 3, 1, 10000.) + " | " +
  1173.             FormatUtil.FormatDouble (mapNF.get ("Z_Vol_OAS").value(), 3, 1, 10000.)
  1174.         );

  1175.         System.out.println (
  1176.             "\t|| OAS                     => " +
  1177.             FormatUtil.FormatDouble (dblZSpreadToExercise, 3, 1, 10000.) + " | " +
  1178.             FormatUtil.FormatDouble (mapNF.get ("OAS").value(), 3, 1, 10000.)
  1179.         );

  1180.         System.out.println (
  1181.             "\t|| TSY OAS                 => " +
  1182.             FormatUtil.FormatDouble (dblOASToExercise, 3, 1, 10000.) + " | " +
  1183.             FormatUtil.FormatDouble (mapNF.get ("TSY OAS").value(), 3, 1, 10000.)
  1184.         );

  1185.         System.out.println (
  1186.             "\t|| MOD DUR                 => " +
  1187.             FormatUtil.FormatDouble (dblModifiedDurationToMaturity, 1, 3, 10000.) + " | " +
  1188.             FormatUtil.FormatDouble (mapNF.get ("MOD DUR").value(), 1, 3, 10000.)
  1189.         );

  1190.         System.out.println (
  1191.             "\t|| MACAULAY DURATION       => " +
  1192.             FormatUtil.FormatDouble (dblMacaulayDurationToMaturity, 1, 3, 1.) + " | " +
  1193.             FormatUtil.FormatDouble (mapNF.get ("MACAULAY DURATION").value(), 1, 3, 1.)
  1194.         );

  1195.         System.out.println (
  1196.             "\t|| MOD DUR TO WORST        => " +
  1197.             FormatUtil.FormatDouble (dblModifiedDurationToWorst, 1, 3, 10000.) + " | " +
  1198.             FormatUtil.FormatDouble (mapNF.get ("MOD DUR TO WORST").value(), 1, 3, 10000.)
  1199.         );

  1200.         System.out.println (
  1201.             "\t|| EFFECTIVE DURATION      => " +
  1202.             FormatUtil.FormatDouble (dblEffectiveDuration, 1, 3, 10000.) + " | " +
  1203.             FormatUtil.FormatDouble (mapNF.get ("EFFECTIVE DURATION").value(), 1, 3, 10000.)
  1204.         );

  1205.         System.out.println (
  1206.             "\t|| EFFECTIVE DURATION ADJ  => " +
  1207.             FormatUtil.FormatDouble (dblEffectiveDurationAdj, 1, 3, 10000.) + " | " +
  1208.             FormatUtil.FormatDouble (mapNF.get ("EFFECTIVE DURATION ADJ").value(), 1, 3, 10000.)
  1209.         );

  1210.         System.out.println (
  1211.             "\t|| OAD MULT                => " +
  1212.             FormatUtil.FormatDouble (dblEffectiveDurationAdj / dblEffectiveDuration, 1, 3, 1.) + " | " +
  1213.             FormatUtil.FormatDouble (mapNF.get ("OAD MULT").value(), 1, 3, 1.)
  1214.         );

  1215.         System.out.println (
  1216.             "\t|| Spread Dur              => " +
  1217.             FormatUtil.FormatDouble (dblSpreadDuration, 1, 3, 100.) + " | " +
  1218.             FormatUtil.FormatDouble (mapNF.get ("Spread Dur").value(), 1, 3, 100.)
  1219.         );

  1220.         System.out.println (
  1221.             "\t|| Spread Dur              => " +
  1222.             FormatUtil.FormatDouble (dblSpreadDuration * dblIssueAmount, 1, 3, 1.) + " | " +
  1223.             FormatUtil.FormatDouble (mapNF.get ("Spread Dur $").value(), 1, 3, 1.)
  1224.         );

  1225.         System.out.println (
  1226.             "\t|| DV01                    => " +
  1227.             FormatUtil.FormatDouble (dblDV01, 1, 3, 10000.) + " | " +
  1228.             FormatUtil.FormatDouble (mapNF.get ("DV01").value(), 1, 3, 10000.)
  1229.         );

  1230.         System.out.println (
  1231.             "\t|| CV01                    => " +
  1232.             FormatUtil.FormatDouble (dblCV01, 1, 3, 10000.) + " | " +
  1233.             FormatUtil.FormatDouble (mapNF.get ("CV01").value(), 1, 3, 10000.)
  1234.         );

  1235.         System.out.println (
  1236.             "\t|| Convexity               => " +
  1237.             FormatUtil.FormatDouble (dblConvexityToExercise, 1, 3, 1000000.) + " | " +
  1238.             FormatUtil.FormatDouble (mapNF.get ("Convexity").value(), 1, 3, 1000000.)
  1239.         );

  1240.         System.out.println (
  1241.             "\t|| Modified Convexity      => " +
  1242.             FormatUtil.FormatDouble (dblConvexityToExercise, 1, 3, 1000000.) + " | " +
  1243.             FormatUtil.FormatDouble (mapNF.get ("Modified Convexity").value(), 1, 3, 1000000.)
  1244.         );

  1245.         System.out.println (
  1246.             "\t|| DISCOUNT MARGIN         => " +
  1247.             FormatUtil.FormatDouble (dblDiscountMarginToExercise, 3, 1, 10000.) + " | " +
  1248.             FormatUtil.FormatDouble (mapNF.get ("DISCOUNT MARGIN").value(), 3, 1, 10000.)
  1249.         );

  1250.         System.out.println (
  1251.             "\t|| E-Spread                => " +
  1252.             FormatUtil.FormatDouble (dblESpreadToExercise, 3, 1, 10000.) + " | " +
  1253.             FormatUtil.FormatDouble (mapNF.get ("E-Spread").value(), 3, 1, 10000.)
  1254.         );

  1255.         System.out.println (
  1256.             "\t|| I-Spread                => " +
  1257.             FormatUtil.FormatDouble (dblISpreadToExercise, 3, 1, 10000.) + " | " +
  1258.             FormatUtil.FormatDouble (mapNF.get ("I-Spread").value(), 3, 1, 10000.)
  1259.         );

  1260.         System.out.println (
  1261.             "\t|| J-Spread                => " +
  1262.             FormatUtil.FormatDouble (dblJSpreadToExercise, 3, 1, 10000.) + " | " +
  1263.             FormatUtil.FormatDouble (mapNF.get ("J-Spread").value(), 3, 1, 10000.)
  1264.         );

  1265.         System.out.println (
  1266.             "\t|| WAL To Worst            => " +
  1267.             FormatUtil.FormatDouble (dblWALToExercise, 1, 3, 1.) + " | " +
  1268.             FormatUtil.FormatDouble (mapNF.get ("WAL To Worst").value(), 1, 3, 1.)
  1269.         );

  1270.         System.out.println (
  1271.             "\t|| WAL                     => " +
  1272.             FormatUtil.FormatDouble (dblWALPrincipalOnlyToExercise, 1, 3, 1.) + " | " +
  1273.             FormatUtil.FormatDouble (mapNF.get ("WAL").value(), 1, 3, 1.)
  1274.         );

  1275.         System.out.println (
  1276.             "\t|| WAL2                    => " +
  1277.             FormatUtil.FormatDouble (dblWALLossOnlyToExercise, 1, 3, 1.) + " | " +
  1278.             FormatUtil.FormatDouble (mapNF.get ("WAL2").value(), 1, 3, 1.)
  1279.         );

  1280.         System.out.println (
  1281.             "\t|| WAL3                    => " +
  1282.             FormatUtil.FormatDouble (dblWALCouponOnlyToExercise, 1, 3, 1.) + " | " +
  1283.             FormatUtil.FormatDouble (mapNF.get ("WAL3").value(), 1, 3, 1.)
  1284.         );

  1285.         System.out.println (
  1286.             "\t|| WAL4                    => " +
  1287.             FormatUtil.FormatDouble (dblWALToExercise, 1, 3, 1.) + " | " +
  1288.             FormatUtil.FormatDouble (mapNF.get ("WAL4").value(), 1, 3, 1.)
  1289.         );

  1290.         System.out.println ("\t||------------------------------------------------||");

  1291.         for (Map.Entry<String, Double> meLIBORKRD : mapLIBORKRD.entrySet())
  1292.             System.out.println (
  1293.                 "\t|| LIBOR KRD " + meLIBORKRD.getKey() + " => " +
  1294.                 FormatUtil.FormatDouble (meLIBORKRD.getValue(), 1, 3, 10000.) + " | " +
  1295.                 FormatUtil.FormatDouble (nfmLIBORKRD.value().get (meLIBORKRD.getKey()), 1, 3, 10000.)
  1296.             );

  1297.         System.out.println ("\t||------------------------------------------------||");

  1298.         for (Map.Entry<String, Double> meLIBORKPRD : mapLIBORKPRD.entrySet())
  1299.             System.out.println (
  1300.                 "\t|| LIBOR KPRD " + meLIBORKPRD.getKey() + " => " +
  1301.                 FormatUtil.FormatDouble (meLIBORKPRD.getValue(), 1, 3, 10000.) + " | " +
  1302.                 FormatUtil.FormatDouble (nfmLIBORKPRD.value().get (meLIBORKPRD.getKey()), 1, 3, 10000.)
  1303.             );

  1304.         System.out.println ("\t||------------------------------------------------||");

  1305.         for (Map.Entry<String, Double> meGovvieKRD : mapGovvieKRD.entrySet())
  1306.             System.out.println (
  1307.                 "\t|| Govvie KRD " + meGovvieKRD.getKey() + " => " +
  1308.                 FormatUtil.FormatDouble (meGovvieKRD.getValue(), 1, 3, 10000.) + " | " +
  1309.                 FormatUtil.FormatDouble (nfmGovvieKRD.value().get (meGovvieKRD.getKey()), 1, 3, 10000.)
  1310.             );

  1311.         System.out.println ("\t||------------------------------------------------||");

  1312.         for (Map.Entry<String, Double> meGovvieKPRD : mapGovvieKPRD.entrySet())
  1313.             System.out.println (
  1314.                 "\t|| Govvie KPRD " + meGovvieKPRD.getKey() + " => " +
  1315.                 FormatUtil.FormatDouble (meGovvieKPRD.getValue(), 1, 3, 10000.) + " | " +
  1316.                 FormatUtil.FormatDouble (nfmGovvieKPRD.value().get (meGovvieKPRD.getKey()), 1, 3, 10000.)
  1317.             );

  1318.         System.out.println ("\t||------------------------------------------------||");

  1319.         for (Map.Entry<String, Double> meCreditKRD : mapCreditKRD.entrySet())
  1320.             System.out.println (
  1321.                 "\t|| Credit KRD " + meCreditKRD.getKey() + " => " +
  1322.                 FormatUtil.FormatDouble (meCreditKRD.getValue(), 1, 3, 10000.) + " | " +
  1323.                 FormatUtil.FormatDouble (nfmCreditKRD.value().get (meCreditKRD.getKey()), 1, 3, 10000.)
  1324.             );

  1325.         System.out.println ("\t||------------------------------------------------||");

  1326.         for (Map.Entry<String, Double> meCreditKPRD : mapCreditKPRD.entrySet())
  1327.             System.out.println (
  1328.                 "\t|| Credit KPRD " + meCreditKPRD.getKey() + " => " +
  1329.                 FormatUtil.FormatDouble (meCreditKPRD.getValue(), 1, 3, 10000.) + " | " +
  1330.                 FormatUtil.FormatDouble (nfmCreditKPRD.value().get (meCreditKPRD.getKey()), 1, 3, 10000.)
  1331.             );

  1332.         System.out.println ("\t||------------------------------------------------||");

  1333.         EnvManager.TerminateEnv();
  1334.     }
  1335. }