CompositePeriodSetting.java

  1. package org.drip.param.period;

  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.  *
  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>CompositePeriodSetting</i> implements the custom setting parameters for the composite coupon period.
  81.  *
  82.  *  <br><br>
  83.  *  <ul>
  84.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ProductCore.md">Product Core Module</a></li>
  85.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FixedIncomeAnalyticsLibrary.md">Fixed Income Analytics</a></li>
  86.  *      <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>
  87.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/param/period">Composite Composable Period Builder Settings</a></li>
  88.  *  </ul>
  89.  *
  90.  * @author Lakshmi Krishnamurthy
  91.  */

  92. public class CompositePeriodSetting {
  93.     private int _iFreq = -1;
  94.     private java.lang.String _strTenor = "";
  95.     private java.lang.String _strPayCurrency = "";
  96.     private double _dblBaseNotional = java.lang.Double.NaN;
  97.     private org.drip.numerical.common.Array2D _fsCoupon = null;
  98.     private org.drip.numerical.common.Array2D _fsNotional = null;
  99.     private org.drip.state.identifier.EntityCDSLabel _creditLabel = null;
  100.     private org.drip.param.period.FixingSetting _fxFixingSetting = null;
  101.     private org.drip.analytics.daycount.DateAdjustParams _dapPay = null;

  102.     /**
  103.      * CompositePeriodSetting Constructor
  104.      *
  105.      * @param iFreq The Frequency
  106.      * @param strTenor The Period Tenor
  107.      * @param strPayCurrency The Pay Currency
  108.      * @param dapPay Composite Pay Date Adjust Parameters
  109.      * @param dblBaseNotional The Period Base Notional
  110.      * @param fsCoupon The Period Coupon Schedule
  111.      * @param fsNotional The Period Notional Schedule
  112.      * @param fxFixingSetting The FX Fixing Setting
  113.      * @param creditLabel The Period Credit Label
  114.      *
  115.      * @throws java.lang.Exception Thrown if Inputs are invalid
  116.      */

  117.     public CompositePeriodSetting (
  118.         final int iFreq,
  119.         final java.lang.String strTenor,
  120.         final java.lang.String strPayCurrency,
  121.         final org.drip.analytics.daycount.DateAdjustParams dapPay,
  122.         final double dblBaseNotional,
  123.         final org.drip.numerical.common.Array2D fsCoupon,
  124.         final org.drip.numerical.common.Array2D fsNotional,
  125.         final org.drip.param.period.FixingSetting fxFixingSetting,
  126.         final org.drip.state.identifier.EntityCDSLabel creditLabel)
  127.         throws java.lang.Exception
  128.     {
  129.         if (0 >= (_iFreq = iFreq) || null == (_strTenor = strTenor) || _strTenor.isEmpty() || null ==
  130.             (_strPayCurrency = strPayCurrency) || _strPayCurrency.isEmpty() ||
  131.                 !org.drip.numerical.common.NumberUtil.IsValid (_dblBaseNotional = dblBaseNotional))
  132.             throw new java.lang.Exception ("CompositePeriodSetting ctr: Invalid Inputs");

  133.         _dapPay = dapPay;
  134.         _creditLabel = creditLabel;
  135.         _fxFixingSetting = fxFixingSetting;

  136.         if (null == (_fsCoupon = fsCoupon)) _fsCoupon = org.drip.numerical.common.Array2D.BulletSchedule();

  137.         if (null == (_fsNotional = fsNotional))
  138.             _fsNotional = org.drip.numerical.common.Array2D.BulletSchedule();
  139.     }

  140.     /**
  141.      * Retrieve the Frequency
  142.      *
  143.      * @return The Frequency
  144.      */

  145.     public int freq()
  146.     {
  147.         return _iFreq;
  148.     }

  149.     /**
  150.      * Retrieve the Tenor
  151.      *
  152.      * @return The Tenor
  153.      */

  154.     public java.lang.String tenor()
  155.     {
  156.         return _strTenor;
  157.     }

  158.     /**
  159.      * Retrieve the Pay Currency
  160.      *
  161.      * @return The Pay Currency
  162.      */

  163.     public java.lang.String payCurrency()
  164.     {
  165.         return _strPayCurrency;
  166.     }

  167.     /**
  168.      * Retrieve the Pay DAP
  169.      *
  170.      * @return The Pay DAP
  171.      */

  172.     public org.drip.analytics.daycount.DateAdjustParams dapPay()
  173.     {
  174.         return _dapPay;
  175.     }

  176.     /**
  177.      * Retrieve the Base Notional
  178.      *
  179.      * @return The Base Notional
  180.      */

  181.     public double baseNotional()
  182.     {
  183.         return _dblBaseNotional;
  184.     }

  185.     /**
  186.      * Retrieve the Notional Schedule
  187.      *
  188.      * @return The Notional Schedule
  189.      */

  190.     public org.drip.numerical.common.Array2D notionalSchedule()
  191.     {
  192.         return _fsNotional;
  193.     }

  194.     /**
  195.      * Retrieve the Coupon Schedule
  196.      *
  197.      * @return The Coupon Schedule
  198.      */

  199.     public org.drip.numerical.common.Array2D couponSchedule()
  200.     {
  201.         return _fsCoupon;
  202.     }

  203.     /**
  204.      * Retrieve the FX Fixing Setting
  205.      *
  206.      * @return The FX Fixing Setting
  207.      */

  208.     public org.drip.param.period.FixingSetting fxFixingSetting()
  209.     {
  210.         return _fxFixingSetting;
  211.     }

  212.     /**
  213.      * Retrieve the Credit Label
  214.      *
  215.      * @return The Credit Label
  216.      */

  217.     public org.drip.state.identifier.EntityCDSLabel creditLabel()
  218.     {
  219.         return _creditLabel;
  220.     }
  221. }