LiquidityMetrics.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>LiquidityMetrics</i> holds the Realized Liquidity 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 LiquidityMetrics
  112. {
  113.     private double _netStableFundingRatio = java.lang.Double.NaN;
  114.     private double _liquidityCoverageRatio = java.lang.Double.NaN;

  115.     /**
  116.      * Construct the Basel III 2015 Version of the Liquidity Metrics Standard
  117.      *
  118.      * @return The Basel III 2015 Version of the Liquidity Metrics Standard
  119.      */

  120.     public static final LiquidityMetrics Basel_III_2015()
  121.     {
  122.         try
  123.         {
  124.             return new LiquidityMetrics (
  125.                 0.60,
  126.                 0.00
  127.             );
  128.         }
  129.         catch (java.lang.Exception e)
  130.         {
  131.             e.printStackTrace();
  132.         }

  133.         return null;
  134.     }

  135.     /**
  136.      * Construct the Basel III 2016 Version of the Liquidity Metrics Standard
  137.      *
  138.      * @return The Basel III 2016 Version of the Liquidity Metrics Standard
  139.      */

  140.     public static final LiquidityMetrics Basel_III_2016()
  141.     {
  142.         try
  143.         {
  144.             return new LiquidityMetrics (
  145.                 0.70,
  146.                 0.00
  147.             );
  148.         }
  149.         catch (java.lang.Exception e)
  150.         {
  151.             e.printStackTrace();
  152.         }

  153.         return null;
  154.     }

  155.     /**
  156.      * Construct the Basel III 2017 Version of the Liquidity Metrics Standard
  157.      *
  158.      * @return The Basel III 2017 Version of the Liquidity Metrics Standard
  159.      */

  160.     public static final LiquidityMetrics Basel_III_2017()
  161.     {
  162.         try
  163.         {
  164.             return new LiquidityMetrics (
  165.                 0.80,
  166.                 0.00
  167.             );
  168.         }
  169.         catch (java.lang.Exception e)
  170.         {
  171.             e.printStackTrace();
  172.         }

  173.         return null;
  174.     }

  175.     /**
  176.      * Construct the Basel III 2018 Version of the Liquidity Metrics Standard
  177.      *
  178.      * @return The Basel III 2018 Version of the Liquidity Metrics Standard
  179.      */

  180.     public static final LiquidityMetrics Basel_III_2018()
  181.     {
  182.         try
  183.         {
  184.             return new LiquidityMetrics (
  185.                 0.90,
  186.                 1.00
  187.             );
  188.         }
  189.         catch (java.lang.Exception e)
  190.         {
  191.             e.printStackTrace();
  192.         }

  193.         return null;
  194.     }

  195.     /**
  196.      * Construct the Basel III 2019 Version of the Liquidity Metrics Standard
  197.      *
  198.      * @return The Basel III 2019 Version of the Liquidity Metrics Standard
  199.      */

  200.     public static final LiquidityMetrics Basel_III_2019()
  201.     {
  202.         try
  203.         {
  204.             return new LiquidityMetrics (
  205.                 1.00,
  206.                 1.00
  207.             );
  208.         }
  209.         catch (java.lang.Exception e)
  210.         {
  211.             e.printStackTrace();
  212.         }

  213.         return null;
  214.     }

  215.     /**
  216.      * LiquidityMetrics Constructor
  217.      *
  218.      * @param liquidityCoverageRatio The Liquidity Coverage Ratio
  219.      * @param netStableFundingRatio The Net Stable Funding Ratio
  220.      *
  221.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  222.      */

  223.     public LiquidityMetrics (
  224.         final double liquidityCoverageRatio,
  225.         final double netStableFundingRatio)
  226.         throws java.lang.Exception
  227.     {
  228.         if (!org.drip.numerical.common.NumberUtil.IsValid (_liquidityCoverageRatio = liquidityCoverageRatio) ||
  229.                 0. > _liquidityCoverageRatio ||
  230.             !org.drip.numerical.common.NumberUtil.IsValid (_netStableFundingRatio = netStableFundingRatio) ||
  231.                 0. > _netStableFundingRatio)
  232.         {
  233.             throw new java.lang.Exception ("LiquidityMetrics Constructor => Invalid Inputs");
  234.         }
  235.     }

  236.     /**
  237.      * Retrieve the Liquidity Coverage Ratio
  238.      *
  239.      * @return The Liquidity Coverage Ratio
  240.      */

  241.     public double liquidityCoverageRatio()
  242.     {
  243.         return _liquidityCoverageRatio;
  244.     }

  245.     /**
  246.      * Retrieve the Net Stable Funding Ratio
  247.      *
  248.      * @return The Net Stable Funding Ratio
  249.      */

  250.     public double netStableFundingRatio()
  251.     {
  252.         return _netStableFundingRatio;
  253.     }

  254.     /**
  255.      * Verify if the Liquidity Metrics are Compliant with the Standard
  256.      *
  257.      * @param liquidityMetricsStandard The Liquidity Metrics Standard
  258.      *
  259.      * @return TRUE - The Liquidity Metrics are Compliant with the Standard
  260.      */

  261.     public boolean isCompliant (
  262.         final org.drip.capital.bcbs.LiquidityMetrics liquidityMetricsStandard)
  263.     {
  264.         if (null == liquidityMetricsStandard)
  265.         {
  266.             return false;
  267.         }

  268.         return _liquidityCoverageRatio >= liquidityMetricsStandard.liquidityCoverageRatio() &&
  269.             _netStableFundingRatio >= liquidityMetricsStandard.netStableFundingRatio();
  270.     }
  271. }