ValuationCustomizationParams.java

  1. package org.drip.param.valuation;

  2. /*
  3.  * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  4.  */

  5. /*!
  6.  * Copyright (C) 2019 Lakshmi Krishnamurthy
  7.  * Copyright (C) 2018 Lakshmi Krishnamurthy
  8.  * Copyright (C) 2017 Lakshmi Krishnamurthy
  9.  * Copyright (C) 2016 Lakshmi Krishnamurthy
  10.  * Copyright (C) 2015 Lakshmi Krishnamurthy
  11.  * Copyright (C) 2014 Lakshmi Krishnamurthy
  12.  * Copyright (C) 2013 Lakshmi Krishnamurthy
  13.  * Copyright (C) 2012 Lakshmi Krishnamurthy
  14.  * Copyright (C) 2011 Lakshmi Krishnamurthy
  15.  *
  16.  *  This file is part of DROP, an open-source library targeting risk, transaction costs, exposure, margin
  17.  *      calculations, and portfolio construction within and across fixed income, credit, commodity, equity,
  18.  *      FX, and structured products.
  19.  *  
  20.  *      https://lakshmidrip.github.io/DROP/
  21.  *  
  22.  *  DROP is composed of three main modules:
  23.  *  
  24.  *  - DROP Analytics Core - https://lakshmidrip.github.io/DROP-Analytics-Core/
  25.  *  - DROP Portfolio Core - https://lakshmidrip.github.io/DROP-Portfolio-Core/
  26.  *  - DROP Numerical Core - https://lakshmidrip.github.io/DROP-Numerical-Core/
  27.  *
  28.  *  DROP Analytics Core implements libraries for the following:
  29.  *  - Fixed Income Analytics
  30.  *  - Asset Backed Analytics
  31.  *  - XVA Analytics
  32.  *  - Exposure and Margin Analytics
  33.  *
  34.  *  DROP Portfolio Core implements libraries for the following:
  35.  *  - Asset Allocation Analytics
  36.  *  - Transaction Cost Analytics
  37.  *
  38.  *  DROP Numerical Core implements libraries for the following:
  39.  *  - Statistical Learning Library
  40.  *  - Numerical Optimizer Library
  41.  *  - Machine Learning Library
  42.  *  - Spline Builder Library
  43.  *
  44.  *  Documentation for DROP is Spread Over:
  45.  *
  46.  *  - Main                     => https://lakshmidrip.github.io/DROP/
  47.  *  - Wiki                     => https://github.com/lakshmiDRIP/DROP/wiki
  48.  *  - GitHub                   => https://github.com/lakshmiDRIP/DROP
  49.  *  - Javadoc                  => https://lakshmidrip.github.io/DROP/Javadoc/index.html
  50.  *  - Technical Specifications => https://github.com/lakshmiDRIP/DROP/tree/master/Docs/Internal
  51.  *  - Release Versions         => https://lakshmidrip.github.io/DROP/version.html
  52.  *  - Community Credits        => https://lakshmidrip.github.io/DROP/credits.html
  53.  *  - Issues Catalog           => https://github.com/lakshmiDRIP/DROP/issues
  54.  *  - JUnit                    => https://lakshmidrip.github.io/DROP/junit/index.html
  55.  *  - Jacoco                   => https://lakshmidrip.github.io/DROP/jacoco/index.html
  56.  *
  57.  *  Licensed under the Apache License, Version 2.0 (the "License");
  58.  *      you may not use this file except in compliance with the License.
  59.  *  
  60.  *  You may obtain a copy of the License at
  61.  *      http://www.apache.org/licenses/LICENSE-2.0
  62.  *  
  63.  *  Unless required by applicable law or agreed to in writing, software
  64.  *      distributed under the License is distributed on an "AS IS" BASIS,
  65.  *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  66.  *  
  67.  *  See the License for the specific language governing permissions and
  68.  *      limitations under the License.
  69.  */

  70. /**
  71.  * <i>ValuationCustomizationParams</i> holds the parameters needed to interpret the input quotes. It contains
  72.  * the quote day count, the quote frequency, the quote EOM Adjustment, the quote Act/Act parameters, the
  73.  * quote Calendar, the Core Collateralization Parameters, and the Switchable Alternate Collateralization
  74.  * Parameters. It also indicates if the native quote is spread based.
  75.  *
  76.  *  <br><br>
  77.  *  <ul>
  78.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ProductCore.md">Product Core Module</a></li>
  79.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FixedIncomeAnalyticsLibrary.md">Fixed Income Analytics</a></li>
  80.  *      <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>
  81.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/param/valuation">Valuation Settlement and Valuation Customization Parameters</a></li>
  82.  *  </ul>
  83.  *
  84.  * @author Lakshmi Krishnamurthy
  85.  */

  86. public class ValuationCustomizationParams {
  87.     private int _iYieldFrequency = 0;
  88.     private boolean _bSpreadQuoted = false;
  89.     private java.lang.String _strYieldDC = "";
  90.     private boolean _bYieldApplyEOMAdj = false;
  91.     private boolean _bApplyFlatForwardRate = false;
  92.     private java.lang.String _strYieldCalendar = "";
  93.     private org.drip.analytics.daycount.ActActDCParams _aapYield = null;

  94.     /**
  95.      * Construct the BondEquivalent Instance of ValuationCustomizationParams
  96.      *
  97.      * @param strCalendar The Calendar
  98.      *
  99.      * @return The BondEquivalent Instance of ValuationCustomizationParams
  100.      */

  101.     public static final ValuationCustomizationParams BondEquivalent (
  102.         final java.lang.String strCalendar)
  103.     {
  104.         try {
  105.             return new ValuationCustomizationParams ("30/360", 2, false, null, strCalendar, false, false);
  106.         } catch (java.lang.Exception e) {
  107.             e.printStackTrace();
  108.         }

  109.         return null;
  110.     }

  111.     /**
  112.      * Construct ValuationCustomizationParams from the Day Count and the Frequency parameters
  113.      *
  114.      * @param strDC Quoting Day Count
  115.      * @param iFrequency Quoting Frequency
  116.      * @param bApplyEOMAdj TRUE - Apply the EOM Adjustment
  117.      * @param aap - Quoting Act/Act Parameters
  118.      * @param strCalendar - Quoting Calendar
  119.      * @param bSpreadQuoted - TRUE - Market Quotes are Spread Quoted
  120.      * @param bApplyFlatForwardRate - TRUE - Apply Flat Forward Rate
  121.      *
  122.      * @throws java.lang.Exception Thrown if inputs are invalid
  123.      */

  124.     public ValuationCustomizationParams (
  125.         final java.lang.String strDC,
  126.         final int iFrequency,
  127.         final boolean bApplyEOMAdj,
  128.         final org.drip.analytics.daycount.ActActDCParams aap,
  129.         final java.lang.String strCalendar,
  130.         final boolean bSpreadQuoted,
  131.         final boolean bApplyFlatForwardRate)
  132.         throws java.lang.Exception
  133.     {
  134.         if (null == strDC || strDC.isEmpty() || 0 == iFrequency)
  135.             throw new java.lang.Exception ("ValuationCustomizationParams ctr: Invalid quoting params!");

  136.         _aapYield = aap;
  137.         _strYieldDC = strDC;
  138.         _iYieldFrequency = iFrequency;
  139.         _bSpreadQuoted = bSpreadQuoted;
  140.         _strYieldCalendar = strCalendar;
  141.         _bYieldApplyEOMAdj = bApplyEOMAdj;
  142.         _bApplyFlatForwardRate = bApplyFlatForwardRate;
  143.     }

  144.     /**
  145.      * Retrieve the Yield Act Act Day Count Parameters
  146.      *
  147.      * @return The Yield Act Act Day Count Parameters
  148.      */

  149.     public org.drip.analytics.daycount.ActActDCParams yieldAAP()
  150.     {
  151.         return _aapYield;
  152.     }

  153.     /**
  154.      * Retrieve the Yield Day Count
  155.      *
  156.      * @return The Yield Day Count
  157.      */

  158.     public java.lang.String yieldDayCount()
  159.     {
  160.         return _strYieldDC;
  161.     }

  162.     /**
  163.      * Retrieve the Yield Frequency
  164.      *
  165.      * @return The Yield Frequency
  166.      */

  167.     public int yieldFreq()
  168.     {
  169.         return _iYieldFrequency;
  170.     }

  171.     /**
  172.      * Indicate if spread Quoted
  173.      *
  174.      * @return TRUE - Spread Quoted
  175.      */

  176.     public boolean spreadQuoted()
  177.     {
  178.         return _bSpreadQuoted;
  179.     }

  180.     /**
  181.      * Retrieve the Yield Calendar
  182.      *
  183.      * @return The Yield Calendar
  184.      */

  185.     public java.lang.String yieldCalendar()
  186.     {
  187.         return _strYieldCalendar;
  188.     }

  189.     /**
  190.      * Indicate if EOM Adjustment is to be made for the Yield Calculation
  191.      *
  192.      * @return TRUE - EOM Adjustment is to be made for the Yield Calculation
  193.      */

  194.     public boolean applyYieldEOMAdj()
  195.     {
  196.         return _bYieldApplyEOMAdj;
  197.     }

  198.     /**
  199.      * Indicate if Forward Rate is to be Projected using its Current Value
  200.      *
  201.      * @return TRUE - Forward Rate is to be Projected using its Current Value
  202.      */

  203.     public boolean applyFlatForwardRate()
  204.     {
  205.         return _bApplyFlatForwardRate;
  206.     }
  207. }