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

  111. public class CapitalMetrics
  112. {
  113.     private double _tier1Ratio = java.lang.Double.NaN;
  114.     private double _totalRatio = java.lang.Double.NaN;
  115.     private double _leverageRatio = java.lang.Double.NaN;
  116.     private double _commonEquityRatio = java.lang.Double.NaN;
  117.     private double _totalPlusConservationBufferRatio = java.lang.Double.NaN;
  118.     private double _commonEquityPlusConservationBufferRatio = java.lang.Double.NaN;

  119.     /**
  120.      * CapitalMetrics Constructor
  121.      *
  122.      * @param leverageRatio Leverage Ratio
  123.      * @param commonEquityRatio Common Equity Capital Ratio
  124.      * @param commonEquityPlusConservationBufferRatio Common Equity Capital Plus Capital Conservation Buffer
  125.      *      Ratio
  126.      * @param tier1Ratio Tier 1 Capital Ratio
  127.      * @param totalRatio Total Capital Ratio
  128.      * @param totalPlusConservationBufferRatio Total Capital Plus Conservation Buffer Ratio
  129.      *
  130.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  131.      */

  132.     public CapitalMetrics (
  133.         final double leverageRatio,
  134.         final double commonEquityRatio,
  135.         final double commonEquityPlusConservationBufferRatio,
  136.         final double tier1Ratio,
  137.         final double totalRatio,
  138.         final double totalPlusConservationBufferRatio)
  139.         throws java.lang.Exception
  140.     {
  141.         if (!org.drip.numerical.common.NumberUtil.IsValid (_leverageRatio = leverageRatio) ||
  142.                 0. > _leverageRatio ||
  143.             !org.drip.numerical.common.NumberUtil.IsValid (_commonEquityRatio = commonEquityRatio) ||
  144.                 0. > _commonEquityRatio ||
  145.             !org.drip.numerical.common.NumberUtil.IsValid (_commonEquityPlusConservationBufferRatio =
  146.                 commonEquityPlusConservationBufferRatio) || 0. > _commonEquityPlusConservationBufferRatio ||
  147.             !org.drip.numerical.common.NumberUtil.IsValid (_tier1Ratio = tier1Ratio) || 0. > _tier1Ratio ||
  148.             !org.drip.numerical.common.NumberUtil.IsValid (_totalRatio = totalRatio) || 0. > _totalRatio ||
  149.             !org.drip.numerical.common.NumberUtil.IsValid (_totalPlusConservationBufferRatio =
  150.                 totalPlusConservationBufferRatio) || 0. > _totalPlusConservationBufferRatio)
  151.         {
  152.             throw new java.lang.Exception ("CapitalMetrics Contructor => Invalid Inputs");
  153.         }
  154.     }

  155.     /**
  156.      * Retrieve the Leverage Ratio
  157.      *
  158.      * @return The Leverage Ratio
  159.      */

  160.     public double leverageRatio()
  161.     {
  162.         return _leverageRatio;
  163.     }

  164.     /**
  165.      * Retrieve the Common Equity Capital Ratio
  166.      *
  167.      * @return The Common Equity Capital Ratio
  168.      */

  169.     public double commonEquityRatio()
  170.     {
  171.         return _commonEquityRatio;
  172.     }

  173.     /**
  174.      * Retrieve the Capital Conservation Buffer Ratio
  175.      *
  176.      * @return The Capital Conservation Buffer Ratio
  177.      */

  178.     public double conservationBufferRatio()
  179.     {
  180.         return _commonEquityPlusConservationBufferRatio - _commonEquityRatio;
  181.     }

  182.     /**
  183.      * Retrieve the Common Equity Capital Plus Capital Conservation Buffer Ratio
  184.      *
  185.      * @return The Common Equity Capital Plus Capital Conservation Buffer Ratio
  186.      */

  187.     public double commonEquityPlusConservationBufferRatio()
  188.     {
  189.         return _commonEquityPlusConservationBufferRatio;
  190.     }

  191.     /**
  192.      * Retrieve the Tier 1 Capital Ratio
  193.      *
  194.      * @return The Tier 1 Capital Ratio
  195.      */

  196.     public double tier1Ratio()
  197.     {
  198.         return _tier1Ratio;
  199.     }

  200.     /**
  201.      * Retrieve the Total Capital Ratio
  202.      *
  203.      * @return The Total Capital Ratio
  204.      */

  205.     public double totalRatio()
  206.     {
  207.         return _totalRatio;
  208.     }

  209.     /**
  210.      * Retrieve the Total Capital Plus Conservation Buffer Ratio
  211.      *
  212.      * @return The Total Capital Plus Conservation Buffer Ratio
  213.      */

  214.     public double totalPlusConservationBufferRatio()
  215.     {
  216.         return _totalPlusConservationBufferRatio;
  217.     }

  218.     /**
  219.      * Verify if the Capital Metrics are Compliant with the Standard
  220.      *
  221.      * @param capitalMetricsStandard The Capital Metrics Standard
  222.      *
  223.      * @return TRUE - The Capital Metrics are Compliant with the Standard
  224.      */

  225.     public boolean isCompliant (
  226.         final org.drip.capital.bcbs.CapitalMetrics capitalMetricsStandard)
  227.     {
  228.         return null == capitalMetricsStandard ? false :
  229.             _leverageRatio >= capitalMetricsStandard.leverageRatio() &&
  230.             _commonEquityRatio >= capitalMetricsStandard.commonEquityRatio() &&
  231.             _commonEquityPlusConservationBufferRatio >=
  232.                 capitalMetricsStandard.commonEquityPlusConservationBufferRatio() &&
  233.             _tier1Ratio >= capitalMetricsStandard.tier1Ratio() &&
  234.             _totalRatio >= capitalMetricsStandard.totalRatio() &&
  235.             _totalPlusConservationBufferRatio >= capitalMetricsStandard.totalPlusConservationBufferRatio();
  236.     }
  237. }