HighQualityLiquidAssetCompliance.java

  1. package org.drip.sample.bcbs;

  2. import org.drip.capital.bcbs.HighQualityLiquidAsset;
  3. import org.drip.capital.bcbs.HighQualityLiquidAssetSettings;
  4. import org.drip.capital.bcbs.HighQualityLiquidAssetStandard;
  5. import org.drip.numerical.common.FormatUtil;
  6. import org.drip.service.env.EnvManager;

  7. /*
  8.  * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  9.  */

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

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

  117. public class HighQualityLiquidAssetCompliance
  118. {

  119.     public static final void main (
  120.         final String[] argumentArray)
  121.         throws Exception
  122.     {
  123.         EnvManager.InitEnv ("");

  124.         HighQualityLiquidAssetStandard hqlaStandardFed = HighQualityLiquidAssetStandard.FederalReserve();

  125.         HighQualityLiquidAssetSettings hqlaSettings =
  126.             HighQualityLiquidAssetSettings.FederalReserveStandard();

  127.         double level1 = 60.;
  128.         double level2A = 25.;
  129.         double level2B = 15.;

  130.         HighQualityLiquidAsset hqla = new HighQualityLiquidAsset (
  131.             level1,
  132.             level2A,
  133.             level2B
  134.         );

  135.         System.out.println ("\t|-------------------------|");

  136.         System.out.println ("\t| HQLA Compliance Ratios  |");

  137.         System.out.println ("\t|-------------------------|");

  138.         System.out.println ("\t| Level 2 Ratio  => " +
  139.             FormatUtil.FormatDouble (hqlaStandardFed.level2Ratio(), 1, 2, 1.) + " |"
  140.         );

  141.         System.out.println ("\t| Level 2B Ratio => " +
  142.             FormatUtil.FormatDouble (hqlaStandardFed.level2BRatio(), 1, 2, 1.) + " |"
  143.         );

  144.         System.out.println ("\t|-------------------------|");

  145.         System.out.println();

  146.         System.out.println ("\t|-------------------------------|");

  147.         System.out.println ("\t|       HQLA Fed Settings       |");

  148.         System.out.println ("\t|-------------------------------|");

  149.         System.out.println ("\t| Level 1 Hair Cut     => " +
  150.             FormatUtil.FormatDouble (hqlaSettings.level1Haircut(), 1, 2, 1.) + " |"
  151.         );

  152.         System.out.println ("\t| Level 1 Risk Weight  => " +
  153.             FormatUtil.FormatDouble (hqlaSettings.level1RiskWeight(), 1, 2, 1.) + " |"
  154.         );

  155.         System.out.println ("\t| Level 2A Hair Cut    => " +
  156.             FormatUtil.FormatDouble (hqlaSettings.level2AHaircut(), 1, 2, 1.) + " |"
  157.         );

  158.         System.out.println ("\t| Level 2A Risk Weight => " +
  159.             FormatUtil.FormatDouble (hqlaSettings.level2ARiskWeight(), 1, 2, 1.) + " |"
  160.         );

  161.         System.out.println ("\t| Level 2B Hair Cut    => " +
  162.             FormatUtil.FormatDouble (hqlaSettings.level2BHaircut(), 1, 2, 1.) + " |"
  163.         );

  164.         System.out.println ("\t| Level 2B Risk Weight => " +
  165.             FormatUtil.FormatDouble (hqlaSettings.level2BRiskWeight(), 1, 2, 1.) + " |"
  166.         );

  167.         System.out.println ("\t|-------------------------------|");

  168.         System.out.println();

  169.         System.out.println ("\t|-------------------------------|");

  170.         System.out.println ("\t|    HQLA Composite Metrics     |");

  171.         System.out.println ("\t|-------------------------------|");

  172.         System.out.println ("\t| Level 1             => " +
  173.             FormatUtil.FormatDouble (hqla.level1(), 3, 1, 1.) + " |"
  174.         );

  175.         System.out.println ("\t| Level 2A            => " +
  176.             FormatUtil.FormatDouble (hqla.level2A(), 3, 1, 1.) + " |"
  177.         );

  178.         System.out.println ("\t| Level 2B            => " +
  179.             FormatUtil.FormatDouble (hqla.level2B(), 3, 1, 1.) + " |"
  180.         );

  181.         System.out.println ("\t| Total               => " +
  182.             FormatUtil.FormatDouble (hqla.total(), 3, 1, 1.) + " |"
  183.         );

  184.         System.out.println ("\t| Level 2 Ratio       => " +
  185.             FormatUtil.FormatDouble (hqla.level2Ratio(), 1, 2, 1.) + "  |"
  186.         );

  187.         System.out.println ("\t| Level 2B Ratio      => " +
  188.             FormatUtil.FormatDouble (hqla.level2BRatio(), 1, 2, 1.) + "  |"
  189.         );

  190.         System.out.println ("\t| Fed HQLA Compliant  =>  " + hqla.isCompliant (hqlaStandardFed) + "  |");

  191.         System.out.println ("\t| HQLA Adjusted Total => " +
  192.             FormatUtil.FormatDouble (hqla.totalRiskWeightAndHaircut (hqlaSettings), 3, 1, 1.) + " |"
  193.         );

  194.         System.out.println ("\t|-------------------------------|");

  195.         EnvManager.TerminateEnv();
  196.     }
  197. }