Reconciler_Call.java

  1. package org.drip.sample.bondmetrics;

  2. import java.util.*;

  3. import org.drip.analytics.cashflow.*;
  4. import org.drip.analytics.date.*;
  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_Call</i> demonstrates the Analytics Calculation/Reconciliation for the Callable Bond KWA6SA.
  94.  *  
  95.  * <br><br>
  96.  *  <ul>
  97.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ProductCore.md">Product Core Module</a></li>
  98.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FixedIncomeAnalyticsLibrary.md">Fixed Income Analytics</a></li>
  99.  *      <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>
  100.  *      <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>
  101.  *  </ul>
  102.  * <br><br>
  103.  *
  104.  * @author Lakshmi Krishnamurthy
  105.  */

  106. public class Reconciler_Call {

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  527.         double[] adblCreditQuote = new double[] {
  528.              60.,   //  6M
  529.              68.,   //  1Y
  530.              88.,   //  2Y
  531.             102.,   //  3Y
  532.             121.,   //  4Y
  533.             138.,   //  5Y
  534.             168.,   //  7Y
  535.             188.    // 10Y
  536.         };

  537.         double dblFX = 1.;
  538.         int iSettleLag = 3;
  539.         int iCouponFreq = 12;
  540.         String strName = "KWA6SA";
  541.         double dblCleanPrice = 1.;
  542.         double dblIssuePrice = 1.;
  543.         String strCurrency = "USD";
  544.         double dblSpreadBump = 20.;
  545.         double dblIssueAmount = 2.60e7;
  546.         String strTreasuryCode = "UST";
  547.         double dblFullFirstCoupon = 0.0425;
  548.         String strCouponDayCount = "30/360";
  549.         double dblSpreadDurationMultiplier = 5.;

  550.         JulianDate dtEffective = DateUtil.CreateFromYMD (
  551.             2015,
  552.             9,
  553.             18
  554.         );

  555.         JulianDate dtMaturity = DateUtil.CreateFromYMD (
  556.             2025,
  557.             10,
  558.             1
  559.         );

  560.         int iSpotDate = dtSpot.julian();

  561.         JulianDate dtSettle = dtSpot.addBusDays (
  562.             iSettleLag,
  563.             strCurrency
  564.         );

  565.         ValuationParams valParams = new ValuationParams (
  566.             dtSpot,
  567.             dtSettle,
  568.             strCurrency
  569.         );

  570.         MergedDiscountForwardCurve mdfcBase = FundingCurve (
  571.             dtSpot,
  572.             strCurrency,
  573.             0.
  574.         );

  575.         double dblUSD3MLIBOR = mdfcBase.libor (
  576.             dtSpot,
  577.             (12 / iCouponFreq) + "M"
  578.         );

  579.         double dblResetRate = dblUSD3MLIBOR;
  580.         String strRateIndex = strCurrency + "-" + (12 / iCouponFreq) + "M";

  581.         BondComponent bond = BondBuilder.CreateSimpleFloater (
  582.             strName,
  583.             strCurrency,
  584.             strRateIndex,
  585.             strName,
  586.             dblFullFirstCoupon - dblUSD3MLIBOR,
  587.             iCouponFreq,
  588.             "30/360",
  589.             dtEffective,
  590.             dtMaturity,
  591.             null,
  592.             null
  593.         );

  594.         CompositeFloatingPeriod cfp = (CompositeFloatingPeriod) bond.stream().containingPeriod (iSpotDate);

  595.         int iResetDate = ((ComposableUnitFloatingPeriod) (cfp.periods().get (0))).referenceIndexPeriod().fixingDate();

  596.         SetEOS (
  597.             bond,
  598.             new EmbeddedOptionSchedule (
  599.                 new int[] {
  600.                     DateUtil.CreateFromYMD (2019, 02, 14).julian(),
  601.                 },
  602.                 new double[] {
  603.                     1.0000,
  604.                 },
  605.                 false,
  606.                 15,
  607.                 false,
  608.                 Double.NaN,
  609.                 "",
  610.                 Double.NaN
  611.             ),
  612.             null
  613.         );

  614.         GovvieCurve gc = GovvieCurve (
  615.             dtSpot,
  616.             strTreasuryCode,
  617.             adblGovvieYield
  618.         );

  619.         CurveSurfaceQuoteContainer csqcBase = MarketParamsBuilder.Create (
  620.             mdfcBase,
  621.             gc,
  622.             null,
  623.             null,
  624.             null,
  625.             null,
  626.             null
  627.         );

  628.         csqcBase.setFixing (
  629.             iResetDate,
  630.             bond.floaterSetting().fri(),
  631.             dblResetRate
  632.         );

  633.         CurveSurfaceQuoteContainer csqcCreditBase = MarketParamsBuilder.Create (
  634.             mdfcBase,
  635.             gc,
  636.             CreditCurve (
  637.                 dtSpot,
  638.                 strName,
  639.                 mdfcBase,
  640.                 astrCreditTenor,
  641.                 0.
  642.             ),
  643.             null,
  644.             null,
  645.             null,
  646.             null
  647.         );

  648.         csqcCreditBase.setFixing (
  649.             iResetDate,
  650.             bond.floaterSetting().fri(),
  651.             dblResetRate
  652.         );

  653.         CurveSurfaceQuoteContainer csqcBumped01Up = MarketParamsBuilder.Create (
  654.             FundingCurve (
  655.                 dtSpot,
  656.                 strCurrency,
  657.                 0.0001
  658.             ),
  659.             gc,
  660.             null,
  661.             null,
  662.             null,
  663.             null,
  664.             null
  665.         );

  666.         csqcBumped01Up.setFixing (
  667.             iResetDate,
  668.             bond.floaterSetting().fri(),
  669.             dblResetRate + 0.0001
  670.         );

  671.         CurveSurfaceQuoteContainer csqcCreditBumped01Up = MarketParamsBuilder.Create (
  672.             mdfcBase,
  673.             gc,
  674.             CreditCurve (
  675.                 dtSpot,
  676.                 strName,
  677.                 mdfcBase,
  678.                 astrCreditTenor,
  679.                 1.
  680.             ),
  681.             null,
  682.             null,
  683.             null,
  684.             null
  685.         );

  686.         csqcCreditBumped01Up.setFixing (
  687.             iResetDate,
  688.             bond.floaterSetting().fri(),
  689.             dblResetRate
  690.         );

  691.         double dblAccrued = bond.accrued (
  692.             dtSettle.julian(),
  693.             csqcBase
  694.         );

  695.         WorkoutInfo wi = bond.exerciseYieldFromPrice (
  696.             valParams,
  697.             csqcBase,
  698.             null,
  699.             dblCleanPrice
  700.         );

  701.         double dblBondBasisToMaturity = bond.bondBasisFromPrice (
  702.             valParams,
  703.             csqcBase,
  704.             null,
  705.             dblCleanPrice
  706.         );

  707.         double dblModifiedDurationToMaturity = (
  708.             dblCleanPrice - bond.priceFromBondBasis (
  709.                 valParams,
  710.                 csqcBumped01Up,
  711.                 null,
  712.                 dblBondBasisToMaturity
  713.             )
  714.         ) / dblCleanPrice;

  715.         double dblYieldToMaturity = bond.yieldFromPrice (
  716.             valParams,
  717.             csqcBase,
  718.             null,
  719.             dblCleanPrice
  720.         );

  721.         double dblBondEquivalentYieldToMaturity = bond.yieldFromPrice (
  722.             valParams,
  723.             csqcBase,
  724.             ValuationCustomizationParams.BondEquivalent (strCurrency),
  725.             dblCleanPrice
  726.         );

  727.         double dblFlatForwardRateYieldToMaturity = bond.yieldFromPrice (
  728.             valParams,
  729.             csqcBase,
  730.             new ValuationCustomizationParams (
  731.                 strCouponDayCount,
  732.                 iCouponFreq,
  733.                 false,
  734.                 null,
  735.                 strCurrency,
  736.                 false,
  737.                 true
  738.             ),
  739.             dblCleanPrice
  740.         );

  741.         double dblYieldToExercise = bond.yieldFromPrice (
  742.             valParams,
  743.             csqcBase,
  744.             null,
  745.             wi.date(),
  746.             wi.factor(),
  747.             dblCleanPrice
  748.         );

  749.         double dblYieldToNextCall = bond.yieldFromPrice (
  750.             valParams,
  751.             csqcBase,
  752.             null,
  753.             NextCallDate (
  754.                 bond,
  755.                 iSpotDate
  756.             ),
  757.             NextCallFactor (
  758.                 bond,
  759.                 iSpotDate
  760.             ),
  761.             dblCleanPrice
  762.         );

  763.         double dblNominalYield = bond.yieldFromPrice (
  764.             valParams,
  765.             csqcBase,
  766.             null,
  767.             dblIssuePrice
  768.         );

  769.         double dblOASToMaturity = bond.oasFromPrice (
  770.             valParams,
  771.             csqcBase,
  772.             null,
  773.             dblCleanPrice
  774.         );

  775.         double dblOASToExercise = bond.oasFromPrice (
  776.             valParams,
  777.             csqcBase,
  778.             null,
  779.             wi.date(),
  780.             wi.factor(),
  781.             dblCleanPrice
  782.         );

  783.         double dblZSpreadToMaturity = bond.discountMarginFromPrice (
  784.             valParams,
  785.             csqcBase,
  786.             null,
  787.             dblCleanPrice
  788.         );

  789.         double dblZSpreadToExercise = bond.discountMarginFromPrice (
  790.             valParams,
  791.             csqcBase,
  792.             null,
  793.             wi.date(),
  794.             wi.factor(),
  795.             dblCleanPrice
  796.         );

  797.         double dblParZSpreadToExercise = bond.discountMarginFromPrice (
  798.             valParams,
  799.             csqcBase,
  800.             null,
  801.             wi.date(),
  802.             wi.factor(),
  803.             1.
  804.         );

  805.         double dblParOASToExercise = bond.oasFromPrice (
  806.             valParams,
  807.             csqcBase,
  808.             null,
  809.             wi.date(),
  810.             wi.factor(),
  811.             1.
  812.         );

  813.         double dblMacaulayDurationToMaturity = bond.macaulayDurationFromPrice (
  814.             valParams,
  815.             csqcBase,
  816.             null,
  817.             dblCleanPrice
  818.         );

  819.         double dblBondBasisToExercise = bond.bondBasisFromPrice (
  820.             valParams,
  821.             csqcBase,
  822.             null,
  823.             wi.date(),
  824.             wi.factor(),
  825.             dblCleanPrice
  826.         );

  827.         double dblModifiedDurationToWorst = (
  828.             dblCleanPrice - bond.priceFromBondBasis (
  829.                 valParams,
  830.                 csqcBumped01Up,
  831.                 null,
  832.                 wi.date(),
  833.                 wi.factor(),
  834.                 dblBondBasisToExercise
  835.             )
  836.         ) / dblCleanPrice;

  837.         double dblDV01 = 0.5 * (
  838.             bond.priceFromYield (
  839.                 valParams,
  840.                 csqcBase,
  841.                 null,
  842.                 wi.date(),
  843.                 wi.factor(),
  844.                 dblYieldToExercise - 0.0001 * dblSpreadBump
  845.             ) -
  846.             bond.priceFromYield (
  847.                 valParams,
  848.                 csqcBase,
  849.                 null,
  850.                 wi.date(),
  851.                 wi.factor(),
  852.                 dblYieldToExercise + 0.0001 * dblSpreadBump
  853.             )
  854.         ) / dblSpreadBump;

  855.         double dblEffectiveDuration = dblDV01 / dblCleanPrice;

  856.         double dblCreditBasisToExercise = bond.creditBasisFromPrice (
  857.             valParams,
  858.             csqcCreditBase,
  859.             null,
  860.             wi.date(),
  861.             wi.factor(),
  862.             dblCleanPrice
  863.         );

  864.         double dblParCreditBasisToExercise = bond.creditBasisFromPrice (
  865.             valParams,
  866.             csqcCreditBase,
  867.             null,
  868.             wi.date(),
  869.             wi.factor(),
  870.             1.
  871.         );

  872.         double dblEffectiveDurationAdj = 0.5 * (
  873.             bond.priceFromCreditBasis (
  874.                 valParams,
  875.                 csqcCreditBase,
  876.                 null,
  877.                 wi.date(),
  878.                 wi.factor(),
  879.                 dblCreditBasisToExercise - dblSpreadBump
  880.             ) -
  881.             bond.priceFromCreditBasis (
  882.                 valParams,
  883.                 csqcCreditBase,
  884.                 null,
  885.                 wi.date(),
  886.                 wi.factor(),
  887.                 dblCreditBasisToExercise + dblSpreadBump
  888.             )
  889.         ) / dblCleanPrice / dblSpreadBump;

  890.         double dblSpreadDuration = dblSpreadDurationMultiplier * (dblCleanPrice -
  891.             bond.priceFromDiscountMargin (
  892.                 valParams,
  893.                 csqcBase,
  894.                 null,
  895.                 wi.date(),
  896.                 wi.factor(),
  897.                 dblZSpreadToExercise + 0.0001 * dblSpreadBump
  898.             )
  899.         ) / dblCleanPrice;

  900.         double dblCV01 = dblCleanPrice - bond.priceFromCreditBasis (
  901.             valParams,
  902.             csqcCreditBumped01Up,
  903.             null,
  904.             wi.date(),
  905.             wi.factor(),
  906.             dblCreditBasisToExercise
  907.         );

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

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

  910.         Map<String, MergedDiscountForwardCurve> mapFundingCurve = TenorBumpedFundingCurve (
  911.             dtSpot,
  912.             strCurrency,
  913.             0.0001
  914.         );

  915.         for (Map.Entry<String, MergedDiscountForwardCurve> meFunding : mapFundingCurve.entrySet()) {
  916.             CurveSurfaceQuoteContainer csqcFunding = MarketParamsBuilder.Create (
  917.                 meFunding.getValue(),
  918.                 gc,
  919.                 null,
  920.                 null,
  921.                 null,
  922.                 null,
  923.                 null
  924.             );

  925.             csqcFunding.setFixing (
  926.                 iResetDate,
  927.                 bond.floaterSetting().fri(),
  928.                 dblResetRate + 0.0001
  929.             );

  930.             mapLIBORKRD.put (
  931.                 meFunding.getKey(),
  932.                 (dblCleanPrice - bond.priceFromDiscountMargin (
  933.                     valParams,
  934.                     csqcFunding,
  935.                     null,
  936.                     wi.date(),
  937.                     wi.factor(),
  938.                     dblZSpreadToExercise
  939.                 )) / dblCleanPrice
  940.             );

  941.             mapLIBORKPRD.put (
  942.                 meFunding.getKey(),
  943.                 1. - bond.priceFromDiscountMargin (
  944.                     valParams,
  945.                     csqcFunding,
  946.                     null,
  947.                     wi.date(),
  948.                     wi.factor(),
  949.                     dblParZSpreadToExercise
  950.                 )
  951.             );
  952.         }

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

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

  955.         Map<String, GovvieCurve> mapGovvieCurve = TenorBumpedGovvieCurve (
  956.             dtSpot,
  957.             strTreasuryCode,
  958.             0.0001,
  959.             adblGovvieYield
  960.         );

  961.         for (Map.Entry<String, GovvieCurve> meGovvie : mapGovvieCurve.entrySet()) {
  962.             CurveSurfaceQuoteContainer csqcGovvie = MarketParamsBuilder.Create (
  963.                 mdfcBase,
  964.                 meGovvie.getValue(),
  965.                 null,
  966.                 null,
  967.                 null,
  968.                 null,
  969.                 null
  970.             );

  971.             csqcGovvie.setFixing (
  972.                 iResetDate,
  973.                 bond.floaterSetting().fri(),
  974.                 dblResetRate
  975.             );

  976.             mapGovvieKRD.put (
  977.                 meGovvie.getKey(),
  978.                 (dblCleanPrice - bond.priceFromOAS (
  979.                     valParams,
  980.                     csqcGovvie,
  981.                     null,
  982.                     wi.date(),
  983.                     wi.factor(),
  984.                     dblOASToExercise
  985.                 )) / dblCleanPrice
  986.             );

  987.             mapGovvieKPRD.put (
  988.                 meGovvie.getKey(),
  989.                 1. - bond.priceFromOAS (
  990.                     valParams,
  991.                     csqcGovvie,
  992.                     null,
  993.                     wi.date(),
  994.                     wi.factor(),
  995.                     dblParOASToExercise
  996.                 )
  997.             );
  998.         }

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

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

  1001.         Map<String, CreditCurve> mapCreditCurve = TenorBumpedCreditCurve (
  1002.             dtSpot,
  1003.             strName,
  1004.             mdfcBase,
  1005.             1.
  1006.         );

  1007.         for (Map.Entry<String, CreditCurve> meCredit : mapCreditCurve.entrySet()) {
  1008.             CurveSurfaceQuoteContainer csqcCredit = MarketParamsBuilder.Create (
  1009.                 mdfcBase,
  1010.                 gc,
  1011.                 meCredit.getValue(),
  1012.                 null,
  1013.                 null,
  1014.                 null,
  1015.                 null
  1016.             );

  1017.             csqcCredit.setFixing (
  1018.                 iResetDate,
  1019.                 bond.floaterSetting().fri(),
  1020.                 dblResetRate
  1021.             );

  1022.             mapCreditKRD.put (
  1023.                 meCredit.getKey(),
  1024.                 (dblCleanPrice - bond.priceFromCreditBasis (
  1025.                     valParams,
  1026.                     csqcCredit,
  1027.                     null,
  1028.                     wi.date(),
  1029.                     wi.factor(),
  1030.                     dblCreditBasisToExercise
  1031.                 )) / dblCleanPrice
  1032.             );

  1033.             mapCreditKPRD.put (
  1034.                 meCredit.getKey(),
  1035.                 1. - bond.priceFromCreditBasis (
  1036.                     valParams,
  1037.                     csqcCredit,
  1038.                     null,
  1039.                     wi.date(),
  1040.                     wi.factor(),
  1041.                     dblParCreditBasisToExercise
  1042.                 )
  1043.             );
  1044.         }

  1045.         double dblConvexityToExercise = bond.convexityFromPrice (
  1046.             valParams,
  1047.             csqcBase,
  1048.             null,
  1049.             wi.date(),
  1050.             wi.factor(),
  1051.             dblCleanPrice
  1052.         );

  1053.         double dblDiscountMarginToExercise = dblYieldToExercise - mdfcBase.libor (
  1054.             dtSpot,
  1055.             "1M"
  1056.         );

  1057.         double dblESpreadToExercise = bond.discountMarginFromPrice (
  1058.             valParams,
  1059.             MarketParamsBuilder.Create (
  1060.                 LatentMarketStateBuilder.SmoothFundingCurve (
  1061.                     dtSpot,
  1062.                     strCurrency,
  1063.                     astrDepositTenor,
  1064.                     adblDepositQuote,
  1065.                     "ForwardRate",
  1066.                     adblFuturesQuote,
  1067.                     "ForwardRate",
  1068.                     null,
  1069.                     null,
  1070.                     "SwapRate"
  1071.                 ),
  1072.                 gc,
  1073.                 null,
  1074.                 null,
  1075.                 null,
  1076.                 null,
  1077.                 null
  1078.             ),
  1079.             null,
  1080.             wi.date(),
  1081.             wi.factor(),
  1082.             dblCleanPrice
  1083.         );

  1084.         double dblISpreadToExercise = bond.iSpreadFromPrice (
  1085.             valParams,
  1086.             csqcBase,
  1087.             null,
  1088.             wi.date(),
  1089.             wi.factor(),
  1090.             dblCleanPrice
  1091.         );

  1092.         double dblJSpreadToExercise = bond.jSpreadFromPrice (
  1093.             valParams,
  1094.             csqcBase,
  1095.             null,
  1096.             wi.date(),
  1097.             wi.factor(),
  1098.             dblCleanPrice
  1099.         );

  1100.         double dblWALToExercise = bond.weightedAverageLife (
  1101.             valParams,
  1102.             csqcBase,
  1103.             wi.date(),
  1104.             wi.factor()
  1105.         );

  1106.         double dblWALPrincipalOnlyToExercise = bond.weightedAverageLifePrincipalOnly (
  1107.             valParams,
  1108.             csqcBase,
  1109.             wi.date(),
  1110.             wi.factor()
  1111.         );

  1112.         double dblWALLossOnlyToExercise = bond.weightedAverageLifeLossOnly (
  1113.             valParams,
  1114.             csqcCreditBase,
  1115.             wi.date(),
  1116.             wi.factor()
  1117.         );

  1118.         double dblWALCouponOnlyToExercise = bond.weightedAverageLifeCouponOnly (
  1119.             valParams,
  1120.             csqcBase,
  1121.             wi.date(),
  1122.             wi.factor()
  1123.         );

  1124.         BondReplicator ar = BondReplicator.CorporateSenior (
  1125.             dblCleanPrice,
  1126.             dblIssuePrice,
  1127.             dblIssueAmount,
  1128.             dtSpot,
  1129.             astrDepositTenor,
  1130.             adblDepositQuote,
  1131.             adblFuturesQuote,
  1132.             astrFixFloatTenor,
  1133.             adblFixFloatQuote,
  1134.             dblSpreadBump,
  1135.             dblSpreadDurationMultiplier,
  1136.             strTreasuryCode,
  1137.             astrGovvieTenor,
  1138.             adblGovvieYield,
  1139.             astrCreditTenor,
  1140.             adblCreditQuote,
  1141.             dblFX,
  1142.             dblUSD3MLIBOR,
  1143.             iSettleLag,
  1144.             bond
  1145.         );

  1146.         BondReplicationRun arr = ar.generateRun();

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

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

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

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

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

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

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

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

  1155.         System.out.println();

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

  1157.         System.out.println (
  1158.             "\t|| ID                      =>  " +
  1159.             strName + "-" + strCurrency
  1160.         );

  1161.         System.out.println (
  1162.             "\t|| Price                   => " +
  1163.             FormatUtil.FormatDouble (dblCleanPrice, 3, 3, 100.) + " | " +
  1164.             FormatUtil.FormatDouble (mapNF.get ("Price").value(), 3, 3, 100.)
  1165.         );

  1166.         System.out.println (
  1167.             "\t|| Market Value            => " +
  1168.             FormatUtil.FormatDouble (dblCleanPrice * dblIssueAmount, 7, 2, 1.) + " | " +
  1169.             FormatUtil.FormatDouble (mapNF.get ("Market Value").value(), 7, 2, 1.)
  1170.         );

  1171.         System.out.println (
  1172.             "\t|| Accrued                 => " +
  1173.             FormatUtil.FormatDouble (dblAccrued, 1, 4, 1.) + " | " +
  1174.             FormatUtil.FormatDouble (mapNF.get ("Accrued").value(), 1, 4, 1.)
  1175.         );

  1176.         System.out.println (
  1177.             "\t|| Accrued                 => " +
  1178.             FormatUtil.FormatDouble (dblAccrued * dblIssueAmount, 5, 2, 1.) + " | " +
  1179.             FormatUtil.FormatDouble (mapNF.get ("Accrued$").value(), 5, 2, 1.)
  1180.         );

  1181.         System.out.println (
  1182.             "\t|| Accrued Interest Factor => " +
  1183.             FormatUtil.FormatDouble (dblAccrued * dblFX, 1, 4, 1.) + " | " +
  1184.             FormatUtil.FormatDouble (mapNF.get ("Accrued Interest Factor").value(), 1, 4, 1.)
  1185.         );

  1186.         System.out.println (
  1187.             "\t|| Yield To Maturity       => " +
  1188.             FormatUtil.FormatDouble (dblYieldToMaturity, 1, 2, 100.) + "% | " +
  1189.             FormatUtil.FormatDouble (mapNF.get ("Yield To Maturity").value(), 1, 2, 100.) + "%"
  1190.         );

  1191.         System.out.println (
  1192.             "\t|| Yield To Maturity CBE   => " +
  1193.             FormatUtil.FormatDouble (dblBondEquivalentYieldToMaturity, 1, 2, 100.) + "% | " +
  1194.             FormatUtil.FormatDouble (mapNF.get ("Yield To Maturity CBE").value(), 1, 2, 100.) + "%"
  1195.         );

  1196.         System.out.println (
  1197.             "\t|| YTM fwdCpn              => " +
  1198.             FormatUtil.FormatDouble (dblFlatForwardRateYieldToMaturity, 1, 2, 100.) + "% | " +
  1199.             FormatUtil.FormatDouble (mapNF.get ("YTM fwdCpn").value(), 1, 2, 100.) + "%"
  1200.         );

  1201.         System.out.println (
  1202.             "\t|| Yield To Worst          => " +
  1203.             FormatUtil.FormatDouble (dblYieldToExercise, 1, 2, 100.) + "% | " +
  1204.             FormatUtil.FormatDouble (mapNF.get ("Yield To Worst").value(), 1, 2, 100.) + "%"
  1205.         );

  1206.         System.out.println (
  1207.             "\t|| YIELD TO CALL           => " +
  1208.             FormatUtil.FormatDouble (dblYieldToNextCall, 1, 2, 100.) + "% | " +
  1209.             FormatUtil.FormatDouble (mapNF.get ("YIELD TO CALL").value(), 1, 2, 100.) + "%"
  1210.         );

  1211.         System.out.println (
  1212.             "\t|| Nominal Yield           => " +
  1213.             FormatUtil.FormatDouble (dblNominalYield, 1, 2, 100.) + "% | " +
  1214.             FormatUtil.FormatDouble (mapNF.get ("Nominal Yield").value(), 1, 2, 100.) + "%"
  1215.         );

  1216.         System.out.println (
  1217.             "\t|| Z_Spread                => " +
  1218.             FormatUtil.FormatDouble (dblOASToMaturity, 3, 1, 10000.) + " | " +
  1219.             FormatUtil.FormatDouble (mapNF.get ("Z_Spread").value(), 3, 1, 10000.)
  1220.         );

  1221.         System.out.println (
  1222.             "\t|| Z_Vol_OAS               => " +
  1223.             FormatUtil.FormatDouble (dblZSpreadToMaturity, 3, 1, 10000.) + " | " +
  1224.             FormatUtil.FormatDouble (mapNF.get ("Z_Vol_OAS").value(), 3, 1, 10000.)
  1225.         );

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

  1231.         System.out.println (
  1232.             "\t|| TSY OAS                 => " +
  1233.             FormatUtil.FormatDouble (dblOASToExercise, 3, 1, 10000.) + " | " +
  1234.             FormatUtil.FormatDouble (mapNF.get ("TSY OAS").value(), 3, 1, 10000.)
  1235.         );

  1236.         System.out.println (
  1237.             "\t|| MOD DUR                 => " +
  1238.             FormatUtil.FormatDouble (dblModifiedDurationToMaturity, 1, 3, 10000.) + " | " +
  1239.             FormatUtil.FormatDouble (mapNF.get ("MOD DUR").value(), 1, 3, 10000.)
  1240.         );

  1241.         System.out.println (
  1242.             "\t|| MACAULAY DURATION       => " +
  1243.             FormatUtil.FormatDouble (dblMacaulayDurationToMaturity, 1, 3, 1.) + " | " +
  1244.             FormatUtil.FormatDouble (mapNF.get ("MACAULAY DURATION").value(), 1, 3, 1.)
  1245.         );

  1246.         System.out.println (
  1247.             "\t|| MOD DUR TO WORST        => " +
  1248.             FormatUtil.FormatDouble (dblModifiedDurationToWorst, 1, 3, 10000.) + " | " +
  1249.             FormatUtil.FormatDouble (mapNF.get ("MOD DUR TO WORST").value(), 1, 3, 10000.)
  1250.         );

  1251.         System.out.println (
  1252.             "\t|| EFFECTIVE DURATION      => " +
  1253.             FormatUtil.FormatDouble (dblEffectiveDuration, 1, 3, 10000.) + " | " +
  1254.             FormatUtil.FormatDouble (mapNF.get ("EFFECTIVE DURATION").value(), 1, 3, 10000.)
  1255.         );

  1256.         System.out.println (
  1257.             "\t|| EFFECTIVE DURATION ADJ  => " +
  1258.             FormatUtil.FormatDouble (dblEffectiveDurationAdj, 1, 3, 10000.) + " | " +
  1259.             FormatUtil.FormatDouble (mapNF.get ("EFFECTIVE DURATION ADJ").value(), 1, 3, 10000.)
  1260.         );

  1261.         System.out.println (
  1262.             "\t|| OAD MULT                => " +
  1263.             FormatUtil.FormatDouble (dblEffectiveDurationAdj / dblEffectiveDuration, 1, 3, 1.) + " | " +
  1264.             FormatUtil.FormatDouble (mapNF.get ("OAD MULT").value(), 1, 3, 1.)
  1265.         );

  1266.         System.out.println (
  1267.             "\t|| Spread Dur              => " +
  1268.             FormatUtil.FormatDouble (dblSpreadDuration, 1, 3, 100.) + " | " +
  1269.             FormatUtil.FormatDouble (mapNF.get ("Spread Dur").value(), 1, 3, 100.)
  1270.         );

  1271.         System.out.println (
  1272.             "\t|| Spread Dur              => " +
  1273.             FormatUtil.FormatDouble (dblSpreadDuration * dblIssueAmount, 1, 3, 1.) + " | " +
  1274.             FormatUtil.FormatDouble (mapNF.get ("Spread Dur $").value(), 1, 3, 1.)
  1275.         );

  1276.         System.out.println (
  1277.             "\t|| DV01                    => " +
  1278.             FormatUtil.FormatDouble (dblDV01, 1, 3, 10000.) + " | " +
  1279.             FormatUtil.FormatDouble (mapNF.get ("DV01").value(), 1, 3, 10000.)
  1280.         );

  1281.         System.out.println (
  1282.             "\t|| CV01                    => " +
  1283.             FormatUtil.FormatDouble (dblCV01, 1, 3, 10000.) + " | " +
  1284.             FormatUtil.FormatDouble (mapNF.get ("CV01").value(), 1, 3, 10000.)
  1285.         );

  1286.         System.out.println (
  1287.             "\t|| Convexity               => " +
  1288.             FormatUtil.FormatDouble (dblConvexityToExercise, 1, 3, 1000000.) + " | " +
  1289.             FormatUtil.FormatDouble (mapNF.get ("Convexity").value(), 1, 3, 1000000.)
  1290.         );

  1291.         System.out.println (
  1292.             "\t|| Modified Convexity      => " +
  1293.             FormatUtil.FormatDouble (dblConvexityToExercise, 1, 3, 1000000.) + " | " +
  1294.             FormatUtil.FormatDouble (mapNF.get ("Modified Convexity").value(), 1, 3, 1000000.)
  1295.         );

  1296.         System.out.println (
  1297.             "\t|| DISCOUNT MARGIN         => " +
  1298.             FormatUtil.FormatDouble (dblDiscountMarginToExercise, 3, 1, 10000.) + " | " +
  1299.             FormatUtil.FormatDouble (mapNF.get ("DISCOUNT MARGIN").value(), 3, 1, 10000.)
  1300.         );

  1301.         System.out.println (
  1302.             "\t|| E-Spread                => " +
  1303.             FormatUtil.FormatDouble (dblESpreadToExercise, 3, 1, 10000.) + " | " +
  1304.             FormatUtil.FormatDouble (mapNF.get ("E-Spread").value(), 3, 1, 10000.)
  1305.         );

  1306.         System.out.println (
  1307.             "\t|| I-Spread                => " +
  1308.             FormatUtil.FormatDouble (dblISpreadToExercise, 3, 1, 10000.) + " | " +
  1309.             FormatUtil.FormatDouble (mapNF.get ("I-Spread").value(), 3, 1, 10000.)
  1310.         );

  1311.         System.out.println (
  1312.             "\t|| J-Spread                => " +
  1313.             FormatUtil.FormatDouble (dblJSpreadToExercise, 3, 1, 10000.) + " | " +
  1314.             FormatUtil.FormatDouble (mapNF.get ("J-Spread").value(), 3, 1, 10000.)
  1315.         );

  1316.         System.out.println (
  1317.             "\t|| WAL To Worst            => " +
  1318.             FormatUtil.FormatDouble (dblWALToExercise, 1, 3, 1.) + " | " +
  1319.             FormatUtil.FormatDouble (mapNF.get ("WAL To Worst").value(), 1, 3, 1.)
  1320.         );

  1321.         System.out.println (
  1322.             "\t|| WAL                     => " +
  1323.             FormatUtil.FormatDouble (dblWALPrincipalOnlyToExercise, 1, 3, 1.) + " | " +
  1324.             FormatUtil.FormatDouble (mapNF.get ("WAL").value(), 1, 3, 1.)
  1325.         );

  1326.         System.out.println (
  1327.             "\t|| WAL2                    => " +
  1328.             FormatUtil.FormatDouble (dblWALLossOnlyToExercise, 1, 3, 1.) + " | " +
  1329.             FormatUtil.FormatDouble (mapNF.get ("WAL2").value(), 1, 3, 1.)
  1330.         );

  1331.         System.out.println (
  1332.             "\t|| WAL3                    => " +
  1333.             FormatUtil.FormatDouble (dblWALCouponOnlyToExercise, 1, 3, 1.) + " | " +
  1334.             FormatUtil.FormatDouble (mapNF.get ("WAL3").value(), 1, 3, 1.)
  1335.         );

  1336.         System.out.println (
  1337.             "\t|| WAL4                    => " +
  1338.             FormatUtil.FormatDouble (dblWALToExercise, 1, 3, 1.) + " | " +
  1339.             FormatUtil.FormatDouble (mapNF.get ("WAL4").value(), 1, 3, 1.)
  1340.         );

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

  1342.         for (Map.Entry<String, Double> meLIBORKRD : mapLIBORKRD.entrySet())
  1343.             System.out.println (
  1344.                 "\t|| LIBOR KRD " + meLIBORKRD.getKey() + " => " +
  1345.                 FormatUtil.FormatDouble (meLIBORKRD.getValue(), 1, 3, 10000.) + " | " +
  1346.                 FormatUtil.FormatDouble (nfmLIBORKRD.value().get (meLIBORKRD.getKey()), 1, 3, 10000.)
  1347.             );

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

  1349.         for (Map.Entry<String, Double> meLIBORKPRD : mapLIBORKPRD.entrySet())
  1350.             System.out.println (
  1351.                 "\t|| LIBOR KPRD " + meLIBORKPRD.getKey() + " => " +
  1352.                 FormatUtil.FormatDouble (meLIBORKPRD.getValue(), 1, 3, 10000.) + " | " +
  1353.                 FormatUtil.FormatDouble (nfmLIBORKPRD.value().get (meLIBORKPRD.getKey()), 1, 3, 10000.)
  1354.             );

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

  1356.         for (Map.Entry<String, Double> meGovvieKRD : mapGovvieKRD.entrySet())
  1357.             System.out.println (
  1358.                 "\t|| Govvie KRD " + meGovvieKRD.getKey() + " => " +
  1359.                 FormatUtil.FormatDouble (meGovvieKRD.getValue(), 1, 3, 10000.) + " | " +
  1360.                 FormatUtil.FormatDouble (nfmGovvieKRD.value().get (meGovvieKRD.getKey()), 1, 3, 10000.)
  1361.             );

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

  1363.         for (Map.Entry<String, Double> meGovvieKPRD : mapGovvieKPRD.entrySet())
  1364.             System.out.println (
  1365.                 "\t|| Govvie KPRD " + meGovvieKPRD.getKey() + " => " +
  1366.                 FormatUtil.FormatDouble (meGovvieKPRD.getValue(), 1, 3, 10000.) + " | " +
  1367.                 FormatUtil.FormatDouble (nfmGovvieKPRD.value().get (meGovvieKPRD.getKey()), 1, 3, 10000.)
  1368.             );

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

  1370.         for (Map.Entry<String, Double> meCreditKRD : mapCreditKRD.entrySet())
  1371.             System.out.println (
  1372.                 "\t|| Credit KRD " + meCreditKRD.getKey() + " => " +
  1373.                 FormatUtil.FormatDouble (meCreditKRD.getValue(), 1, 3, 10000.) + " | " +
  1374.                 FormatUtil.FormatDouble (nfmCreditKRD.value().get (meCreditKRD.getKey()), 1, 3, 10000.)
  1375.             );

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

  1377.         for (Map.Entry<String, Double> meCreditKPRD : mapCreditKPRD.entrySet())
  1378.             System.out.println (
  1379.                 "\t|| Credit KPRD " + meCreditKPRD.getKey() + " => " +
  1380.                 FormatUtil.FormatDouble (meCreditKPRD.getValue(), 1, 3, 10000.) + " | " +
  1381.                 FormatUtil.FormatDouble (nfmCreditKPRD.value().get (meCreditKPRD.getKey()), 1, 3, 10000.)
  1382.             );

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

  1384.         EnvManager.TerminateEnv();
  1385.     }
  1386. }