EQSettingsContainer21.java

  1. package org.drip.simm.equity;

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

  75. /**
  76.  * <i>EQSettingsContainer21</i> holds the ISDA SIMM 2.1 Equity Buckets and their Correlations. The References
  77.  * are:
  78.  *
  79.  * <br><br>
  80.  *  <ul>
  81.  *      <li>
  82.  *          Andersen, L. B. G., M. Pykhtin, and A. Sokol (2017): Credit Exposure in the Presence of Initial
  83.  *              Margin https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2806156 <b>eSSRN</b>
  84.  *      </li>
  85.  *      <li>
  86.  *          Albanese, C., S. Caenazzo, and O. Frankel (2017): Regression Sensitivities for Initial Margin
  87.  *              Calculations https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2763488 <b>eSSRN</b>
  88.  *      </li>
  89.  *      <li>
  90.  *          Anfuso, F., D. Aziz, P. Giltinan, and K. Loukopoulus (2017): A Sound Modeling and Back-testing
  91.  *              Framework for Forecasting Initial Margin Requirements
  92.  *                  https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2716279 <b>eSSRN</b>
  93.  *      </li>
  94.  *      <li>
  95.  *          Caspers, P., P. Giltinan, R. Lichters, and N. Nowaczyk (2017): Forecasting Initial Margin
  96.  *              Requirements - A Model Evaluation https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2911167
  97.  *                  <b>eSSRN</b>
  98.  *      </li>
  99.  *      <li>
  100.  *          International Swaps and Derivatives Association (2017): SIMM v2.0 Methodology
  101.  *              https://www.isda.org/a/oFiDE/isda-simm-v2.pdf
  102.  *      </li>
  103.  *  </ul>
  104.  *
  105.  * <br><br>
  106.  *  <ul>
  107.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/PortfolioCore.md">Portfolio Core Module</a></li>
  108.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/MarginAnalyticsLibrary.md">Initial and Variation Margin Analytics</a></li>
  109.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/simm/README.md">Initial Margin Analytics based on ISDA SIMM and its Variants</a></li>
  110.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/simm/equity/README.md">Equity Risk Factor Calibration Settings</a></li>
  111.  *  </ul>
  112.  * <br><br>
  113.  *
  114.  * @author Lakshmi Krishnamurthy
  115.  */

  116. public class EQSettingsContainer21
  117. {
  118.     private static org.drip.measure.stochastic.LabelCorrelation s_CrossBucketCorrelation = null;

  119.     private static final java.util.Map<java.lang.Integer, org.drip.simm.equity.EQBucket> s_BucketMap =
  120.         new java.util.TreeMap<java.lang.Integer, org.drip.simm.equity.EQBucket>();

  121.     private static final boolean SetUpCrossBucketCorrelation()
  122.     {
  123.         java.util.List<java.lang.String> bucketList = new java.util.ArrayList<java.lang.String>();

  124.         bucketList.add ("1");

  125.         bucketList.add ("2");

  126.         bucketList.add ("3");

  127.         bucketList.add ("4");

  128.         bucketList.add ("5");

  129.         bucketList.add ("6");

  130.         bucketList.add ("7");

  131.         bucketList.add ("8");

  132.         bucketList.add ("9");

  133.         bucketList.add ("10");

  134.         bucketList.add ("11");

  135.         bucketList.add ("12");

  136.         try
  137.         {
  138.             s_CrossBucketCorrelation = new org.drip.measure.stochastic.LabelCorrelation (
  139.                 bucketList,
  140.                 new double[][]
  141.                 {
  142.                     {1.00, 0.16, 0.16, 0.17, 0.13, 0.15, 0.15, 0.15, 0.13, 0.11, 0.19, 0.19}, // #01
  143.                     {0.16, 1.00, 0.20, 0.20, 0.14, 0.16, 0.16, 0.16, 0.15, 0.13, 0.20, 0.20}, // #02
  144.                     {0.16, 0.20, 1.00, 0.22, 0.15, 0.19, 0.22, 0.19, 0.16, 0.15, 0.25, 0.25}, // #03
  145.                     {0.17, 0.20, 0.22, 1.00, 0.17, 0.21, 0.21, 0.21, 0.17, 0.15, 0.27, 0.27}, // #04
  146.                     {0.13, 0.14, 0.15, 0.17, 1.00, 0.25, 0.23, 0.26, 0.14, 0.17, 0.32, 0.32}, // #05
  147.                     {0.15, 0.16, 0.19, 0.21, 0.25, 1.00, 0.30, 0.31, 0.16, 0.21, 0.38, 0.38}, // #06
  148.                     {0.15, 0.16, 0.22, 0.21, 0.23, 0.30, 1.00, 0.29, 0.16, 0.21, 0.38, 0.38}, // #07
  149.                     {0.15, 0.16, 0.19, 0.21, 0.26, 0.31, 0.29, 1.00, 0.17, 0.21, 0.39, 0.39}, // #08
  150.                     {0.13, 0.15, 0.16, 0.17, 0.14, 0.16, 0.16, 0.17, 1.00, 0.13, 0.21, 0.21}, // #09
  151.                     {0.11, 0.13, 0.15, 0.15, 0.17, 0.21, 0.21, 0.21, 0.13, 1.00, 0.25, 0.25}, // #10
  152.                     {0.19, 0.20, 0.25, 0.27, 0.32, 0.38, 0.38, 0.39, 0.21, 0.25, 1.00, 0.51}, // #11
  153.                     {0.19, 0.20, 0.25, 0.27, 0.32, 0.38, 0.38, 0.39, 0.21, 0.25, 0.51, 1.00}, // #12
  154.                 }
  155.             );

  156.             return true;
  157.         }
  158.         catch (java.lang.Exception e)
  159.         {
  160.             e.printStackTrace();
  161.         }

  162.         return false;
  163.     }

  164.     /**
  165.      * Initialize the Equity Settings Container
  166.      *
  167.      * @return TRUE - Equity Settings Container successfully initialized
  168.      */

  169.     public static final boolean Init()
  170.     {
  171.         try
  172.         {
  173.             s_BucketMap.put (
  174.                 -1,
  175.                 new org.drip.simm.equity.EQBucket (
  176.                     -1,
  177.                     org.drip.simm.equity.MarketCapitalizationSystemics.ALL,
  178.                     org.drip.simm.equity.RegionSystemics.ALL,
  179.                     org.drip.simm.credit.SectorSystemics.ALL,
  180.                     34.,
  181.                     0.00,
  182.                     0.63
  183.                 )
  184.             );

  185.             s_BucketMap.put (
  186.                 1,
  187.                 new org.drip.simm.equity.EQBucket (
  188.                     1,
  189.                     org.drip.simm.equity.MarketCapitalizationSystemics.LARGE,
  190.                     org.drip.simm.equity.RegionSystemics.EMERGING_MARKETS,
  191.                     org.drip.simm.credit.SectorSystemics.CONSUMER_SERVICES,
  192.                     24.,
  193.                     0.14,
  194.                     0.28
  195.                 )
  196.             );

  197.             s_BucketMap.put (
  198.                 2,
  199.                 new org.drip.simm.equity.EQBucket (
  200.                     2,
  201.                     org.drip.simm.equity.MarketCapitalizationSystemics.LARGE,
  202.                     org.drip.simm.equity.RegionSystemics.EMERGING_MARKETS,
  203.                     org.drip.simm.credit.SectorSystemics.TELECOMMUNICATIONS_INDUSTRIALS,
  204.                     30.,
  205.                     0.20,
  206.                     0.28
  207.                 )
  208.             );

  209.             s_BucketMap.put (
  210.                 3,
  211.                 new org.drip.simm.equity.EQBucket (
  212.                     3,
  213.                     org.drip.simm.equity.MarketCapitalizationSystemics.LARGE,
  214.                     org.drip.simm.equity.RegionSystemics.EMERGING_MARKETS,
  215.                     org.drip.simm.credit.SectorSystemics.HEAVY_INDUSTRIALS,
  216.                     31.,
  217.                     0.25,
  218.                     0.28
  219.                 )
  220.             );

  221.             s_BucketMap.put (
  222.                 4,
  223.                 new org.drip.simm.equity.EQBucket (
  224.                     4,
  225.                     org.drip.simm.equity.MarketCapitalizationSystemics.LARGE,
  226.                     org.drip.simm.equity.RegionSystemics.EMERGING_MARKETS,
  227.                     org.drip.simm.credit.SectorSystemics.INVESTMENT,
  228.                     25.,
  229.                     0.23,
  230.                     0.28
  231.                 )
  232.             );

  233.             s_BucketMap.put (
  234.                 5,
  235.                 new org.drip.simm.equity.EQBucket (
  236.                     5,
  237.                     org.drip.simm.equity.MarketCapitalizationSystemics.LARGE,
  238.                     org.drip.simm.equity.RegionSystemics.DEVELOPED_MARKETS,
  239.                     org.drip.simm.credit.SectorSystemics.CONSUMER_SERVICES,
  240.                     21.,
  241.                     0.23,
  242.                     0.28
  243.                 )
  244.             );

  245.             s_BucketMap.put (
  246.                 6,
  247.                 new org.drip.simm.equity.EQBucket (
  248.                     6,
  249.                     org.drip.simm.equity.MarketCapitalizationSystemics.LARGE,
  250.                     org.drip.simm.equity.RegionSystemics.DEVELOPED_MARKETS,
  251.                     org.drip.simm.credit.SectorSystemics.TELECOMMUNICATIONS_INDUSTRIALS,
  252.                     22.,
  253.                     0.32,
  254.                     0.28
  255.                 )
  256.             );

  257.             s_BucketMap.put (
  258.                 7,
  259.                 new org.drip.simm.equity.EQBucket (
  260.                     7,
  261.                     org.drip.simm.equity.MarketCapitalizationSystemics.LARGE,
  262.                     org.drip.simm.equity.RegionSystemics.DEVELOPED_MARKETS,
  263.                     org.drip.simm.credit.SectorSystemics.HEAVY_INDUSTRIALS,
  264.                     27.,
  265.                     0.35,
  266.                     0.28
  267.                 )
  268.             );

  269.             s_BucketMap.put (
  270.                 8,
  271.                 new org.drip.simm.equity.EQBucket (
  272.                     8,
  273.                     org.drip.simm.equity.MarketCapitalizationSystemics.LARGE,
  274.                     org.drip.simm.equity.RegionSystemics.DEVELOPED_MARKETS,
  275.                     org.drip.simm.credit.SectorSystemics.INVESTMENT,
  276.                     24.,
  277.                     0.32,
  278.                     0.28
  279.                 )
  280.             );

  281.             s_BucketMap.put (
  282.                 9,
  283.                 new org.drip.simm.equity.EQBucket (
  284.                     9,
  285.                     org.drip.simm.equity.MarketCapitalizationSystemics.SMALL,
  286.                     org.drip.simm.equity.RegionSystemics.EMERGING_MARKETS,
  287.                     org.drip.simm.credit.SectorSystemics.ALL,
  288.                     33.,
  289.                     0.17,
  290.                     0.28
  291.                 )
  292.             );

  293.             s_BucketMap.put (
  294.                 10,
  295.                 new org.drip.simm.equity.EQBucket (
  296.                     10,
  297.                     org.drip.simm.equity.MarketCapitalizationSystemics.SMALL,
  298.                     org.drip.simm.equity.RegionSystemics.DEVELOPED_MARKETS,
  299.                     org.drip.simm.credit.SectorSystemics.ALL,
  300.                     34.,
  301.                     0.16,
  302.                     0.28
  303.                 )
  304.             );

  305.             s_BucketMap.put (
  306.                 11,
  307.                 new org.drip.simm.equity.EQBucket (
  308.                     11,
  309.                     org.drip.simm.equity.MarketCapitalizationSystemics.ALL,
  310.                     org.drip.simm.equity.RegionSystemics.ALL,
  311.                     org.drip.simm.credit.SectorSystemics.INDEX_FUND_ETF,
  312.                     17.,
  313.                     0.51,
  314.                     0.28
  315.                 )
  316.             );

  317.             s_BucketMap.put (
  318.                 12,
  319.                 new org.drip.simm.equity.EQBucket (
  320.                     12,
  321.                     org.drip.simm.equity.MarketCapitalizationSystemics.ALL,
  322.                     org.drip.simm.equity.RegionSystemics.ALL,
  323.                     org.drip.simm.credit.SectorSystemics.VOLATILITY_INDEX,
  324.                     17.,
  325.                     0.51,
  326.                     0.28
  327.                 )
  328.             );
  329.         }
  330.         catch (java.lang.Exception e)
  331.         {
  332.             e.printStackTrace();

  333.             return false;
  334.         }

  335.         return SetUpCrossBucketCorrelation();
  336.     }

  337.     /**
  338.      * Retrieve the Set of Bucket Indexes available
  339.      *
  340.      * @return The Set of Bucket Indexes available
  341.      */

  342.     public static final java.util.Set<java.lang.Integer> BucketSet()
  343.     {
  344.         return s_BucketMap.keySet();
  345.     }

  346.     /**
  347.      * Indicate if the Bucket denoted by the Number is available
  348.      *
  349.      * @param bucketNumber The Bucket Number
  350.      *
  351.      * @return TRUE - The Bucket denoted by the Number is available
  352.      */

  353.     public static final boolean ContainsBucket (
  354.         final int bucketNumber)
  355.     {
  356.         return s_BucketMap.containsKey (bucketNumber);
  357.     }

  358.     /**
  359.      * Retrieve the Bucket denoted by the Number
  360.      *
  361.      * @param bucketNumber The Bucket Number
  362.      *
  363.      * @return The Bucket denoted by the Number
  364.      */

  365.     public static final org.drip.simm.equity.EQBucket Bucket (
  366.         final int bucketNumber)
  367.     {
  368.         return ContainsBucket (bucketNumber) ? s_BucketMap.get (bucketNumber) : null;
  369.     }

  370.     /**
  371.      * Retrieve the Cross Bucket Correlation
  372.      *
  373.      * @return The Cross Bucket Correlation
  374.      */

  375.     public static final org.drip.measure.stochastic.LabelCorrelation CrossBucketCorrelation()
  376.     {
  377.         return s_CrossBucketCorrelation;
  378.     }

  379.     /**
  380.      * Retrieve the Bucket Map
  381.      *
  382.      * @return The Bucket Map
  383.      */

  384.     public static final java.util.Map<java.lang.Integer, org.drip.simm.equity.EQBucket> BucketMap()
  385.     {
  386.         return s_BucketMap;
  387.     }

  388.     /**
  389.      * Retrieve the Cross Bucket Co-variance Matrix
  390.      *
  391.      * @return The Cross Bucket Co-variance Matrix
  392.      */

  393.     public static final org.drip.simm.foundation.RiskGroupPrincipalCovariance CrossBucketPrincipalCovariance()
  394.     {
  395.         return org.drip.simm.foundation.RiskGroupPrincipalCovariance.Standard (
  396.             s_CrossBucketCorrelation.matrix(),
  397.             1.
  398.         );
  399.     }
  400. }