CreditSpreadEvent.java

  1. package org.drip.capital.systemicscenario;

  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>CreditSpreadEvent</i> contains the Specifications of Criteria corresponding to a Credit Spread Event.
  76.  *  The References are:
  77.  *
  78.  * <br><br>
  79.  *  <ul>
  80.  *      <li>
  81.  *          Bank for International Supervision(2005): Stress Testing at Major Financial Institutions: Survey
  82.  *              Results and Practice https://www.bis.org/publ/cgfs24.htm
  83.  *      </li>
  84.  *      <li>
  85.  *          Glasserman, P. (2004): <i>Monte Carlo Methods in Financial Engineering</i> <b>Springer</b>
  86.  *      </li>
  87.  *      <li>
  88.  *          Kupiec, P. H. (2000): Stress Tests and Risk Capital <i>Risk</i> <b>2 (4)</b> 27-39
  89.  *      </li>
  90.  *  </ul>
  91.  *
  92.  *  <br><br>
  93.  *  <ul>
  94.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/PortfolioCore.md">Portfolio Core Module</a></li>
  95.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/CapitalAnalyticsLibrary.md">Capital Analytics</a></li>
  96.  *      <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>
  97.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/capital/systemicscenario/README.md">Systemic Stress Scenario Design/Construction</a></li>
  98.  *  </ul>
  99.  *
  100.  * @author Lakshmi Krishnamurthy
  101.  */

  102. public class CreditSpreadEvent
  103. {
  104.     private java.lang.String _scenario = "";
  105.     private org.drip.capital.systemicscenario.Criterion _snpGSCI = null;
  106.     private org.drip.capital.systemicscenario.Criterion _fxChange = null;
  107.     private org.drip.capital.systemicscenario.Criterion _ust5YChange = null;
  108.     private org.drip.capital.systemicscenario.Criterion _snp500Return = null;
  109.     private org.drip.capital.systemicscenario.Criterion _wtiSpotReturn = null;
  110.     private org.drip.capital.systemicscenario.Criterion _baaSpreadChange = null;
  111.     private org.drip.capital.systemicscenario.Criterion _ust10YMinus3MChange = null;
  112.     private org.drip.capital.systemicscenario.SystemicStressShockIndicator _systemicStressShockIndicator =
  113.         null;

  114.     /**
  115.      * Construct a Standard CreditSpreadEvent Instance
  116.      *
  117.      * @param scenario Credit Spread Event Scenario
  118.      * @param baaSpreadChange Baa Spread Change in Basis Points
  119.      * @param snp500AnnualReturn SnP 500 Annual Return in Percentage
  120.      * @param ust5YAbsoluteChange UST 5Y Absolute Change in Basis Points
  121.      * @param ust10YMinus3MAbsoluteChange UST 10Y - 3M Absolute Change in Basis Points
  122.      * @param fxRateChange FX Rate Change in Percentage
  123.      * @param wtiSpotReturn WTI Spot Return in Percentage
  124.      * @param snpGSCINonEnergyCommodityIndex SnP GSCI Non-energy Commodity Index in Percentage
  125.      * @param systemicStressShockIndicator Credit Event Systemic Stress Shock Indicator
  126.      *
  127.      * @return CreditSpreadEvent Instance
  128.      */

  129.     public static final CreditSpreadEvent Standard (
  130.         final java.lang.String scenario,
  131.         final double baaSpreadChange,
  132.         final double snp500AnnualReturn,
  133.         final double ust5YAbsoluteChange,
  134.         final double ust10YMinus3MAbsoluteChange,
  135.         final double fxRateChange,
  136.         final double wtiSpotReturn,
  137.         final double snpGSCINonEnergyCommodityIndex,
  138.         final org.drip.capital.systemicscenario.SystemicStressShockIndicator systemicStressShockIndicator)
  139.     {
  140.         try
  141.         {
  142.             return new CreditSpreadEvent (
  143.                 scenario,
  144.                 org.drip.capital.systemicscenario.Criterion.BaaSpreadChange (
  145.                     baaSpreadChange
  146.                 ),
  147.                 org.drip.capital.systemicscenario.Criterion.SnP500AnnualReturn (
  148.                     snp500AnnualReturn
  149.                 ),
  150.                 org.drip.capital.systemicscenario.Criterion.UST5YAbsoluteChange (
  151.                     ust5YAbsoluteChange
  152.                 ),
  153.                 org.drip.capital.systemicscenario.Criterion.UST10YMinus3MAbsoluteChange (
  154.                     ust10YMinus3MAbsoluteChange
  155.                 ),
  156.                 org.drip.capital.systemicscenario.Criterion.FXRateChange (
  157.                     fxRateChange
  158.                 ),
  159.                 org.drip.capital.systemicscenario.Criterion.WTISpotReturn (
  160.                     wtiSpotReturn
  161.                 ),
  162.                 org.drip.capital.systemicscenario.Criterion.SnPGSCINonEnergyCommodityIndex (
  163.                     snpGSCINonEnergyCommodityIndex
  164.                 ),
  165.                 systemicStressShockIndicator
  166.             );
  167.         }
  168.         catch (java.lang.Exception e)
  169.         {
  170.             e.printStackTrace();
  171.         }

  172.         return null;
  173.     }

  174.     /**
  175.      * CreditSpreadEvent Constructor
  176.      *
  177.      * @param scenario Credit Spread Event Scenario
  178.      * @param baaSpreadChange Baa Spread Change Criterion
  179.      * @param snp500Return SnP 500 Return Criterion
  180.      * @param ust5YChange 5Y UST Change Criterion
  181.      * @param ust10YMinus3MChange 10Y - 3M UST Change Criterion
  182.      * @param fxChange FX Change Criterion
  183.      * @param wtiSpotReturn WTI Spot Return Criterion
  184.      * @param snpGSCI SnP GSCI Criterion
  185.      * @param systemicStressShockIndicator Credit Event Systemic Stress Shock Indicator
  186.      *
  187.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  188.      */

  189.     public CreditSpreadEvent (
  190.         final java.lang.String scenario,
  191.         final org.drip.capital.systemicscenario.Criterion baaSpreadChange,
  192.         final org.drip.capital.systemicscenario.Criterion snp500Return,
  193.         final org.drip.capital.systemicscenario.Criterion ust5YChange,
  194.         final org.drip.capital.systemicscenario.Criterion ust10YMinus3MChange,
  195.         final org.drip.capital.systemicscenario.Criterion fxChange,
  196.         final org.drip.capital.systemicscenario.Criterion wtiSpotReturn,
  197.         final org.drip.capital.systemicscenario.Criterion snpGSCI,
  198.         final org.drip.capital.systemicscenario.SystemicStressShockIndicator systemicStressShockIndicator)
  199.         throws java.lang.Exception
  200.     {
  201.         if (null == (_scenario = scenario) || _scenario.isEmpty() ||
  202.             null == (_baaSpreadChange = baaSpreadChange) ||
  203.             null == (_snp500Return = snp500Return) ||
  204.             null == (_ust5YChange = ust5YChange) ||
  205.             null == (_ust10YMinus3MChange = ust10YMinus3MChange) ||
  206.             null == (_fxChange = fxChange) ||
  207.             null == (_wtiSpotReturn = wtiSpotReturn) ||
  208.             null == (_snpGSCI = snpGSCI) ||
  209.             null == (_systemicStressShockIndicator = systemicStressShockIndicator))
  210.         {
  211.             throw new java.lang.Exception ("CreditSpreadEvent Constructor => Invalid Inputs");
  212.         }
  213.     }

  214.     /**
  215.      * Retrieve the Credit Spread Event Scenario
  216.      *
  217.      * @return The Credit Spread Event Scenario
  218.      */

  219.     public java.lang.String scenario()
  220.     {
  221.         return _scenario;
  222.     }

  223.     /**
  224.      * Retrieve the Baa Spread Change Criterion
  225.      *
  226.      * @return The Baa Spread Change Criterion
  227.      */

  228.     public org.drip.capital.systemicscenario.Criterion baaSpreadChange()
  229.     {
  230.         return _baaSpreadChange;
  231.     }

  232.     /**
  233.      * Retrieve the SnP 500 Return Criterion
  234.      *
  235.      * @return The SnP 500 Return Criterion
  236.      */

  237.     public org.drip.capital.systemicscenario.Criterion snp500Return()
  238.     {
  239.         return _snp500Return;
  240.     }

  241.     /**
  242.      * Retrieve the 5Y UST Change Criterion
  243.      *
  244.      * @return The 5Y UST Change Criterion
  245.      */

  246.     public org.drip.capital.systemicscenario.Criterion ust5YChange()
  247.     {
  248.         return _ust5YChange;
  249.     }

  250.     /**
  251.      * Retrieve the 10Y - 3M UST Change Criterion
  252.      *
  253.      * @return The 10Y - 3M UST Change Criterion
  254.      */

  255.     public org.drip.capital.systemicscenario.Criterion ust10YMinus3MChange()
  256.     {
  257.         return _ust10YMinus3MChange;
  258.     }

  259.     /**
  260.      * Retrieve the FX Change Criterion
  261.      *
  262.      * @return The FX Change Criterion
  263.      */

  264.     public org.drip.capital.systemicscenario.Criterion fxChange()
  265.     {
  266.         return _fxChange;
  267.     }

  268.     /**
  269.      * Retrieve the WTI Spot Return Criterion
  270.      *
  271.      * @return The WTI Spot Return Criterion
  272.      */

  273.     public org.drip.capital.systemicscenario.Criterion wtiSpotReturn()
  274.     {
  275.         return _wtiSpotReturn;
  276.     }

  277.     /**
  278.      * Retrieve the SnP GSCI Criterion
  279.      *
  280.      * @return The SnP GSCI Criterion
  281.      */

  282.     public org.drip.capital.systemicscenario.Criterion snpGSCI()
  283.     {
  284.         return _snpGSCI;
  285.     }

  286.     /**
  287.      * Retrieve the Systemic Stress Shock Indicator
  288.      *
  289.      * @return The Systemic Stress Shock Indicator
  290.      */

  291.     public org.drip.capital.systemicscenario.SystemicStressShockIndicator systemicStressShockIndicator()
  292.     {
  293.         return _systemicStressShockIndicator;
  294.     }
  295. }