EntityCapitalAssignmentSetting.java

  1. package org.drip.capital.allocation;

  2. /*
  3.  * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  4.  */

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

  74. /**
  75.  * <i>EntityCapitalAssignmentSetting</i> holds the Correlation Elasticities for the different Capital
  76.  *  Components as well as the Entity's Correlation Category. The References are:
  77.  *
  78.  * <br><br>
  79.  *  <ul>
  80.  *      <li>
  81.  *          Bank for International Supervision(2005): Stress Testing at Major Financial Institutions: Survey
  82.  *              Results and Practice https://www.bis.org/publ/cgfs24.htm
  83.  *      </li>
  84.  *      <li>
  85.  *          Glasserman, P. (2004): <i>Monte Carlo Methods in Financial Engineering</i> <b>Springer</b>
  86.  *      </li>
  87.  *      <li>
  88.  *          Kupiec, P. H. (2000): Stress Tests and Risk Capital <i>Risk</i> <b>2 (4)</b> 27-39
  89.  *      </li>
  90.  *  </ul>
  91.  *
  92.  *  <br><br>
  93.  *  <ul>
  94.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/PortfolioCore.md">Portfolio Core Module</a></li>
  95.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/CapitalAnalyticsLibrary.md">Capital Analytics</a></li>
  96.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/capital/README.md">Basel Market Risk and Operational Capital</a></li>
  97.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/capital/allocation/README.md">Economic Risk Capital Entity Allocation</a></li>
  98.  *  </ul>
  99.  *
  100.  * @author Lakshmi Krishnamurthy
  101.  */

  102. public class EntityCapitalAssignmentSetting
  103. {
  104.     private int _noStressAllocationScheme = java.lang.Integer.MIN_VALUE;
  105.     private int _systemicAllocationScheme = java.lang.Integer.MIN_VALUE;
  106.     private int _noStressAllocationCategory = java.lang.Integer.MIN_VALUE;
  107.     private int _correlatedAllocationScheme = java.lang.Integer.MIN_VALUE;
  108.     private int _systemicAllocationCategory = java.lang.Integer.MIN_VALUE;
  109.     private int _correlatedAllocationCategory = java.lang.Integer.MIN_VALUE;
  110.     private int _allocationCorrelationCategory = java.lang.Integer.MIN_VALUE;
  111.     private int _idiosyncraticAllocationScheme = java.lang.Integer.MIN_VALUE;
  112.     private int _idiosyncraticAllocationCategory = java.lang.Integer.MIN_VALUE;

  113.     /**
  114.      * Construct the Uniform Beta Instance of EntityCapitalAssignmentSetting
  115.      *
  116.      * @param allocationCorrelationCategory Allocation Correlation Category of the Capital Entity
  117.      * @param noStressAllocationCategory Allocation Category for the "No-Stress" Capital Component
  118.      * @param systemicAllocationCategory Allocation Category for the Systemic Capital Component
  119.      * @param correlatedAllocationCategory Allocation Category for the Correlated Capital Component
  120.      * @param idiosyncraticAllocationCategory Allocation Category for the Idiosyncratic Capital Component
  121.      *
  122.      * @return Uniform Beta Instance of EntityCapitalAssignmentSetting
  123.      */

  124.     public static final EntityCapitalAssignmentSetting UniformBeta (
  125.         final int allocationCorrelationCategory,
  126.         final int noStressAllocationCategory,
  127.         final int systemicAllocationCategory,
  128.         final int correlatedAllocationCategory,
  129.         final int idiosyncraticAllocationCategory)
  130.     {
  131.         try
  132.         {
  133.             return new EntityCapitalAssignmentSetting (
  134.                 allocationCorrelationCategory,
  135.                 noStressAllocationCategory,
  136.                 org.drip.capital.allocation.EntityComponentAssignmentScheme.BETA,
  137.                 systemicAllocationCategory,
  138.                 org.drip.capital.allocation.EntityComponentAssignmentScheme.BETA,
  139.                 correlatedAllocationCategory,
  140.                 org.drip.capital.allocation.EntityComponentAssignmentScheme.BETA,
  141.                 idiosyncraticAllocationCategory,
  142.                 org.drip.capital.allocation.EntityComponentAssignmentScheme.BETA
  143.             );
  144.         }
  145.         catch (java.lang.Exception e)
  146.         {
  147.             e.printStackTrace();
  148.         }

  149.         return null;
  150.     }

  151.     /**
  152.      * Construct the Idiosyncratic Pro-Rata + Others Beta Instance of EntityCapitalAssignmentSetting
  153.      *
  154.      * @param allocationCorrelationCategory Allocation Correlation Category of the Capital Entity
  155.      * @param noStressAllocationCategory Allocation Category for the "No-Stress" Capital Component
  156.      * @param systemicAllocationCategory Allocation Category for the Systemic Capital Component
  157.      * @param correlatedAllocationCategory Allocation Category for the Correlated Capital Component
  158.      * @param idiosyncraticAllocationCategory Allocation Category for the Idiosyncratic Capital Component
  159.      *
  160.      * @return Idiosyncratic Pro-Rata + Others Beta Instance of EntityCapitalAssignmentSetting
  161.      */

  162.     public static final EntityCapitalAssignmentSetting UniformBetaIdiosyncraticProRata (
  163.         final int allocationCorrelationCategory,
  164.         final int noStressAllocationCategory,
  165.         final int systemicAllocationCategory,
  166.         final int correlatedAllocationCategory,
  167.         final int idiosyncraticAllocationCategory)
  168.     {
  169.         try
  170.         {
  171.             return new EntityCapitalAssignmentSetting (
  172.                 allocationCorrelationCategory,
  173.                 noStressAllocationCategory,
  174.                 org.drip.capital.allocation.EntityComponentAssignmentScheme.BETA,
  175.                 systemicAllocationCategory,
  176.                 org.drip.capital.allocation.EntityComponentAssignmentScheme.BETA,
  177.                 correlatedAllocationCategory,
  178.                 org.drip.capital.allocation.EntityComponentAssignmentScheme.BETA,
  179.                 idiosyncraticAllocationCategory,
  180.                 org.drip.capital.allocation.EntityComponentAssignmentScheme.PRO_RATA
  181.             );
  182.         }
  183.         catch (java.lang.Exception e)
  184.         {
  185.             e.printStackTrace();
  186.         }

  187.         return null;
  188.     }

  189.     /**
  190.      * EntityCapitalAssignmentSetting Constructor
  191.      *
  192.      * @param allocationCorrelationCategory Allocation Correlation Category of the Capital Entity
  193.      * @param noStressAllocationCategory Allocation Category for the "No-Stress" Capital Component
  194.      * @param noStressAllocationScheme Allocation Scheme for the "No-Stress" Capital Component
  195.      * @param systemicAllocationCategory Allocation Category for the Systemic Capital Component
  196.      * @param gsstAllocationScheme Allocation Scheme for the Systemic Capital Component
  197.      * @param correlatedAllocationCategory Allocation Category for the Correlated Capital Component
  198.      * @param correlatedAllocationScheme Allocation Scheme for the Correlated Capital Component
  199.      * @param idiosyncraticAllocationCategory Allocation Category for the Idiosyncratic Capital Component
  200.      * @param idiosyncraticAllocationScheme Allocation Scheme for the Idiosyncratic Capital Component
  201.      *
  202.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  203.      */

  204.     public EntityCapitalAssignmentSetting (
  205.         final int allocationCorrelationCategory,
  206.         final int noStressAllocationCategory,
  207.         final int noStressAllocationScheme,
  208.         final int systemicAllocationCategory,
  209.         final int gsstAllocationScheme,
  210.         final int correlatedAllocationCategory,
  211.         final int correlatedAllocationScheme,
  212.         final int idiosyncraticAllocationCategory,
  213.         final int idiosyncraticAllocationScheme)
  214.         throws java.lang.Exception
  215.     {
  216.         if (java.lang.Integer.MIN_VALUE == (
  217.                 _allocationCorrelationCategory = allocationCorrelationCategory
  218.             ) || java.lang.Integer.MIN_VALUE == (
  219.                 _noStressAllocationCategory = noStressAllocationCategory
  220.             ) || java.lang.Integer.MIN_VALUE == (
  221.                 _noStressAllocationScheme = noStressAllocationScheme
  222.             ) || java.lang.Integer.MIN_VALUE == (
  223.                 _systemicAllocationCategory = systemicAllocationCategory
  224.             ) || java.lang.Integer.MIN_VALUE == (
  225.                 _systemicAllocationScheme = gsstAllocationScheme
  226.             ) || java.lang.Integer.MIN_VALUE == (
  227.                 _correlatedAllocationCategory = correlatedAllocationCategory
  228.             ) || java.lang.Integer.MIN_VALUE == (
  229.                 _correlatedAllocationScheme = correlatedAllocationScheme
  230.             ) || java.lang.Integer.MIN_VALUE == (
  231.                 _idiosyncraticAllocationCategory = idiosyncraticAllocationCategory
  232.             ) || java.lang.Integer.MIN_VALUE == (
  233.                 _idiosyncraticAllocationScheme = idiosyncraticAllocationScheme
  234.             ) || org.drip.capital.allocation.EntityComponentCorrelationCategory.ENTITY_CORRELATION ==
  235.                 _allocationCorrelationCategory
  236.         )
  237.         {
  238.             throw new java.lang.Exception (
  239.                 "EntityCapitalAssignmentSetting Constructor => Invalid Inputs"
  240.             );
  241.         }
  242.     }

  243.     /**
  244.      * Retrieve the Allocation Correlation Category of the Capital Entity
  245.      *
  246.      * @return TRUE - The Allocation Correlation Category of the Capital Entity
  247.      */

  248.     public int allocationCorrelationCategory()
  249.     {
  250.         return _allocationCorrelationCategory;
  251.     }

  252.     /**
  253.      * Retrieve the Allocation Category for the "No-Stress" Capital Component
  254.      *
  255.      * @return The Allocation Category for the "No-Stress" Capital Component
  256.      */

  257.     public int noStressAllocationCategory()
  258.     {
  259.         if (org.drip.capital.allocation.EntityComponentAssignmentScheme.BETA == _noStressAllocationScheme
  260.             && org.drip.capital.allocation.EntityComponentCorrelationCategory.ENTITY_CORRELATION ==
  261.                 _noStressAllocationCategory)
  262.         {
  263.             return _allocationCorrelationCategory;
  264.         }

  265.         return _noStressAllocationCategory;
  266.     }

  267.     /**
  268.      * Retrieve the Allocation Scheme for the "No-Stress" Capital Component
  269.      *
  270.      * @return The Elasticity for the "No-Stress" Capital Component
  271.      */

  272.     public int noStressAllocationScheme()
  273.     {
  274.         return _noStressAllocationScheme;
  275.     }

  276.     /**
  277.      * Retrieve the Systemic Allocation Category of the Capital Entity
  278.      *
  279.      * @return TRUE - The Systemic Allocation Category of the Capital Entity
  280.      */

  281.     public int systemicAllocationCategory()
  282.     {
  283.         if (org.drip.capital.allocation.EntityComponentAssignmentScheme.BETA == _systemicAllocationScheme &&
  284.             org.drip.capital.allocation.EntityComponentCorrelationCategory.ENTITY_CORRELATION ==
  285.                 _systemicAllocationCategory)
  286.         {
  287.             return _allocationCorrelationCategory;
  288.         }

  289.         return _systemicAllocationCategory;
  290.     }

  291.     /**
  292.      * Retrieve the Allocation Scheme for the Systemic Capital Component
  293.      *
  294.      * @return The Allocation Scheme for the Systemic Capital Component
  295.      */

  296.     public int systemicAllocationScheme()
  297.     {
  298.         return _systemicAllocationScheme;
  299.     }

  300.     /**
  301.      * Retrieve the Allocation Category for the Correlated Capital Component
  302.      *
  303.      * @return The Allocation Category for the Correlated Capital Component
  304.      */

  305.     public int correlatedAllocationCategory()
  306.     {
  307.         if (org.drip.capital.allocation.EntityComponentAssignmentScheme.BETA == _correlatedAllocationScheme
  308.             && org.drip.capital.allocation.EntityComponentCorrelationCategory.ENTITY_CORRELATION ==
  309.                 _correlatedAllocationCategory)
  310.         {
  311.             return _allocationCorrelationCategory;
  312.         }

  313.         return _correlatedAllocationCategory;
  314.     }

  315.     /**
  316.      * Retrieve the Allocation Scheme for the Correlated Capital Component
  317.      *
  318.      * @return The Allocation Scheme for the Correlated Capital Component
  319.      */

  320.     public int correlatedAllocationScheme()
  321.     {
  322.         return _correlatedAllocationScheme;
  323.     }

  324.     /**
  325.      * Retrieve the Allocation Category for the Idiosyncratic Capital Component
  326.      *
  327.      * @return The Allocation Category for the Idiosyncratic Capital Component
  328.      */

  329.     public int idiosyncraticAllocationCategory()
  330.     {
  331.         if (org.drip.capital.allocation.EntityComponentAssignmentScheme.BETA ==
  332.                 _idiosyncraticAllocationScheme &&
  333.             org.drip.capital.allocation.EntityComponentCorrelationCategory.ENTITY_CORRELATION ==
  334.                 _idiosyncraticAllocationCategory)
  335.         {
  336.             return _allocationCorrelationCategory;
  337.         }

  338.         return _idiosyncraticAllocationCategory;
  339.     }

  340.     /**
  341.      * Retrieve the Allocation Scheme for the Idiosyncratic Capital Component
  342.      *
  343.      * @return The Allocation Scheme for the Idiosyncratic Capital Component
  344.      */

  345.     public int idiosyncraticAllocationScheme()
  346.     {
  347.         return _idiosyncraticAllocationScheme;
  348.     }
  349. }