CreditPricerParams.java

  1. package org.drip.param.pricer;

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

  82. /**
  83.  * <i>CreditPricerParams</i> contains the Credit Pricer Parameters - the discrete unit size, calibration mode
  84.  * on/off, survival to pay/end date, and the discretization scheme.
  85.  *
  86.  *  <br><br>
  87.  *  <ul>
  88.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ProductCore.md">Product Core Module</a></li>
  89.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FixedIncomeAnalyticsLibrary.md">Fixed Income Analytics</a></li>
  90.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/param/README.md">Product Cash Flow, Valuation, Market, Pricing, and Quoting Parameters</a></li>
  91.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/param/pricer/README.md">Pricing Parameters Customization Settings Control</a></li>
  92.  *  </ul>
  93.  *
  94.  * @author Lakshmi Krishnamurthy
  95.  */

  96. public class CreditPricerParams implements org.drip.param.pricer.PricerParams {

  97.     /*
  98.      * Loss period Grid discretization scheme
  99.      */

  100.     /**
  101.      * Minimum number of days per unit
  102.      */

  103.     public static final int PERIOD_DAY_STEPS_MINIMUM = 7;

  104.     /**
  105.      * Discretization as a sequence of day steps
  106.      */

  107.     public static final int PERIOD_DISCRETIZATION_DAY_STEP = 1;

  108.     /**
  109.      * Discretization as a sequence of time space divided periods
  110.      */

  111.     public static final int PERIOD_DISCRETIZATION_PERIOD_STEP = 2;

  112.     /**
  113.      * No discretization at all - just the full coupon period
  114.      */

  115.     public static final int PERIOD_DISCRETIZATION_FULL_COUPON = 3;

  116.     private int _iUnitSize = 7;
  117.     private boolean _bSurvToPayDate = false;
  118.     private int _iDiscretizationScheme = PERIOD_DISCRETIZATION_DAY_STEP;
  119.     private org.drip.param.definition.CalibrationParams _calibParams = null;

  120.     /**
  121.      * Create the standard Credit pricer parameters object instance
  122.      *
  123.      * @return CreditPricerParams object instance
  124.      */

  125.     public static final CreditPricerParams Standard()
  126.     {
  127.         return new CreditPricerParams (7, null, false, PERIOD_DISCRETIZATION_DAY_STEP);
  128.     }

  129.     /**
  130.      * Create the pricer parameters from the discrete unit size, calibration mode on/off, survival to
  131.      *  pay/end date, and the discretization scheme
  132.      *
  133.      * @param iUnitSize Discretization Unit Size
  134.      * @param calibParams Optional Calibration Params
  135.      * @param bSurvToPayDate Survival to Pay Date (True) or Period End Date (false)
  136.      * @param iDiscretizationScheme Discretization Scheme In Use
  137.      */

  138.     public CreditPricerParams (
  139.         final int iUnitSize,
  140.         final org.drip.param.definition.CalibrationParams calibParams,
  141.         final boolean bSurvToPayDate,
  142.         final int iDiscretizationScheme)
  143.     {
  144.         _iUnitSize = iUnitSize;
  145.         _calibParams = calibParams;
  146.         _bSurvToPayDate = bSurvToPayDate;
  147.         _iDiscretizationScheme = iDiscretizationScheme;
  148.     }

  149.     /**
  150.      * Retrieve the Discretized Loss Unit Size
  151.      *
  152.      * @return The Discretized Loss Unit Size
  153.      */

  154.     public int unitSize()
  155.     {
  156.         return _iUnitSize;
  157.     }

  158.     /**
  159.      * Retrieve the Calibration Parameters Instance
  160.      *
  161.      * @return The Calibration Parameters Instance
  162.      */

  163.     public org.drip.param.definition.CalibrationParams calibParams()
  164.     {
  165.         return _calibParams;
  166.     }

  167.     /**
  168.      * Retrieve the flag indicating whether the Survival is to be computed to the Pay Date (TRUE) or not
  169.      *
  170.      * @return TRUE - Survival is to be computed to the Pay Date
  171.      */

  172.     public boolean survivalToPayDate()
  173.     {
  174.         return _bSurvToPayDate;
  175.     }

  176.     /**
  177.      * Retrieve the Discretization Scheme
  178.      *
  179.      * @return The Discretization Scheme
  180.      */

  181.     public int discretizationScheme()
  182.     {
  183.         return _iDiscretizationScheme;
  184.     }
  185. }