OvernightIndexContainer.java

  1. package org.drip.market.definition;

  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>OvernightIndexContainer</i> holds the definitions of the overnight index definitions corresponding to
  81.  * different jurisdictions.
  82.  *
  83.  *  <br><br>
  84.  *  <ul>
  85.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ProductCore.md">Product Core Module</a></li>
  86.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/FixedIncomeAnalyticsLibrary.md">Fixed Income Analytics Library</a></li>
  87.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/market">Static Market Fields - the Definitions, the OTC/Exchange Traded Products, and Treasury Settings</a></li>
  88.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/market/definition">IBOR, FX, Overnight Index Container</a></li>
  89.  *  </ul>
  90.  *
  91.  * @author Lakshmi Krishnamurthy
  92.  */

  93. public class OvernightIndexContainer {
  94.     private static
  95.         org.drip.analytics.support.CaseInsensitiveTreeMap<org.drip.market.definition.OvernightIndex>
  96.             _mapNamedOvernightIndex = null;
  97.     private static
  98.         org.drip.analytics.support.CaseInsensitiveTreeMap<org.drip.market.definition.OvernightIndex>
  99.             _mapJurisdictionOvernightIndex = null;

  100.     /**
  101.      * Initialize the Overnight Index Container with the Overnight Indexes
  102.      *
  103.      * @return TRUE - The Overnight Index Container successfully initialized with the indexes
  104.      */

  105.     public static final boolean Init()
  106.     {
  107.         if (null != _mapNamedOvernightIndex) return true;

  108.         _mapNamedOvernightIndex = new
  109.             org.drip.analytics.support.CaseInsensitiveTreeMap<org.drip.market.definition.OvernightIndex>();

  110.         _mapJurisdictionOvernightIndex = new
  111.             org.drip.analytics.support.CaseInsensitiveTreeMap<org.drip.market.definition.OvernightIndex>();

  112.         try {
  113.             org.drip.market.definition.OvernightIndex oiAUD = new org.drip.market.definition.OvernightIndex
  114.                 ("AUD-RBA ON AONIA", "AONIA", "AUD", "Act/365", "AUD", "ON", 0,
  115.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  116.             _mapJurisdictionOvernightIndex.put ("AUD", oiAUD);

  117.             _mapNamedOvernightIndex.put ("AUD-AONIA", oiAUD);

  118.             _mapNamedOvernightIndex.put ("AUD-RBA ON AONIA", oiAUD);

  119.             org.drip.market.definition.OvernightIndex oiBRL = new org.drip.market.definition.OvernightIndex
  120.                 ("BRL-CETIP", "CETIP", "BRL", "Bus/252", "BRL", "ON", 1,
  121.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  122.             _mapJurisdictionOvernightIndex.put ("BRL", oiBRL);

  123.             _mapNamedOvernightIndex.put ("BRL-CETIP", oiBRL);

  124.             _mapNamedOvernightIndex.put ("BRL-DI", oiBRL);

  125.             org.drip.market.definition.OvernightIndex oiCAD = new org.drip.market.definition.OvernightIndex
  126.                 ("CAD-CORRA", "CORRA", "CAD", "Act/365", "CAD", "ON", 1,
  127.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  128.             _mapJurisdictionOvernightIndex.put ("CAD", oiCAD);

  129.             _mapNamedOvernightIndex.put ("CAD-CORRA", oiCAD);

  130.             org.drip.market.definition.OvernightIndex oiCHF = new org.drip.market.definition.OvernightIndex
  131.                 ("CHF-TOIS", "TOIS", "CHF", "Act/360", "CHF", "TN", -1,
  132.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  133.             _mapJurisdictionOvernightIndex.put ("CHF", oiCHF);

  134.             _mapNamedOvernightIndex.put ("CHF-TOIS", oiCHF);

  135.             org.drip.market.definition.OvernightIndex oiCZK = new org.drip.market.definition.OvernightIndex
  136.                 ("CZK-CZEONIA", "CZEONIA", "CZK", "Act/360", "CZK", "ON", 0,
  137.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  138.             _mapJurisdictionOvernightIndex.put ("CZK", oiCZK);

  139.             _mapNamedOvernightIndex.put ("CZK-CZEONIA", oiCZK);

  140.             org.drip.market.definition.OvernightIndex oiDKK = new org.drip.market.definition.OvernightIndex
  141.                 ("DKK-DNB TN", "DNBTN", "DKK", "Act/360", "DKK", "TN", -1,
  142.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  143.             _mapJurisdictionOvernightIndex.put ("DKK", oiDKK);

  144.             _mapNamedOvernightIndex.put ("DKK-DNBTN", oiDKK);

  145.             _mapNamedOvernightIndex.put ("DKK-DNB TN", oiDKK);

  146.             org.drip.market.definition.OvernightIndex oiEUR = new org.drip.market.definition.OvernightIndex
  147.                 ("EUR-EONIA", "EONIA", "EUR", "Act/360", "EUR", "ON", 0,
  148.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  149.             _mapJurisdictionOvernightIndex.put ("EUR", oiEUR);

  150.             _mapNamedOvernightIndex.put ("EUR-EONIA", oiEUR);

  151.             org.drip.market.definition.OvernightIndex oiGBP = new org.drip.market.definition.OvernightIndex
  152.                 ("GBP-SONIA", "SONIA", "GBP", "Act/365", "GBP", "ON", 0,
  153.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  154.             _mapJurisdictionOvernightIndex.put ("GBP", oiGBP);

  155.             _mapNamedOvernightIndex.put ("GBP-SONIA", oiGBP);

  156.             org.drip.market.definition.OvernightIndex oiHKD = new org.drip.market.definition.OvernightIndex
  157.                 ("HKD-HONIX", "HONIX", "HKD", "Act/365", "HKD", "ON", 0,
  158.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  159.             _mapJurisdictionOvernightIndex.put ("HKD", oiHKD);

  160.             _mapNamedOvernightIndex.put ("HKD-HONIX", oiHKD);

  161.             org.drip.market.definition.OvernightIndex oiHUF = new org.drip.market.definition.OvernightIndex
  162.                 ("HUF-HUFONIA", "HUFONIA", "HUF", "Act/360", "HUF", "ON", 0,
  163.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  164.             _mapJurisdictionOvernightIndex.put ("HUF", oiHUF);

  165.             _mapNamedOvernightIndex.put ("HUF-HUFONIA", oiHUF);

  166.             org.drip.market.definition.OvernightIndex oiINR = new org.drip.market.definition.OvernightIndex
  167.                 ("INR-ON MIBOR", "MIBOR", "INR", "Act/365", "INR", "ON", 0,
  168.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  169.             _mapJurisdictionOvernightIndex.put ("INR", oiINR);

  170.             _mapNamedOvernightIndex.put ("INR-MIBOR", oiINR);

  171.             _mapNamedOvernightIndex.put ("INR-ON MIBOR", oiINR);

  172.             org.drip.market.definition.OvernightIndex oiINR2 = new org.drip.market.definition.OvernightIndex
  173.                 ("INR-MITOR", "MITOR", "INR", "Act/365", "INR", "TN", 0,
  174.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  175.             _mapJurisdictionOvernightIndex.put ("INR2", oiINR2);

  176.             _mapNamedOvernightIndex.put ("INR-MITOR", oiINR2);

  177.             org.drip.market.definition.OvernightIndex oiJPY = new org.drip.market.definition.OvernightIndex
  178.                 ("JPY-TONAR", "TONAR", "JPY", "Act/365", "JPY", "ON", 1,
  179.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  180.             _mapJurisdictionOvernightIndex.put ("JPY", oiJPY);

  181.             _mapNamedOvernightIndex.put ("JPY-TONAR", oiJPY);

  182.             org.drip.market.definition.OvernightIndex oiNZD = new org.drip.market.definition.OvernightIndex
  183.                 ("NZD-NZIONA", "NZIONA", "NZD", "Act/365", "NZD", "ON", 0,
  184.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  185.             _mapJurisdictionOvernightIndex.put ("NZD", oiNZD);

  186.             _mapNamedOvernightIndex.put ("NZD-NZIONA", oiNZD);

  187.             org.drip.market.definition.OvernightIndex oiPLN = new org.drip.market.definition.OvernightIndex
  188.                 ("PLN-POLONIA", "POLONIA", "PLN", "Act/365", "PLN", "ON", 0,
  189.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  190.             _mapJurisdictionOvernightIndex.put ("PLN", oiPLN);

  191.             _mapNamedOvernightIndex.put ("PLN-POLONIA", oiPLN);

  192.             org.drip.market.definition.OvernightIndex oiSEK = new org.drip.market.definition.OvernightIndex
  193.                 ("SEK-SIOR TN STIBOR", "STIBOR", "SEK", "Act/360", "SEK", "ON", -1,
  194.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  195.             _mapJurisdictionOvernightIndex.put ("SEK", oiSEK);

  196.             _mapNamedOvernightIndex.put ("SEK-SIOR", oiSEK);

  197.             _mapNamedOvernightIndex.put ("SEK-SIOR TN STIBOR", oiSEK);

  198.             _mapNamedOvernightIndex.put ("SEK-STIBOR", oiSEK);

  199.             org.drip.market.definition.OvernightIndex oiSGD = new org.drip.market.definition.OvernightIndex
  200.                 ("SGD-SONAR", "SONAR", "SGD", "Act/365", "SGD", "ON", 0,
  201.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  202.             _mapJurisdictionOvernightIndex.put ("SGD", oiSGD);

  203.             _mapNamedOvernightIndex.put ("SGD-SONAR", oiSGD);

  204.             org.drip.market.definition.OvernightIndex oiUSD = new org.drip.market.definition.OvernightIndex
  205.                 ("USD-Fed Fund", "FedFund", "USD", "Act/360", "USD", "ON", 1,
  206.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_ARITHMETIC);

  207.             _mapJurisdictionOvernightIndex.put ("USD", oiUSD);

  208.             _mapNamedOvernightIndex.put ("USD-Fed Fund", oiUSD);

  209.             _mapNamedOvernightIndex.put ("USD-FedFund", oiUSD);

  210.             org.drip.market.definition.OvernightIndex oiZAR = new org.drip.market.definition.OvernightIndex
  211.                 ("ZAR-SAFEX ON Dep Rate", "SAFEX", "ZAR", "Act/365", "ZAR", "ON", 0,
  212.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  213.             _mapJurisdictionOvernightIndex.put ("ZAR", oiZAR);

  214.             _mapNamedOvernightIndex.put ("ZAR-SAFEX", oiZAR);

  215.             _mapNamedOvernightIndex.put ("ZAR-SAFEX ON Dep Rate", oiZAR);

  216.             org.drip.market.definition.OvernightIndex oiZAR2 = new org.drip.market.definition.OvernightIndex
  217.                 ("ZAR-SAONIA", "SAONIA", "ZAR", "Act/365", "ZAR", "ON", 0,
  218.                     org.drip.analytics.support.CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC);

  219.             _mapJurisdictionOvernightIndex.put ("ZAR2", oiZAR2);

  220.             _mapNamedOvernightIndex.put ("ZAR-SAONIA", oiZAR2);
  221.         } catch (java.lang.Exception e) {
  222.             e.printStackTrace();

  223.             return false;
  224.         }

  225.         return true;
  226.     }

  227.     /**
  228.      * Retrieve the Overnight Index from the Jurisdiction Name
  229.      *
  230.      * @param strName The Overnight Index Jurisdiction Name
  231.      *
  232.      * @return The Overnight Index
  233.      */

  234.     public static final org.drip.market.definition.OvernightIndex IndexFromJurisdiction (
  235.         final java.lang.String strName)
  236.     {
  237.         return _mapJurisdictionOvernightIndex.containsKey (strName) ? _mapJurisdictionOvernightIndex.get
  238.             (strName) : null;
  239.     }

  240.     /**
  241.      * Retrieve the Overnight Index from the Index Name
  242.      *
  243.      * @param strName The Overnight Index Index Name
  244.      *
  245.      * @return The Overnight Index
  246.      */

  247.     public static final org.drip.market.definition.OvernightIndex IndexFromName (
  248.         final java.lang.String strName)
  249.     {
  250.         return _mapNamedOvernightIndex.containsKey (strName) ? _mapNamedOvernightIndex.get (strName) : null;
  251.     }
  252. }