BalanceSheetCapital.java

  1. package org.drip.capital.bcbs;

  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>BalanceSheetCapital</i> holds the Quantities used to compute the Capital Compliance Ratios in the BCBS
  76.  * Standards. The References are:
  77.  *  
  78.  * <br><br>
  79.  *  <ul>
  80.  *      <li>
  81.  *          Basel Committee on Banking Supervision (2017): Basel III Leverage Ratio Framework and Disclosure
  82.  *              Requirements https://www.bis.org/publ/bcbs270.pdf
  83.  *      </li>
  84.  *      <li>
  85.  *          Central Banking (2013): Fed and FDIC agree 6% Leverage Ratio for US SIFIs
  86.  *              https://www.centralbanking.com/central-banking/news/2280726/fed-and-fdic-agree-6-leverage-ratio-for-us-sifis
  87.  *      </li>
  88.  *      <li>
  89.  *          European Banking Agency (2013): Implementing Basel III in Europe: CRD IV Package
  90.  *              https://eba.europa.eu/regulation-and-policy/implementing-basel-iii-europe
  91.  *      </li>
  92.  *      <li>
  93.  *          Federal Reserve (2013): Liquidity Coverage Ratio – Liquidity Risk Measurements, Standards, and
  94.  *              Monitoring
  95.  *              https://web.archive.org/web/20131102074614/http:/www.federalreserve.gov/FR_notice_lcr_20131024.pdf
  96.  *      </li>
  97.  *      <li>
  98.  *          Wikipedia (2018): Basel III https://en.wikipedia.org/wiki/Basel_III
  99.  *      </li>
  100.  *  </ul>
  101.  *
  102.  *  <br><br>
  103.  *  <ul>
  104.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/PortfolioCore.md">Portfolio Core Module</a></li>
  105.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/CapitalAnalyticsLibrary.md">Capital Analytics</a></li>
  106.  *      <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>
  107.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/capital/bcbs/README.md">BCBS and Jurisdictional Capital Ratios</a></li>
  108.  *  </ul>
  109.  *
  110.  * @author Lakshmi Krishnamurthy
  111.  */

  112. public class BalanceSheetCapital
  113. {
  114.     private double _at1 = java.lang.Double.NaN;
  115.     private double _rwa = java.lang.Double.NaN;
  116.     private double _cet1 = java.lang.Double.NaN;
  117.     private double _totalExposure = java.lang.Double.NaN;
  118.     private double _additionalCapital = java.lang.Double.NaN;

  119.     /**
  120.      * BalanceSheetCapital Constructor
  121.      *
  122.      * @param cet1 Common Equity Tier 1 Capital
  123.      * @param at1 Additional Tier 1 Capital
  124.      * @param additionalCapital Additional Capital
  125.      * @param rwa Risk Weighted Assets
  126.      * @param totalExposure Total Exposure
  127.      *
  128.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  129.      */

  130.     public BalanceSheetCapital (
  131.         final double cet1,
  132.         final double at1,
  133.         final double additionalCapital,
  134.         final double rwa,
  135.         final double totalExposure)
  136.         throws java.lang.Exception
  137.     {
  138.         if (!org.drip.numerical.common.NumberUtil.IsValid (_cet1 = cet1) || 0. > _cet1 ||
  139.             !org.drip.numerical.common.NumberUtil.IsValid (_at1 = at1) || 0. > _at1 ||
  140.             !org.drip.numerical.common.NumberUtil.IsValid (_additionalCapital = additionalCapital) ||
  141.                 0. > _additionalCapital ||
  142.             !org.drip.numerical.common.NumberUtil.IsValid (_rwa = rwa) || 0. > _rwa ||
  143.             !org.drip.numerical.common.NumberUtil.IsValid (_totalExposure = totalExposure) ||
  144.                 0. > _totalExposure)
  145.         {
  146.             throw new java.lang.Exception ("BalanceSheetCapital Constructor => Invalid Inputs");
  147.         }
  148.     }

  149.     /**
  150.      * Retrieve the Common Equity Tier 1 Capital
  151.      *
  152.      * @return The Common Equity Tier 1 Capital
  153.      */

  154.     public double commonEquityTier1()
  155.     {
  156.         return _cet1;
  157.     }

  158.     /**
  159.      * Retrieve the Additional Tier 1 Capital
  160.      *
  161.      * @return The Additional Tier 1 Capital
  162.      */

  163.     public double additionalTier1()
  164.     {
  165.         return _at1;
  166.     }

  167.     /**
  168.      * Retrieve the Additional Capital
  169.      *
  170.      * @return The Additional Capital
  171.      */

  172.     public double additionalCapital()
  173.     {
  174.         return _additionalCapital;
  175.     }

  176.     /**
  177.      * Retrieve the Risk Weighted Assets
  178.      *
  179.      * @return The Risk Weighted Assets
  180.      */

  181.     public double riskWeightedAssets()
  182.     {
  183.         return _rwa;
  184.     }

  185.     /**
  186.      * Retrieve the Total Exposure
  187.      *
  188.      * @return The Total Exposure
  189.      */

  190.     public double totalExposure()
  191.     {
  192.         return _totalExposure;
  193.     }

  194.     /**
  195.      * Retrieve the Tier 1 Capital
  196.      *
  197.      * @return The Tier 1 Capital
  198.      */

  199.     public double tier1()
  200.     {
  201.         return _cet1 + _at1;
  202.     }

  203.     /**
  204.      * Retrieve the Total Capital
  205.      *
  206.      * @return The Total Capital
  207.      */

  208.     public double totalCapital()
  209.     {
  210.         return _cet1 + _at1 + _additionalCapital;
  211.     }

  212.     /**
  213.      * Retrieve the CET 1 Ratio
  214.      *
  215.      * @return The CET 1 Ratio
  216.      */

  217.     public double cet1Ratio()
  218.     {
  219.         return _cet1 / _rwa;
  220.     }

  221.     /**
  222.      * Retrieve the Tier 1 Ratio
  223.      *
  224.      * @return The Tier 1 Ratio
  225.      */

  226.     public double tier1Ratio()
  227.     {
  228.         return (_cet1 + _at1) / _rwa;
  229.     }

  230.     /**
  231.      * Retrieve the Total Capital Ratio
  232.      *
  233.      * @return The Total Capital Ratio
  234.      */

  235.     public double totalCapitalRatio()
  236.     {
  237.         return (_cet1 + _at1 + _additionalCapital) / _rwa;
  238.     }

  239.     /**
  240.      * Retrieve the Leverage Ratio
  241.      *
  242.      * @return The Leverage Ratio
  243.      */

  244.     public double leverageRatio()
  245.     {
  246.         return (_cet1 + _at1) / _totalExposure;
  247.     }

  248.     /**
  249.      * Generate the Balance Sheet Capital Metrics
  250.      *
  251.      * @return The Balance Sheet Capital Metrics
  252.      */

  253.     public org.drip.capital.bcbs.CapitalMetrics capitalMetrics()
  254.     {
  255.         double commonEquityCapitalRatio = _cet1 / _rwa;
  256.         double totalCapitalRatio = (_cet1 + _at1 + _additionalCapital) / _rwa;

  257.         try
  258.         {
  259.             return new org.drip.capital.bcbs.CapitalMetrics (
  260.                 (_cet1 + _at1) / _totalExposure,
  261.                 commonEquityCapitalRatio,
  262.                 commonEquityCapitalRatio,
  263.                 (_cet1 + _at1) / _rwa,
  264.                 totalCapitalRatio,
  265.                 totalCapitalRatio
  266.             );
  267.         }
  268.         catch (java.lang.Exception e)
  269.         {
  270.             e.printStackTrace();
  271.         }

  272.         return null;
  273.     }
  274. }