CDSMarketSnap.java

  1. package org.drip.historical.attribution;

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

  77. /**
  78.  * <i>CDSMarketSnap</i> contains the Metrics Snapshot associated with the relevant Manifest Measures for the given
  79.  * Credit Default Swap Position.
  80.  *
  81.  *  <br><br>
  82.  *  <ul>
  83.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ComputationalCore.md">Computational Core Module</a></li>
  84.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ComputationSupportLibrary.md">Computation Support</a></li>
  85.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/historical/README.md">Historical State Processing Utilities</a></li>
  86.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/historical/attribution/README.md">Position Market Change Components Attribution</a></li>
  87.  *  </ul>
  88.  *
  89.  * @author Lakshmi Krishnamurthy
  90.  */

  91. public class CDSMarketSnap extends org.drip.historical.attribution.PositionMarketSnap {

  92.     /**
  93.      * CDSMarketSnap Constructor
  94.      *
  95.      * @param dtSnap The Snapshot Date
  96.      * @param dblMarketValue The Snapshot Market Value
  97.      *
  98.      * @throws java.lang.Exception Thrown if the Inputs are Invalid
  99.      */

  100.     public CDSMarketSnap (
  101.         final org.drip.analytics.date.JulianDate dtSnap,
  102.         final double dblMarketValue)
  103.         throws java.lang.Exception
  104.     {
  105.         super (dtSnap, dblMarketValue);
  106.     }

  107.     /**
  108.      * Set the Fair Premium and Position Sensitivity
  109.      *
  110.      * @param dblFairPremium The Fair Premium
  111.      * @param dblFairPremiumSensitivity The Position Fair Premium Sensitivity
  112.      * @param dblFairPremiumRollDown The Position Fair Premium Roll Down
  113.      *
  114.      * @return TRUE - The Fair Premium and the Position Sensitivity successfully set
  115.      */

  116.     public boolean setFairPremiumMarketFactor (
  117.         final double dblFairPremium,
  118.         final double dblFairPremiumSensitivity,
  119.         final double dblFairPremiumRollDown)
  120.     {
  121.         return addManifestMeasureSnap ("FairPremium", dblFairPremium, dblFairPremiumSensitivity,
  122.             dblFairPremiumRollDown);
  123.     }

  124.     /**
  125.      * Set the Effective Date
  126.      *
  127.      * @param dtEffective The Effective Date
  128.      *
  129.      * @return TRUE - The Effective Date successfully set
  130.      */

  131.     public boolean setEffectiveDate (
  132.         final org.drip.analytics.date.JulianDate dtEffective)
  133.     {
  134.         return setDate ("EffectiveDate", dtEffective);
  135.     }

  136.     /**
  137.      * Retrieve the Effective Date
  138.      *
  139.      * @return The Effective Date
  140.      */

  141.     public org.drip.analytics.date.JulianDate effectiveDate()
  142.     {
  143.         return date ("EffectiveDate");
  144.     }

  145.     /**
  146.      * Set the Maturity Date
  147.      *
  148.      * @param dtMaturity The Maturity Date
  149.      *
  150.      * @return TRUE - The Maturity Date successfully set
  151.      */

  152.     public boolean setMaturityDate (
  153.         final org.drip.analytics.date.JulianDate dtMaturity)
  154.     {
  155.         return setDate ("MaturityDate", dtMaturity);
  156.     }

  157.     /**
  158.      * Retrieve the Maturity Date
  159.      *
  160.      * @return The Maturity Date
  161.      */

  162.     public org.drip.analytics.date.JulianDate maturityDate()
  163.     {
  164.         return date ("MaturityDate");
  165.     }

  166.     /**
  167.      * Set the Initial Fair Premium
  168.      *
  169.      * @param dblInitialFairPremium The Initial Fair Premium
  170.      *
  171.      * @return TRUE - The Initial Fair Premium Successfully set
  172.      */

  173.     public boolean setInitialFairPremium (
  174.         final double dblInitialFairPremium)
  175.     {
  176.         return setR1 ("InitialFairPremium", dblInitialFairPremium);
  177.     }

  178.     /**
  179.      * Retrieve the Initial Fair Premium
  180.      *
  181.      * @return The Initial Fair Premium
  182.      *
  183.      * @throws java.lang.Exception Thrown if the Initial Fair Premium cannot be obtained
  184.      */

  185.     public double initialFairPremium()
  186.         throws java.lang.Exception
  187.     {
  188.         return r1 ("InitialFairPremium");
  189.     }

  190.     /**
  191.      * Set the Current Fair Premium
  192.      *
  193.      * @param dblCurrentFairPremium The Current Fair Premium
  194.      *
  195.      * @return TRUE - The Current Fair Premium Successfully Set
  196.      */

  197.     public boolean setCurrentFairPremium (
  198.         final double dblCurrentFairPremium)
  199.     {
  200.         return setR1 ("CurrentFairPremium", dblCurrentFairPremium);
  201.     }

  202.     /**
  203.      * Retrieve the Current Fair Premium
  204.      *
  205.      * @return The Current Fair Premium
  206.      *
  207.      * @throws java.lang.Exception Thrown if the Current Fair Premium cannot be obtained
  208.      */

  209.     public double currentFairPremium()
  210.         throws java.lang.Exception
  211.     {
  212.         return r1 ("CurrentFairPremium");
  213.     }

  214.     /**
  215.      * Set the Fixed Coupon
  216.      *
  217.      * @param dblFixedCoupon The Fixed Coupon
  218.      *
  219.      * @return TRUE - The Fixed Coupon Successfully Set
  220.      */

  221.     public boolean setFixedCoupon (
  222.         final double dblFixedCoupon)
  223.     {
  224.         return setR1 ("FixedCoupon", dblFixedCoupon);
  225.     }

  226.     /**
  227.      * Retrieve the Fixed Coupon
  228.      *
  229.      * @return The Fixed Coupon
  230.      *
  231.      * @throws java.lang.Exception Thrown if the Fixed Coupon cannot be obtained
  232.      */

  233.     public double fixedCoupon()
  234.         throws java.lang.Exception
  235.     {
  236.         return r1 ("FixedCoupon");
  237.     }

  238.     /**
  239.      * Set the Clean DV01
  240.      *
  241.      * @param dblCleanDV01 The Clean DV01
  242.      *
  243.      * @return TRUE - The Clean DV01 Successfully Set
  244.      */

  245.     public boolean setCleanDV01 (
  246.         final double dblCleanDV01)
  247.     {
  248.         return setR1 ("CleanDV01", dblCleanDV01);
  249.     }

  250.     /**
  251.      * Retrieve the Clean DV01
  252.      *
  253.      * @return The Clean DV01
  254.      *
  255.      * @throws java.lang.Exception Thrown if the Clean DV01 cannot be obtained
  256.      */

  257.     public double cleanDV01()
  258.         throws java.lang.Exception
  259.     {
  260.         return r1 ("CleanDV01");
  261.     }

  262.     /**
  263.      * Set the Roll Down Fair Premium
  264.      *
  265.      * @param dblRollDownFairPremium The Roll Down Fair Premium
  266.      *
  267.      * @return TRUE - The Roll Down Fair Premium Successfully Set
  268.      */

  269.     public boolean setRollDownFairPremium (
  270.         final double dblRollDownFairPremium)
  271.     {
  272.         return setR1 ("RollDownFairPremium", dblRollDownFairPremium);
  273.     }

  274.     /**
  275.      * Retrieve the Roll Down Fair Premium
  276.      *
  277.      * @return The Roll Down Fair Premium
  278.      *
  279.      * @throws java.lang.Exception Thrown if the Roll Down Fair Premium cannot be obtained
  280.      */

  281.     public double rollDownFairPremium()
  282.         throws java.lang.Exception
  283.     {
  284.         return r1 ("RollDownFairPremium");
  285.     }

  286.     /**
  287.      * Set the Accrued
  288.      *
  289.      * @param dblAccrued The Accrued
  290.      *
  291.      * @return TRUE - The Accrued successfully set
  292.      */

  293.     public boolean setAccrued (
  294.         final double dblAccrued)
  295.     {
  296.         return setR1 ("Accrued", dblAccrued);
  297.     }

  298.     /**
  299.      * Retrieve the Accrued
  300.      *
  301.      * @return The Accrued
  302.      *
  303.      * @throws java.lang.Exception Thrown if the Accrued cannot be obtained
  304.      */

  305.     public double accrued()
  306.         throws java.lang.Exception
  307.     {
  308.         return r1 ("Accrued");
  309.     }

  310.     /**
  311.      * Set the Cumulative Coupon Amount
  312.      *
  313.      * @param dblCumulativeCouponAmount The Cumulative Coupon Amount
  314.      *
  315.      * @return TRUE - The Cumulative Coupon Amount successfully set
  316.      */

  317.     public boolean setCumulativeCouponAmount (
  318.         final double dblCumulativeCouponAmount)
  319.     {
  320.         return setR1 ("CumulativeCouponAmount", dblCumulativeCouponAmount);
  321.     }

  322.     /**
  323.      * Retrieve the Cumulative Coupon Amount
  324.      *
  325.      * @return The Cumulative Coupon Amount
  326.      *
  327.      * @throws java.lang.Exception Thrown if the Cumulative Coupon Amount cannot be obtained
  328.      */

  329.     public double cumulativeCouponAmount()
  330.         throws java.lang.Exception
  331.     {
  332.         return r1 ("CumulativeCouponAmount");
  333.     }

  334.     /**
  335.      * Set the Credit Label
  336.      *
  337.      * @param strCreditLabel Credit Label
  338.      *
  339.      * @return TRUE - The Credit Label successfully set
  340.      */

  341.     public boolean setCreditLabel (
  342.         final java.lang.String strCreditLabel)
  343.     {
  344.         return setC1 ("CreditLabel", strCreditLabel);
  345.     }

  346.     /**
  347.      * Retrieve the Credit Label
  348.      *
  349.      * @return The Credit Label
  350.      */

  351.     public java.lang.String creditLabel()
  352.     {
  353.         return c1 ("CreditLabel");
  354.     }

  355.     /**
  356.      * Set the Recovery Rate
  357.      *
  358.      * @param dblRecoveryRate The Recovery Rate
  359.      *
  360.      * @return TRUE - The Recovery Rate successfully set
  361.      */

  362.     public boolean setRecoveryRate (
  363.         final double dblRecoveryRate)
  364.     {
  365.         return setR1 ("RecoveryRate", dblRecoveryRate);
  366.     }

  367.     /**
  368.      * Retrieve the Recovery Rate
  369.      *
  370.      * @return The Recovery Rate
  371.      *
  372.      * @throws java.lang.Exception Thrown if the Recovery Rate cannot be obtained
  373.      */

  374.     public double recoveryRate()
  375.         throws java.lang.Exception
  376.     {
  377.         return r1 ("RecoveryRate");
  378.     }

  379.     /**
  380.      * Set the Coupon PV
  381.      *
  382.      * @param dblCouponPV The Coupon PV
  383.      *
  384.      * @return TRUE - The Coupon PV successfully set
  385.      */

  386.     public boolean setCouponPV (
  387.         final double dblCouponPV)
  388.     {
  389.         return setR1 ("CouponPV", dblCouponPV);
  390.     }

  391.     /**
  392.      * Retrieve the Coupon PV
  393.      *
  394.      * @return The Coupon PV
  395.      *
  396.      * @throws java.lang.Exception Thrown if the Coupon PV cannot be obtained
  397.      */

  398.     public double couponPV()
  399.         throws java.lang.Exception
  400.     {
  401.         return r1 ("CouponPV");
  402.     }

  403.     /**
  404.      * Set the Loss PV
  405.      *
  406.      * @param dblLossPV The Loss PV
  407.      *
  408.      * @return TRUE - The Loss PV successfully set
  409.      */

  410.     public boolean setLossPV (
  411.         final double dblLossPV)
  412.     {
  413.         return setR1 ("LossPV", dblLossPV);
  414.     }

  415.     /**
  416.      * Retrieve the Loss PV
  417.      *
  418.      * @return The Loss PV
  419.      *
  420.      * @throws java.lang.Exception Thrown if the Loss PV cannot be obtained
  421.      */

  422.     public double lossPV()
  423.         throws java.lang.Exception
  424.     {
  425.         return r1 ("LossPV");
  426.     }
  427. }