ZeroThresholdCollateralGroupCorrelated.java

  1. package org.drip.sample.xva;

  2. import org.drip.analytics.date.*;
  3. import org.drip.exposure.evolver.LatentStateVertexContainer;
  4. import org.drip.exposure.mpor.CollateralAmountEstimator;
  5. import org.drip.exposure.universe.*;
  6. import org.drip.measure.bridge.BrokenDateInterpolatorLinearT;
  7. import org.drip.measure.discrete.SequenceGenerator;
  8. import org.drip.measure.dynamics.*;
  9. import org.drip.measure.process.DiffusionEvolver;
  10. import org.drip.measure.realization.*;
  11. import org.drip.numerical.common.FormatUtil;
  12. import org.drip.numerical.linearalgebra.Matrix;
  13. import org.drip.service.env.EnvManager;
  14. import org.drip.state.identifier.OTCFixFloatLabel;
  15. import org.drip.xva.gross.*;
  16. import org.drip.xva.netting.CollateralGroupPath;
  17. import org.drip.xva.proto.*;
  18. import org.drip.xva.settings.*;
  19. import org.drip.xva.strategy.*;
  20. import org.drip.xva.vertex.AlbaneseAndersen;

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

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

  65. /**
  66.  * ZeroThresholdCollateralGroupCorrelated illustrates the Sample Run of a Single Partially Collateralized
  67.  *  Collateral Group under Zero Bank/Counter Party Threshold with several Fix-Float Swaps, and with built in
  68.  *  Factor Correlations across the Numeraires. The References are:
  69.  *  
  70.  *  - Burgard, C., and M. Kjaer (2014): PDE Representations of Derivatives with Bilateral Counter-party Risk
  71.  *      and Funding Costs, Journal of Credit Risk, 7 (3) 1-19.
  72.  *  
  73.  *  - Burgard, C., and M. Kjaer (2014): In the Balance, Risk, 24 (11) 72-75.
  74.  *  
  75.  *  - Gregory, J. (2009): Being Two-faced over Counter-party Credit Risk, Risk 20 (2) 86-90.
  76.  *  
  77.  *  - Li, B., and Y. Tang (2007): Quantitative Analysis, Derivatives Modeling, and Trading Strategies in the
  78.  *      Presence of Counter-party Credit Risk for the Fixed Income Market, World Scientific Publishing,
  79.  *      Singapore.
  80.  *
  81.  *  - Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing, Risk
  82.  *      21 (2) 97-102.
  83.  *
  84.  * @author Lakshmi Krishnamurthy
  85.  */

  86. public class ZeroThresholdCollateralGroupCorrelated {

  87.     private static final double[] NumeraireValueRealization (
  88.         final DiffusionEvolver deNumeraireValue,
  89.         final double dblNumeraireValueInitial,
  90.         final double dblTime,
  91.         final double dblTimeWidth,
  92.         final double[] adblRandom,
  93.         final int iNumStep)
  94.         throws Exception
  95.     {
  96.         double[] adblNumeraireValue = new double[iNumStep + 1];
  97.         adblNumeraireValue[0] = dblNumeraireValueInitial;
  98.         double[] adblTimeWidth = new double[iNumStep];

  99.         for (int i = 0; i < iNumStep; ++i)
  100.             adblTimeWidth[i] = dblTimeWidth;

  101.         JumpDiffusionEdge[] aJDE = deNumeraireValue.incrementSequence (
  102.             new JumpDiffusionVertex (
  103.                 dblTime,
  104.                 dblNumeraireValueInitial,
  105.                 0.,
  106.                 false
  107.             ),
  108.             JumpDiffusionEdgeUnit.Diffusion (
  109.                 adblTimeWidth,
  110.                 adblRandom
  111.             ),
  112.             dblTimeWidth
  113.         );

  114.         for (int j = 1; j <= iNumStep; ++j)
  115.             adblNumeraireValue[j] = aJDE[j - 1].finish();

  116.         return adblNumeraireValue;
  117.     }

  118.     private static final double[] VertexNumeraireRealization (
  119.         final DiffusionEvolver deNumeraireValue,
  120.         final double dblNumeraireValueInitial,
  121.         final double dblTime,
  122.         final double dblTimeWidth,
  123.         final double[] adblRandom,
  124.         final int iNumStep)
  125.         throws Exception
  126.     {
  127.         double[] adblNumeraireValue = new double[iNumStep + 1];
  128.         double[] adblTimeWidth = new double[iNumStep];

  129.         for (int i = 0; i < iNumStep; ++i)
  130.             adblTimeWidth[i] = dblTimeWidth;

  131.         JumpDiffusionVertex[] aJDV = deNumeraireValue.vertexSequenceReverse (
  132.             new JumpDiffusionVertex (
  133.                 dblTime,
  134.                 dblNumeraireValueInitial,
  135.                 0.,
  136.                 false
  137.             ),
  138.             JumpDiffusionEdgeUnit.Diffusion (
  139.                 adblTimeWidth,
  140.                 adblRandom
  141.             ),
  142.             adblTimeWidth
  143.         );

  144.         for (int j = 0; j <= iNumStep; ++j)
  145.             adblNumeraireValue[j] = aJDV[j].value();

  146.         return adblNumeraireValue;
  147.     }

  148.     private static final double[] ATMSwapRateOffsetRealization (
  149.         final DiffusionEvolver deATMSwapRateOffset,
  150.         final double dblATMSwapRateOffsetInitial,
  151.         final double[] adblRandom,
  152.         final double dblTime,
  153.         final double dblTimeWidth,
  154.         final int iNumStep)
  155.         throws Exception
  156.     {
  157.         double[] adblATMSwapRateOffset = new double[iNumStep + 1];
  158.         adblATMSwapRateOffset[0] = dblATMSwapRateOffsetInitial;
  159.         double[] adblTimeWidth = new double[iNumStep];

  160.         for (int i = 0; i < iNumStep; ++i)
  161.             adblTimeWidth[i] = dblTimeWidth;

  162.         JumpDiffusionEdge[] aJDE = deATMSwapRateOffset.incrementSequence (
  163.             new JumpDiffusionVertex (
  164.                 dblTime,
  165.                 dblATMSwapRateOffsetInitial,
  166.                 0.,
  167.                 false
  168.             ),
  169.             JumpDiffusionEdgeUnit.Diffusion (
  170.                 adblTimeWidth,
  171.                 adblRandom
  172.             ),
  173.             dblTimeWidth
  174.         );

  175.         for (int j = 1; j <= iNumStep; ++j)
  176.             adblATMSwapRateOffset[j] = aJDE[j - 1].finish();

  177.         return adblATMSwapRateOffset;
  178.     }

  179.     private static final double[] SwapPortfolioValueRealization (
  180.         final DiffusionEvolver deATMSwapRate,
  181.         final double dblATMSwapRateStart,
  182.         final double[] adblRandom,
  183.         final int iNumStep,
  184.         final double dblTime,
  185.         final double dblTimeWidth,
  186.         final int iNumSwap)
  187.         throws Exception
  188.     {
  189.         double[] adblSwapPortfolioValueRealization = new double[iNumStep + 1];

  190.         for (int i = 0; i < iNumStep; ++i)
  191.             adblSwapPortfolioValueRealization[i] = 0.;

  192.         for (int i = 0; i < iNumSwap; ++i) {
  193.             double[] adblATMSwapRateOffsetRealization = ATMSwapRateOffsetRealization (
  194.                 deATMSwapRate,
  195.                 dblATMSwapRateStart,
  196.                 adblRandom,
  197.                 dblTime,
  198.                 dblTimeWidth,
  199.                 iNumStep
  200.             );

  201.             for (int j = 0; j <= iNumStep; ++j)
  202.                 adblSwapPortfolioValueRealization[j] += dblTimeWidth * (iNumStep - j) * adblATMSwapRateOffsetRealization[j];
  203.         }

  204.         return adblSwapPortfolioValueRealization;
  205.     }

  206.     public static final void main (
  207.         final String[] astrArgs)
  208.         throws Exception
  209.     {
  210.         EnvManager.InitEnv ("");

  211.         int iNumStep = 10;
  212.         int iNumSwap = 10;
  213.         double dblTime = 5.;
  214.         int iNumPath = 10000;
  215.         double dblATMSwapRateOffsetDrift = 0.0;
  216.         double dblATMSwapRateOffsetVolatility = 0.25;
  217.         double dblATMSwapRateOffsetStart = 0.;
  218.         double dblOvernightNumeraireDrift = 0.004;
  219.         double dblOvernightNumeraireVolatility = 0.02;
  220.         double dblOvernightNumeraireInitial = 1.;
  221.         double dblCSADrift = 0.01;
  222.         double dblCSAVolatility = 0.05;
  223.         double dblCSAInitial = 1.;
  224.         double dblBankHazardRateDrift = 0.002;
  225.         double dblBankHazardRateVolatility = 0.20;
  226.         double dblBankHazardRateInitial = 0.015;
  227.         double dblBankRecoveryRateDrift = 0.002;
  228.         double dblBankRecoveryRateVolatility = 0.02;
  229.         double dblBankRecoveryRateInitial = 0.40;
  230.         double dblCounterPartyHazardRateDrift = 0.002;
  231.         double dblCounterPartyHazardRateVolatility = 0.30;
  232.         double dblCounterPartyHazardRateInitial = 0.030;
  233.         double dblCounterPartyRecoveryRateDrift = 0.002;
  234.         double dblCounterPartyRecoveryRateVolatility = 0.02;
  235.         double dblCounterPartyRecoveryRateInitial = 0.30;
  236.         double dblBankFundingSpreadDrift = 0.00002;
  237.         double dblBankFundingSpreadVolatility = 0.002;
  238.         double dblCounterPartyFundingSpreadDrift = 0.000022;
  239.         double dblCounterPartyFundingSpreadVolatility = 0.0022;

  240.         double[][] aadblCorrelation = new double[][] {
  241.             {1.00,  0.00,  0.03,  0.07,  0.04,  0.05,  0.08,  0.00,  0.00},  // PORTFOLIO
  242.             {0.00,  1.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  1.00},  // OVERNIGHT
  243.             {0.03,  0.00,  1.00,  0.26,  0.33,  0.21,  0.35,  0.13,  0.00},  // CSA
  244.             {0.07,  0.00,  0.26,  1.00,  0.45, -0.17,  0.07,  0.77,  0.00},  // BANK HAZARD
  245.             {0.04,  0.00,  0.33,  0.45,  1.00, -0.22, -0.54,  0.58,  0.00},  // COUNTER PARTY HAZARD
  246.             {0.05,  0.00,  0.21, -0.17, -0.22,  1.00,  0.47, -0.23,  0.00},  // BANK RECOVERY
  247.             {0.08,  0.00,  0.35,  0.07, -0.54,  0.47,  1.00,  0.01,  0.00},  // COUNTER PARTY RECOVERY
  248.             {0.00,  0.00,  0.13,  0.77,  0.58, -0.23,  0.01,  1.00,  0.00},  // BANK FUNDING SPREAD
  249.             {0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  0.00,  1.00}   // COUNTER PARTY FUNDING SPREAD
  250.         };

  251.         JulianDate dtSpot = DateUtil.Today();

  252.         PositionGroupSpecification positionGroupSpecification = PositionGroupSpecification.FixedThreshold (
  253.             "FIXEDTHRESHOLD",
  254.             0.,
  255.             0.,
  256.             PositionReplicationScheme.ALBANESE_ANDERSEN_VERTEX,
  257.             BrokenDateScheme.SQUARE_ROOT_OF_TIME,
  258.             0.,
  259.             CloseOutScheme.ISDA_92
  260.         );

  261.         double dblTimeWidth = dblTime / iNumStep;
  262.         JulianDate[] adtVertex = new JulianDate[iNumStep + 1];
  263.         double[][] aadblPortfolioValue = new double[iNumPath][iNumStep + 1];
  264.         MonoPathExposureAdjustment[] aMPEA = new MonoPathExposureAdjustment[iNumPath];
  265.         double dblBankFundingSpreadInitial = dblBankHazardRateInitial / (1. - dblBankRecoveryRateInitial);
  266.         double dblCounterPartyFundingSpreadInitial = dblCounterPartyHazardRateInitial / (1. - dblCounterPartyRecoveryRateInitial);

  267.         DiffusionEvolver deATMSwapRateOffset = new DiffusionEvolver (
  268.             DiffusionEvaluatorLinear.Standard (
  269.                 dblATMSwapRateOffsetDrift,
  270.                 dblATMSwapRateOffsetVolatility
  271.             )
  272.         );

  273.         DiffusionEvolver deOvernightNumeraire = new DiffusionEvolver (
  274.             DiffusionEvaluatorLogarithmic.Standard (
  275.                 dblOvernightNumeraireDrift,
  276.                 dblOvernightNumeraireVolatility
  277.             )
  278.         );

  279.         DiffusionEvolver deCSA = new DiffusionEvolver (
  280.             DiffusionEvaluatorLogarithmic.Standard (
  281.                 dblCSADrift,
  282.                 dblCSAVolatility
  283.             )
  284.         );

  285.         DiffusionEvolver deBankHazardRate = new DiffusionEvolver (
  286.             DiffusionEvaluatorLogarithmic.Standard (
  287.                 dblBankHazardRateDrift,
  288.                 dblBankHazardRateVolatility
  289.             )
  290.         );

  291.         DiffusionEvolver deCounterPartyHazardRate = new DiffusionEvolver (
  292.             DiffusionEvaluatorLogarithmic.Standard (
  293.                 dblCounterPartyHazardRateDrift,
  294.                 dblCounterPartyHazardRateVolatility
  295.             )
  296.         );

  297.         DiffusionEvolver deBankRecoveryRate = new DiffusionEvolver (
  298.             DiffusionEvaluatorLogarithmic.Standard (
  299.                 dblBankRecoveryRateDrift,
  300.                 dblBankRecoveryRateVolatility
  301.             )
  302.         );

  303.         DiffusionEvolver deCounterPartyRecoveryRate = new DiffusionEvolver (
  304.             DiffusionEvaluatorLogarithmic.Standard (
  305.                 dblCounterPartyRecoveryRateDrift,
  306.                 dblCounterPartyRecoveryRateVolatility
  307.             )
  308.         );

  309.         DiffusionEvolver deBankFundingSpread = new DiffusionEvolver (
  310.             DiffusionEvaluatorLinear.Standard (
  311.                 dblBankFundingSpreadDrift,
  312.                 dblBankFundingSpreadVolatility
  313.             )
  314.         );

  315.         DiffusionEvolver deCounterPartyFundingSpread = new DiffusionEvolver (
  316.             DiffusionEvaluatorLinear.Standard (
  317.                 dblCounterPartyFundingSpreadDrift,
  318.                 dblCounterPartyFundingSpreadVolatility
  319.             )
  320.         );

  321.         for (int i = 0; i < iNumPath; ++i) {
  322.             double[][] aadblNumeraire = Matrix.Transpose (
  323.                 SequenceGenerator.GaussianJoint (
  324.                     iNumStep,
  325.                     aadblCorrelation
  326.                 )
  327.             );

  328.             aadblPortfolioValue[i] = SwapPortfolioValueRealization (
  329.                 deATMSwapRateOffset,
  330.                 dblATMSwapRateOffsetStart,
  331.                 aadblNumeraire[0],
  332.                 iNumStep,
  333.                 dblTime,
  334.                 dblTimeWidth,
  335.                 iNumSwap
  336.             );

  337.             double[] adblOvernightNumeraire = VertexNumeraireRealization (
  338.                 deOvernightNumeraire,
  339.                 dblOvernightNumeraireInitial,
  340.                 dblTime,
  341.                 dblTimeWidth,
  342.                 aadblNumeraire[1],
  343.                 iNumStep
  344.             );

  345.             double[] adblCSA = VertexNumeraireRealization (
  346.                 deCSA,
  347.                 dblCSAInitial,
  348.                 dblTime,
  349.                 dblTimeWidth,
  350.                 aadblNumeraire[2],
  351.                 iNumStep
  352.             );

  353.             double[] adblBankHazardRate = NumeraireValueRealization (
  354.                 deBankHazardRate,
  355.                 dblBankHazardRateInitial,
  356.                 dblTime,
  357.                 dblTimeWidth,
  358.                 aadblNumeraire[3],
  359.                 iNumStep
  360.             );

  361.             double[] adblCounterPartyHazardRate = NumeraireValueRealization (
  362.                 deCounterPartyHazardRate,
  363.                 dblCounterPartyHazardRateInitial,
  364.                 dblTime,
  365.                 dblTimeWidth,
  366.                 aadblNumeraire[4],
  367.                 iNumStep
  368.             );

  369.             double[] adblBankRecoveryRate = NumeraireValueRealization (
  370.                 deBankRecoveryRate,
  371.                 dblBankRecoveryRateInitial,
  372.                 dblTime,
  373.                 dblTimeWidth,
  374.                 aadblNumeraire[5],
  375.                 iNumStep
  376.             );

  377.             double[] adblCounterPartyRecoveryRate = NumeraireValueRealization (
  378.                 deCounterPartyRecoveryRate,
  379.                 dblCounterPartyRecoveryRateInitial,
  380.                 dblTime,
  381.                 dblTimeWidth,
  382.                 aadblNumeraire[6],
  383.                 iNumStep
  384.             );

  385.             double[] adblBankFundingSpread = NumeraireValueRealization (
  386.                 deBankFundingSpread,
  387.                 dblBankFundingSpreadInitial,
  388.                 dblTime,
  389.                 dblTimeWidth,
  390.                 aadblNumeraire[7],
  391.                 iNumStep
  392.             );

  393.             double[] adblCounterPartyFundingSpread = NumeraireValueRealization (
  394.                 deCounterPartyFundingSpread,
  395.                 dblCounterPartyFundingSpreadInitial,
  396.                 dblTime,
  397.                 dblTimeWidth,
  398.                 aadblNumeraire[8],
  399.                 iNumStep
  400.             );

  401.             JulianDate dtStart = dtSpot;
  402.             MarketVertex[] aMV = new MarketVertex [iNumStep + 1];
  403.             double dblValueStart = dblTime * dblATMSwapRateOffsetStart;
  404.             AlbaneseAndersen[] aHGVR = new AlbaneseAndersen[iNumStep + 1];

  405.             for (int j = 0; j <= iNumStep; ++j)
  406.             {
  407.                 LatentStateVertexContainer latentStateVertexContainer = new LatentStateVertexContainer();

  408.                 latentStateVertexContainer.add (
  409.                     OTCFixFloatLabel.Standard ("USD-3M-10Y"),
  410.                     Double.NaN
  411.                 );

  412.                 aMV[j] = MarketVertex.Nodal (
  413.                     adtVertex[j] = dtSpot.addMonths (6 * j),
  414.                     dblOvernightNumeraireDrift,
  415.                     adblOvernightNumeraire[j],
  416.                     dblCSADrift,
  417.                     adblCSA[j],
  418.                     new MarketVertexEntity (
  419.                         Math.exp (-0.5 * adblBankHazardRate[j] * (iNumStep - j)),
  420.                         adblBankHazardRate[j],
  421.                         adblBankRecoveryRate[j],
  422.                         adblBankFundingSpread[j],
  423.                         Math.exp (-0.5 * adblBankHazardRate[j] * (1. - adblBankRecoveryRate[j]) * (iNumStep - j)),
  424.                         Double.NaN,
  425.                         Double.NaN,
  426.                         Double.NaN
  427.                     ),
  428.                     new MarketVertexEntity (
  429.                         Math.exp (-0.5 * adblCounterPartyHazardRate[j] * j),
  430.                         adblCounterPartyHazardRate[j],
  431.                         adblCounterPartyRecoveryRate[j],
  432.                         adblCounterPartyFundingSpread[j],
  433.                         Math.exp (-0.5 * adblCounterPartyHazardRate[j] * (1. - adblCounterPartyRecoveryRate[j]) * (iNumStep - j)),
  434.                         Double.NaN,
  435.                         Double.NaN,
  436.                         Double.NaN
  437.                     ),
  438.                     latentStateVertexContainer
  439.                 );

  440.                 JulianDate dtEnd = adtVertex[j];
  441.                 double dblCollateralBalance = 0.;
  442.                 double dblValueEnd = aadblPortfolioValue[i][j];

  443.                 if (0 != j) {
  444.                     CollateralAmountEstimator hae = new CollateralAmountEstimator (
  445.                         positionGroupSpecification,
  446.                         new BrokenDateInterpolatorLinearT (
  447.                             dtStart.julian(),
  448.                             dtEnd.julian(),
  449.                             dblValueStart,
  450.                             dblValueEnd
  451.                         ),
  452.                         Double.NaN
  453.                     );

  454.                     dblCollateralBalance = hae.postingRequirement (dtEnd);
  455.                 }

  456.                 aHGVR[j] = new AlbaneseAndersen (
  457.                     adtVertex[j],
  458.                     aadblPortfolioValue[i][j],
  459.                     0.,
  460.                     dblCollateralBalance
  461.                 );

  462.                 dtStart = dtEnd;
  463.                 dblValueStart = dblValueEnd;
  464.             }

  465.             MarketPath mp = MarketPath.FromMarketVertexArray (aMV);

  466.             CollateralGroupPath[] aHGP = new CollateralGroupPath[] {
  467.                 new CollateralGroupPath (
  468.                     aHGVR,
  469.                     mp
  470.                 )
  471.             };

  472.             aMPEA[i] = new MonoPathExposureAdjustment (
  473.                 new AlbaneseAndersenFundingGroupPath[] {
  474.                     new AlbaneseAndersenFundingGroupPath (
  475.                         new AlbaneseAndersenNettingGroupPath[] {
  476.                             new AlbaneseAndersenNettingGroupPath (
  477.                                 aHGP,
  478.                                 mp
  479.                             )
  480.                         },
  481.                         mp
  482.                     )
  483.                 }
  484.             );
  485.         }

  486.         ExposureAdjustmentAggregator eaa = new ExposureAdjustmentAggregator (aMPEA);

  487.         JulianDate[] adtVertexNode = eaa.vertexDates();

  488.         System.out.println();

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

  490.         String strDump = "\t|         DATE         =>" ;

  491.         for (int i = 0; i < adtVertexNode.length; ++i)
  492.             strDump = strDump + " " + adtVertexNode[i] + " |";

  493.         System.out.println (strDump);

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

  495.         double[] adblExposure = eaa.collateralizedExposure();

  496.         strDump = "\t|       EXPOSURE       =>";

  497.         for (int j = 0; j < adblExposure.length; ++j)
  498.             strDump = strDump + "   " + FormatUtil.FormatDouble (adblExposure[j], 1, 4, 1.) + "   |";

  499.         System.out.println (strDump);

  500.         double[] adblPositiveExposure = eaa.collateralizedPositiveExposure();

  501.         strDump = "\t|  POSITIVE EXPOSURE   =>";

  502.         for (int j = 0; j < adblPositiveExposure.length; ++j)
  503.             strDump = strDump + "   " + FormatUtil.FormatDouble (adblPositiveExposure[j], 1, 4, 1.) + "   |";

  504.         System.out.println (strDump);

  505.         double[] adblNegativeExposure = eaa.collateralizedNegativeExposure();

  506.         strDump = "\t|  NEGATIVE EXPOSURE   =>";

  507.         for (int j = 0; j < adblNegativeExposure.length; ++j)
  508.             strDump = strDump + "   " + FormatUtil.FormatDouble (adblNegativeExposure[j], 1, 4, 1.) + "   |";

  509.         System.out.println (strDump);

  510.         double[] adblExposurePV = eaa.collateralizedExposurePV();

  511.         strDump = "\t|      EXPOSURE PV     =>";

  512.         for (int j = 0; j < adblExposurePV.length; ++j)
  513.             strDump = strDump + "   " + FormatUtil.FormatDouble (adblExposurePV[j], 1, 4, 1.) + "   |";

  514.         System.out.println (strDump);

  515.         double[] adblPositiveExposurePV = eaa.collateralizedPositiveExposurePV();

  516.         strDump = "\t| POSITIVE EXPOSURE PV =>";

  517.         for (int j = 0; j < adblPositiveExposurePV.length; ++j)
  518.             strDump = strDump + "   " + FormatUtil.FormatDouble (adblPositiveExposurePV[j], 1, 4, 1.) + "   |";

  519.         System.out.println (strDump);

  520.         double[] adblNegativeExposurePV = eaa.collateralizedNegativeExposurePV();

  521.         strDump = "\t| NEGATIVE EXPOSURE PV =>";

  522.         for (int j = 0; j < adblNegativeExposurePV.length; ++j)
  523.             strDump = strDump + "   " + FormatUtil.FormatDouble (adblNegativeExposurePV[j], 1, 4, 1.) + "   |";

  524.         System.out.println (strDump);

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

  526.         System.out.println();

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

  528.         System.out.println ("\t||  UCVA  => " + FormatUtil.FormatDouble (eaa.ucva().amount(), 2, 2, 100.) + "% ||");

  529.         System.out.println ("\t|| FTDCVA => " + FormatUtil.FormatDouble (eaa.ftdcva().amount(), 2, 2, 100.) + "% ||");

  530.         System.out.println ("\t||  CVA   => " + FormatUtil.FormatDouble (eaa.cva().amount(), 2, 2, 100.) + "% ||");

  531.         System.out.println ("\t||  CVACL => " + FormatUtil.FormatDouble (eaa.cvacl().amount(), 2, 2, 100.) + "% ||");

  532.         System.out.println ("\t||  DVA   => " + FormatUtil.FormatDouble (eaa.dva().amount(), 2, 2, 100.) + "% ||");

  533.         System.out.println ("\t||  FVA   => " + FormatUtil.FormatDouble (eaa.fva().amount(), 2, 2, 100.) + "% ||");

  534.         System.out.println ("\t||  FDA   => " + FormatUtil.FormatDouble (eaa.fda().amount(), 2, 2, 100.) + "% ||");

  535.         System.out.println ("\t||  FCA   => " + FormatUtil.FormatDouble (eaa.fca().amount(), 2, 2, 100.) + "% ||");

  536.         System.out.println ("\t||  FBA   => " + FormatUtil.FormatDouble (eaa.fba().amount(), 2, 2, 100.) + "% ||");

  537.         System.out.println ("\t||  SFVA  => " + FormatUtil.FormatDouble (eaa.sfva().amount(), 2, 2, 100.) + "% ||");

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

  539.         EnvManager.TerminateEnv();
  540.     }
  541. }