AdvisoryExplain.java

  1. package org.drip.sample.allocation;

  2. import java.util.Map;

  3. import org.drip.analytics.support.CaseInsensitiveHashMap;
  4. import org.drip.capital.allocation.CorrelationCategoryBetaManager;
  5. import org.drip.capital.allocation.EntityCapital;
  6. import org.drip.capital.allocation.EntityCapitalAssignmentSetting;
  7. import org.drip.capital.allocation.EntityComponentCapital;
  8. import org.drip.capital.allocation.EntityComponentCapitalAssignment;
  9. import org.drip.capital.allocation.EntityComponentCorrelationCategory;
  10. import org.drip.capital.entity.CapitalUnit;
  11. import org.drip.capital.entity.ManagedSegmentL1;
  12. import org.drip.capital.env.CapitalEstimationContextManager;
  13. import org.drip.capital.explain.CapitalSegmentStandaloneMarginal;
  14. import org.drip.capital.label.BusinessRegionRiskTypeCoordinate;
  15. import org.drip.capital.label.CapitalSegmentCoordinate;
  16. import org.drip.capital.label.Coordinate;
  17. import org.drip.capital.setting.CapitalAllocationControl;
  18. import org.drip.capital.setting.SimulationControl;
  19. import org.drip.capital.setting.SimulationPnLControl;
  20. import org.drip.numerical.common.FormatUtil;
  21. import org.drip.service.env.EnvManager;

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

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

  94. /**
  95.  * <i>AdvisoryExplain</i> zeds the Comparison across the Different Allocation Methodologies.
  96.  *
  97.  *     MANAGED SEGMENT  - Advisory
  98.  *
  99.  *     HIGH   - Fixed    Beta
  100.  *     MEDIUM - Floating Beta
  101.  *     LOW    - Floating Beta
  102.  *    
  103.  * The References are:
  104.  *
  105.  * <br><br>
  106.  *  <ul>
  107.  *      <li>
  108.  *          Bank for International Supervision (2005): Stress Testing at Major Financial Institutions: Survey
  109.  *              Results and Practice https://www.bis.org/publ/cgfs24.htm
  110.  *      </li>
  111.  *      <li>
  112.  *          Glasserman, P. (2004): <i>Monte Carlo Methods in Financial Engineering</i> <b>Springer</b>
  113.  *      </li>
  114.  *      <li>
  115.  *          Kupiec, P. H. (2000): Stress Tests and Risk Capital <i>Risk</i> <b>2 (4)</b> 27-39
  116.  *      </li>
  117.  *  </ul>
  118.  *
  119.  *  <br><br>
  120.  *  <ul>
  121.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/PortfolioCore.md">Portfolio Core Module</a></li>
  122.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/CapitalAnalyticsLibrary.md">Capital Analytics</a></li>
  123.  *      <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>
  124.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/sample/allocation/README.md">Managed Segment Capital Allocation Schemes</a></li>
  125.  *  </ul>
  126.  *    
  127.  * @author Lakshmi Krishnamurthy
  128.  */

  129. public class AdvisoryExplain
  130. {

  131.     private static final CapitalUnit MakeCapitalUnit (
  132.         final String business,
  133.         final String region,
  134.         final String riskType,
  135.         final double varNotional)
  136.         throws Exception
  137.     {
  138.         Coordinate capitalUnitCoordinate = new BusinessRegionRiskTypeCoordinate (
  139.             business,
  140.             region,
  141.             riskType
  142.         );

  143.         return new CapitalUnit (
  144.             capitalUnitCoordinate,
  145.             CapitalEstimationContextManager.ContextContainer().capitalUnitStressEventContext().capitalUnitEventMap().get
  146.             (
  147.                 capitalUnitCoordinate.fullyQualifiedName()
  148.             ),
  149.             varNotional
  150.         );
  151.     }

  152.     private static final EntityCapitalAssignmentSetting LowUniformBeta()
  153.     {
  154.         return EntityCapitalAssignmentSetting.UniformBeta (
  155.             EntityComponentCorrelationCategory.LOW_CORRELATION,
  156.             EntityComponentCorrelationCategory.LOW_CORRELATION,
  157.             EntityComponentCorrelationCategory.LOW_CORRELATION,
  158.             EntityComponentCorrelationCategory.HIGH_CORRELATION,
  159.             EntityComponentCorrelationCategory.HIGH_CORRELATION
  160.         );
  161.     }

  162.     private static final EntityCapitalAssignmentSetting MediumUniformBeta()
  163.     {
  164.         return EntityCapitalAssignmentSetting.UniformBeta (
  165.             EntityComponentCorrelationCategory.MEDIUM_CORRELATION,
  166.             EntityComponentCorrelationCategory.MEDIUM_CORRELATION,
  167.             EntityComponentCorrelationCategory.MEDIUM_CORRELATION,
  168.             EntityComponentCorrelationCategory.HIGH_CORRELATION,
  169.             EntityComponentCorrelationCategory.HIGH_CORRELATION
  170.         );
  171.     }

  172.     private static final EntityCapitalAssignmentSetting HighUniformBeta()
  173.     {
  174.         return EntityCapitalAssignmentSetting.UniformBeta (
  175.             EntityComponentCorrelationCategory.HIGH_CORRELATION,
  176.             EntityComponentCorrelationCategory.HIGH_CORRELATION,
  177.             EntityComponentCorrelationCategory.HIGH_CORRELATION,
  178.             EntityComponentCorrelationCategory.HIGH_CORRELATION,
  179.             EntityComponentCorrelationCategory.HIGH_CORRELATION
  180.         );
  181.     }

  182.     private static final EntityCapitalAssignmentSetting HighMedumLowUniformBeta()
  183.     {
  184.         double random = Math.random();

  185.         if (random < 13. / 34.)
  186.         {
  187.             return LowUniformBeta();
  188.         }

  189.         return random < 29. / 34. ? MediumUniformBeta() : HighUniformBeta();
  190.     }

  191.     private static final EntityCapitalAssignmentSetting HighLowUniformBeta()
  192.     {
  193.         return Math.random() < 29. / 34. ? LowUniformBeta() : HighUniformBeta();
  194.     }

  195.     private static final void Allocate (
  196.         final CapitalUnit[] capitalUnitArray,
  197.         final CapitalSegmentStandaloneMarginal capitalSegmentStandaloneMarginal,
  198.         final CapitalAllocationControl marginalProRataCapitalAllocationControl,
  199.         final CapitalAllocationControl standaloneProRataCapitalAllocationControl,
  200.         final CapitalAllocationControl fixedFloatFloatCapitalAllocationControl,
  201.         final CapitalAllocationControl fixedFloatCapitalAllocationControl,
  202.         final CapitalAllocationControl floatFloatCapitalAllocationControl)
  203.         throws Exception
  204.     {
  205.         EntityComponentCapitalAssignment marginalProRataEntityComponentCapitalAssignment =
  206.             capitalSegmentStandaloneMarginal.betaAllocation (
  207.                 marginalProRataCapitalAllocationControl
  208.             );

  209.         Map<String, EntityComponentCapital> marginalProRataEntityComponentCapitalMap =
  210.             marginalProRataEntityComponentCapitalAssignment.entityComponentCapitalMap();

  211.         EntityComponentCapitalAssignment standaloneProRataEntityComponentCapitalAssignment =
  212.             capitalSegmentStandaloneMarginal.betaAllocation (
  213.                 standaloneProRataCapitalAllocationControl
  214.             );

  215.         Map<String, EntityComponentCapital> standaloneProRataEntityComponentCapitalMap =
  216.             standaloneProRataEntityComponentCapitalAssignment.entityComponentCapitalMap();

  217.         EntityComponentCapitalAssignment fixedFloatFloatEntityComponentCapitalAssignment =
  218.             capitalSegmentStandaloneMarginal.betaAllocation (
  219.                 fixedFloatFloatCapitalAllocationControl
  220.             );

  221.         Map<String, EntityComponentCapital> fixedFloatFloatEntityComponentCapitalMap =
  222.             fixedFloatFloatEntityComponentCapitalAssignment.entityComponentCapitalMap();

  223.         EntityComponentCapitalAssignment fixedFloatEntityComponentCapitalAssignment =
  224.             capitalSegmentStandaloneMarginal.betaAllocation (
  225.                 fixedFloatCapitalAllocationControl
  226.             );

  227.         Map<String, EntityComponentCapital> fixedFloatEntityComponentCapitalMap =
  228.             fixedFloatEntityComponentCapitalAssignment.entityComponentCapitalMap();

  229.         EntityComponentCapitalAssignment floatFloatEntityComponentCapitalAssignment =
  230.             capitalSegmentStandaloneMarginal.betaAllocation (
  231.                 floatFloatCapitalAllocationControl
  232.             );

  233.         Map<String, EntityComponentCapital> floatFloatEntityComponentCapitalMap =
  234.             floatFloatEntityComponentCapitalAssignment.entityComponentCapitalMap();

  235.         System.out.println (
  236.             "\t|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"
  237.         );

  238.         System.out.println (
  239.             "\t|                                                                              CAPITAL UNIT RC ALLOCATION                                                                              ||"
  240.         );

  241.         System.out.println (
  242.             "\t|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"
  243.         );

  244.         System.out.println (
  245.             "\t|    L -> R:                                                                                                                                                                           ||"
  246.         );

  247.         System.out.println (
  248.             "\t|            - Marginal Pro-Rata Fractional                                                                                                                                            ||"
  249.         );

  250.         System.out.println (
  251.             "\t|            - Standalone Pro-Rata Fractional                                                                                                                                          ||"
  252.         );

  253.         System.out.println (
  254.             "\t|            - Three-Beta Fixed-Float-Float Fractional                                                                                                                                 ||"
  255.         );

  256.         System.out.println (
  257.             "\t|            - Two-Beta Fixed-Float Fractional                                                                                                                                         ||"
  258.         );

  259.         System.out.println (
  260.             "\t|            - Two-Beta Float-Float Fractional                                                                                                                                         ||"
  261.         );

  262.         System.out.println (
  263.             "\t|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"
  264.         );

  265.         System.out.println (
  266.             "\t|            - Marginal Pro-Rata Absolute                                                                                                                                              ||"
  267.         );

  268.         System.out.println (
  269.             "\t|            - Standalone Pro-Rata Absolute                                                                                                                                            ||"
  270.         );

  271.         System.out.println (
  272.             "\t|            - Three-Beta Fixed-Float-Float Absolute                                                                                                                                   ||"
  273.         );

  274.         System.out.println (
  275.             "\t|            - Two-Beta Fixed-Float Absolute                                                                                                                                           ||"
  276.         );

  277.         System.out.println (
  278.             "\t|            - Two-Beta Float-Float Absolute                                                                                                                                           ||"
  279.         );

  280.         System.out.println (
  281.             "\t|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"
  282.         );

  283.         System.out.println (
  284.             "\t|            - Capital Unit Coordinate                                                                                                                                                 ||"
  285.         );

  286.         System.out.println (
  287.             "\t|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"
  288.         );

  289.         for (int capitalUnitIndex = 0;
  290.             capitalUnitIndex < capitalUnitArray.length;
  291.             ++capitalUnitIndex)
  292.         {
  293.             String capitalUnitFQN = capitalUnitArray[capitalUnitIndex].coordinate().fullyQualifiedName();

  294.             EntityCapital marginalProRataEntityComponentCapitalTotal =
  295.                 marginalProRataEntityComponentCapitalMap.get (
  296.                     capitalUnitFQN
  297.                 ).total();

  298.             EntityCapital standaloneProRataEntityComponentCapitalTotal =
  299.                 standaloneProRataEntityComponentCapitalMap.get (
  300.                     capitalUnitFQN
  301.                 ).total();

  302.             EntityCapital fixedFloatFloatEntityComponentCapitalTotal =
  303.                 fixedFloatFloatEntityComponentCapitalMap.get (
  304.                     capitalUnitFQN
  305.                 ).total();

  306.             EntityCapital fixedFloatEntityComponentCapitalTotal = fixedFloatEntityComponentCapitalMap.get (
  307.                 capitalUnitFQN
  308.             ).total();

  309.             EntityCapital floatFloatEntityComponentCapitalTotal = floatFloatEntityComponentCapitalMap.get (
  310.                 capitalUnitFQN
  311.             ).total();

  312.             System.out.println (
  313.                 "\t|    " +
  314.                 FormatUtil.FormatDouble (
  315.                     marginalProRataEntityComponentCapitalTotal.fractional(), 2, 2, 100.
  316.                 ) + "% | " +
  317.                 FormatUtil.FormatDouble (
  318.                     standaloneProRataEntityComponentCapitalTotal.fractional(), 2, 2, 100.
  319.                 ) + "% | " +
  320.                 FormatUtil.FormatDouble (
  321.                     fixedFloatFloatEntityComponentCapitalTotal.fractional(), 2, 2, 100.
  322.                 ) + "% | " +
  323.                 FormatUtil.FormatDouble (
  324.                     fixedFloatEntityComponentCapitalTotal.fractional(), 2, 2, 100.
  325.                 ) + "% | " +
  326.                 FormatUtil.FormatDouble (
  327.                     floatFloatEntityComponentCapitalTotal.fractional(), 2, 2, 100.
  328.                 ) + "% || " + FormatUtil.FormatDouble (
  329.                     marginalProRataEntityComponentCapitalTotal.absolute(), 10, 2, 1.
  330.                 ) + " | " + FormatUtil.FormatDouble (
  331.                     standaloneProRataEntityComponentCapitalTotal.absolute(), 10, 2, 1.
  332.                 ) + " | " + FormatUtil.FormatDouble (
  333.                     fixedFloatFloatEntityComponentCapitalTotal.absolute(), 10, 2, 1.
  334.                 ) + " | " + FormatUtil.FormatDouble (
  335.                     fixedFloatEntityComponentCapitalTotal.absolute(), 10, 2, 1.
  336.                 ) + " | " + FormatUtil.FormatDouble (
  337.                     floatFloatEntityComponentCapitalTotal.absolute(), 10, 2, 1.
  338.                 ) + " <= " + capitalUnitFQN
  339.             );
  340.         }

  341.         System.out.println (
  342.             "\t|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"
  343.         );

  344.         System.out.println (
  345.             "\t|   " +
  346.             FormatUtil.FormatDouble (
  347.                 1., 2, 2, 100.
  348.             ) + "% |" +
  349.             FormatUtil.FormatDouble (
  350.                 1., 2, 2, 100.
  351.             ) + "% |" +
  352.             FormatUtil.FormatDouble (
  353.                 1., 2, 2, 100.
  354.             ) + "% |" +
  355.             FormatUtil.FormatDouble (
  356.                 1., 2, 2, 100.
  357.             ) + "% |" +
  358.             FormatUtil.FormatDouble (
  359.                 1., 2, 2, 100.
  360.             ) + "% || " + FormatUtil.FormatDouble (
  361.                 marginalProRataEntityComponentCapitalAssignment.allocatedBetaCapital(), 10, 2, 1.
  362.             ) + " | " + FormatUtil.FormatDouble (
  363.                 standaloneProRataEntityComponentCapitalAssignment.allocatedBetaCapital(), 10, 2, 1.
  364.             ) + " | " + FormatUtil.FormatDouble (
  365.                 fixedFloatFloatEntityComponentCapitalAssignment.allocatedBetaCapital(), 10, 2, 1.
  366.             ) + " | " + FormatUtil.FormatDouble (
  367.                 fixedFloatEntityComponentCapitalAssignment.allocatedBetaCapital(), 10, 2, 1.
  368.             ) + " | " + FormatUtil.FormatDouble (
  369.                 floatFloatEntityComponentCapitalAssignment.allocatedBetaCapital(), 10, 2, 1.
  370.             ) + " <= TOTAL"
  371.         );

  372.         System.out.println (
  373.             "\t|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------||"
  374.         );

  375.         System.out.println();
  376.     }

  377.     public static final void main (
  378.         final String[] argumentArray)
  379.         throws Exception
  380.     {
  381.         EnvManager.InitEnv ("");

  382.         double capitalUnitNotional = 10000.;
  383.         String capitalSegmentFQN = "Advisory";
  384.         String[] regionArray =
  385.         {
  386.             "EMEA",
  387.             "LATIN AMERICA",
  388.         };
  389.         String[] riskTypeArray =
  390.         {
  391.             "AFS",
  392.             "AFS",
  393.         };

  394.         CorrelationCategoryBetaManager proRataCategoryManager =
  395.             CorrelationCategoryBetaManager.TwoBetaFloatFloat (
  396.                 1.0
  397.             );

  398.         CorrelationCategoryBetaManager fixedFloatFloatCategoryManager =
  399.             CorrelationCategoryBetaManager.ThreeBetaFixedFloatFloat (
  400.                 0.8,
  401.                 2.0
  402.             );

  403.         CorrelationCategoryBetaManager fixedFloatCategoryManager =
  404.             CorrelationCategoryBetaManager.TwoBetaFixedFloat (
  405.                 0.8
  406.             );

  407.         CorrelationCategoryBetaManager floatFloatCategoryManager =
  408.             CorrelationCategoryBetaManager.TwoBetaFloatFloat (
  409.                 2.0
  410.             );

  411.         SimulationControl simulationControl = SimulationControl.Standard();

  412.         SimulationPnLControl simulationPnLControl = SimulationPnLControl.Standard();

  413.         Map<String, EntityCapitalAssignmentSetting> proRataEntityCapitalAssignmentSettingMap =
  414.             new CaseInsensitiveHashMap<EntityCapitalAssignmentSetting>();

  415.         Map<String, EntityCapitalAssignmentSetting> fixedFloatFloatEntityCapitalAssignmentSettingMap =
  416.             new CaseInsensitiveHashMap<EntityCapitalAssignmentSetting>();

  417.         Map<String, EntityCapitalAssignmentSetting> fixedFloatEntityCapitalAssignmentSettingMap =
  418.             new CaseInsensitiveHashMap<EntityCapitalAssignmentSetting>();

  419.         Map<String, EntityCapitalAssignmentSetting> floatFloatEntityCapitalAssignmentSettingMap =
  420.             new CaseInsensitiveHashMap<EntityCapitalAssignmentSetting>();

  421.         CapitalUnit[] capitalUnitArray = new CapitalUnit[riskTypeArray.length];

  422.         for (int capitalUnitIndex = 0;
  423.             capitalUnitIndex < riskTypeArray.length;
  424.             ++capitalUnitIndex)
  425.         {
  426.             capitalUnitArray[capitalUnitIndex] = MakeCapitalUnit (
  427.                 capitalSegmentFQN,
  428.                 regionArray[capitalUnitIndex],
  429.                 riskTypeArray[capitalUnitIndex],
  430.                 capitalUnitNotional
  431.             );

  432.             proRataEntityCapitalAssignmentSettingMap.put (
  433.                 capitalUnitArray[capitalUnitIndex].coordinate().fullyQualifiedName(),
  434.                 LowUniformBeta()
  435.             );

  436.             fixedFloatFloatEntityCapitalAssignmentSettingMap.put (
  437.                 capitalUnitArray[capitalUnitIndex].coordinate().fullyQualifiedName(),
  438.                 HighMedumLowUniformBeta()
  439.             );

  440.             fixedFloatEntityCapitalAssignmentSettingMap.put (
  441.                 capitalUnitArray[capitalUnitIndex].coordinate().fullyQualifiedName(),
  442.                 HighLowUniformBeta()
  443.             );

  444.             floatFloatEntityCapitalAssignmentSettingMap.put (
  445.                 capitalUnitArray[capitalUnitIndex].coordinate().fullyQualifiedName(),
  446.                 HighLowUniformBeta()
  447.             );
  448.         }

  449.         CapitalSegmentStandaloneMarginal capitalSegmentStandaloneMarginal = new ManagedSegmentL1 (
  450.             new CapitalSegmentCoordinate (
  451.                 capitalSegmentFQN
  452.             ),
  453.             capitalUnitArray
  454.         ).pathEnsemble (
  455.             simulationControl,
  456.             simulationPnLControl
  457.         ).marginalStandalonePnLAttribution (
  458.             simulationPnLControl.stress().expectedShortfallConfidenceLevel()
  459.         );

  460.         Allocate (
  461.             capitalUnitArray,
  462.             capitalSegmentStandaloneMarginal,
  463.             new CapitalAllocationControl (
  464.                 true,
  465.                 null,
  466.                 proRataCategoryManager,
  467.                 proRataEntityCapitalAssignmentSettingMap
  468.             ),
  469.             new CapitalAllocationControl (
  470.                 false,
  471.                 null,
  472.                 proRataCategoryManager,
  473.                 proRataEntityCapitalAssignmentSettingMap
  474.             ),
  475.             new CapitalAllocationControl (
  476.                 false,
  477.                 null,
  478.                 fixedFloatFloatCategoryManager,
  479.                 fixedFloatFloatEntityCapitalAssignmentSettingMap
  480.             ),
  481.             new CapitalAllocationControl (
  482.                 false,
  483.                 null,
  484.                 fixedFloatCategoryManager,
  485.                 fixedFloatEntityCapitalAssignmentSettingMap
  486.             ),
  487.             new CapitalAllocationControl (
  488.                 false,
  489.                 null,
  490.                 floatFloatCategoryManager,
  491.                 floatFloatEntityCapitalAssignmentSettingMap
  492.             )
  493.         );

  494.         EnvManager.TerminateEnv();
  495.     }
  496. }