ValueCategory.java

  1. package org.drip.xva.basel;

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

  76. /**
  77.  * <i>ValueCategory</i> holds the Fields relevant to Classifying Value Attribution from an Accounting View
  78.  * Point. The References are:
  79.  *
  80.  *  <br><br>
  81.  *  <ul>
  82.  *      <li>
  83.  *          Albanese, C., and L. Andersen (2014): Accounting for OTC Derivatives: Funding Adjustments and the
  84.  *              Re-Hypothecation Option https://papers.ssrn.com/sol3/papers.cfm?abstract_id=2482955
  85.  *              <b>eSSRN</b>
  86.  *      </li>
  87.  *      <li>
  88.  *          BCBS (2012): <i>Consultative Document: Application of Own Credit Risk Adjustments to
  89.  *              Derivatives</i> <b>Basel Committee on Banking Supervision</b>
  90.  *      </li>
  91.  *      <li>
  92.  *          Burgard, C., and M. Kjaer (2014): PDE Representations of Derivatives with Bilateral Counter-party
  93.  *              Risk and Funding Costs <i>Journal of Credit Risk</i> <b>7 (3)</b> 1-19
  94.  *      </li>
  95.  *      <li>
  96.  *          Burgard, C., and M. Kjaer (2014): In the Balance <i>Risk</i> <b>24 (11)</b> 72-75
  97.  *      </li>
  98.  *      <li>
  99.  *          Piterbarg, V. (2010): Funding Beyond Discounting: Collateral Agreements and Derivatives Pricing
  100.  *              <i>Risk</i> <b>21 (2)</b> 97-102
  101.  *      </li>
  102.  *  </ul>
  103.  *
  104.  *  <br><br>
  105.  *  <ul>
  106.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/PortfolioCore.md">Portfolio Core Module</a></li>
  107.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/XVAAnalyticsLibrary.md">XVA Analytics Library</a></li>
  108.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/xva/README.md">Valuation Adjustments that account for Collateral, CC Credit/Debt and Funding Overhead</a></li>
  109.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/xva/basel/README.md">XVA Based Basel Accounting Measures</a></li>
  110.  *  </ul>
  111.  * <br><br>
  112.  *
  113.  * @author Lakshmi Krishnamurthy
  114.  */

  115. public class ValueCategory
  116. {
  117.     private java.lang.String _id = "";
  118.     private boolean _cet1Contributor = false;
  119.     private java.lang.String _decription = "";

  120.     /**
  121.      * Retrieve an Instance of the CF1 Cash Flow
  122.      *
  123.      * @return An Instance of the CF1 Cash Flow
  124.      */

  125.     public static final ValueCategory CF1()
  126.     {
  127.         try
  128.         {
  129.             return new ValueCategory (
  130.                 "CF1",
  131.                 "Dealer Trade Contractual Cash Flow",
  132.                 true
  133.             );
  134.         }
  135.         catch (java.lang.Exception e)
  136.         {
  137.             e.printStackTrace();
  138.         }

  139.         return null;
  140.     }

  141.     /**
  142.      * Retrieve an Instance of the CF2 Cash Flow
  143.      *
  144.      * @return An Instance of the CF2 Cash Flow
  145.      */

  146.     public static final ValueCategory CF2()
  147.     {
  148.         try
  149.         {
  150.             return new ValueCategory (
  151.                 "CF2",
  152.                 "Client Default Cash Flow",
  153.                 true
  154.             );
  155.         }
  156.         catch (java.lang.Exception e)
  157.         {
  158.             e.printStackTrace();
  159.         }

  160.         return null;
  161.     }

  162.     /**
  163.      * Retrieve an Instance of the CF3 Cash Flow
  164.      *
  165.      * @return An Instance of the CF3 Cash Flow
  166.      */

  167.     public static final ValueCategory CF3()
  168.     {
  169.         try
  170.         {
  171.             return new ValueCategory (
  172.                 "CF3",
  173.                 "Dealer Default Related Cash Flow",
  174.                 false
  175.             );
  176.         }
  177.         catch (java.lang.Exception e)
  178.         {
  179.             e.printStackTrace();
  180.         }

  181.         return null;
  182.     }

  183.     /**
  184.      * Retrieve an Instance of the CF4 Cash Flow
  185.      *
  186.      * @return An Instance of the CF4 Cash Flow
  187.      */

  188.     public static final ValueCategory CF4()
  189.     {
  190.         try
  191.         {
  192.             return new ValueCategory (
  193.                 "CF4",
  194.                 "Pre Dealer Default Dynamic Flow",
  195.                 false
  196.             );
  197.         }
  198.         catch (java.lang.Exception e)
  199.         {
  200.             e.printStackTrace();
  201.         }

  202.         return null;
  203.     }

  204.     /**
  205.      * Retrieve an Instance of the CF5 Cash Flow
  206.      *
  207.      * @return An Instance of the CF5 Cash Flow
  208.      */

  209.     public static final ValueCategory CF5()
  210.     {
  211.         try
  212.         {
  213.             return new ValueCategory (
  214.                 "CF5",
  215.                 "Post Dealer Default Dynamic Flow",
  216.                 false
  217.             );
  218.         }
  219.         catch (java.lang.Exception e)
  220.         {
  221.             e.printStackTrace();
  222.         }

  223.         return null;
  224.     }

  225.     /**
  226.      * Retrieve an Instance of the CF6 Cash Flow
  227.      *
  228.      * @return An Instance of the CF6 Cash Flow
  229.      */

  230.     public static final ValueCategory CF6()
  231.     {
  232.         try
  233.         {
  234.             return new ValueCategory (
  235.                 "CF6",
  236.                 "CSA Related Cash Flow",
  237.                 false
  238.             );
  239.         }
  240.         catch (java.lang.Exception e)
  241.         {
  242.             e.printStackTrace();
  243.         }

  244.         return null;
  245.     }

  246.     /**
  247.      * Retrieve an Instance of the HYBRID Cash Flow
  248.      *
  249.      * @return An Instance of the HYBRID Cash Flow
  250.      */

  251.     public static final ValueCategory HYBRID()
  252.     {
  253.         try
  254.         {
  255.             return new ValueCategory (
  256.                 "HYBRID",
  257.                 "Mixed Cash Flow Types",
  258.                 false
  259.             );
  260.         }
  261.         catch (java.lang.Exception e)
  262.         {
  263.             e.printStackTrace();
  264.         }

  265.         return null;
  266.     }

  267.     /**
  268.      * ValueCategory Constructor
  269.      *
  270.      * @param id The Category ID
  271.      * @param decription The Category Description
  272.      * @param cet1Contributor TRUE - The Category is a CET1 Contributor
  273.      *
  274.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  275.      */

  276.     public ValueCategory (
  277.         final java.lang.String id,
  278.         final java.lang.String decription,
  279.         final boolean cet1Contributor)
  280.         throws java.lang.Exception
  281.     {
  282.         if (null == (_id = id) || _id.isEmpty() ||
  283.             null == (_decription = decription) || _decription.isEmpty())
  284.         {
  285.             throw new java.lang.Exception ("ValueCategory Constructor => Invalid Inputs");
  286.         }

  287.         _cet1Contributor = cet1Contributor;
  288.     }

  289.     /**
  290.      * Retrieve the Category ID
  291.      *
  292.      * @return The Category ID
  293.      */

  294.     public java.lang.String id()
  295.     {
  296.         return _id;
  297.     }

  298.     /**
  299.      * Retrieve the Category Description
  300.      *
  301.      * @return The Category Description
  302.      */

  303.     public java.lang.String description()
  304.     {
  305.         return _decription;
  306.     }

  307.     /**
  308.      * Indicator if the Category is a CET1 Contributor
  309.      *
  310.      * @return TRUE - The Category is a CET1 Contributor
  311.      */

  312.     public boolean isCET1Contributor()
  313.     {
  314.         return _cet1Contributor;
  315.     }
  316. }