CDXRefData.java

  1. package org.drip.feed.loader;

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

  81. /**
  82.  * <i>CDXRefData</i> contains the functionality to load the standard CDX reference data and definitions, and
  83.  * create compile time static classes for these definitions.
  84.  *
  85.  *  <br><br>
  86.  *  <ul>
  87.  *      <li><b>Module </b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ComputationalCore.md">Computational Core Module</a></li>
  88.  *      <li><b>Library</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/ComputationSupportLibrary.md">Computation Support</a></li>
  89.  *      <li><b>Project</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/feed/README.md">Load, Transform, and compute Target Metrics across Feeds</a></li>
  90.  *      <li><b>Package</b> = <a href = "https://github.com/lakshmiDRIP/DROP/tree/master/src/main/java/org/drip/feed/loader/README.md">Reference/Market Data Feed Loader</a></li>
  91.  *  </ul>
  92.  *
  93.  * @author Lakshmi Krishnamurthy
  94.  */

  95. public class CDXRefData {
  96.     private static final boolean s_bBlog = false;
  97.     private static final boolean s_bSuppressErr = true;
  98.     private static final boolean s_bPrintCDXRefDataDump = false;

  99.     private static final org.drip.product.params.CDXRefDataParams CreateCDXRefDataFromRecord (
  100.         final java.lang.String[] astrArgs,
  101.         final java.io.BufferedWriter bw)
  102.     {
  103.         if (null == astrArgs || 43 != astrArgs.length) System.exit (333);

  104.         java.lang.String strCurveID = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[0],
  105.             false);

  106.         if (s_bBlog) System.out.println ("Curve ID: " + strCurveID);

  107.         java.lang.String strSPN = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[1], false);

  108.         if (s_bBlog) System.out.println ("SPN: " + strSPN);

  109.         java.lang.String strIndexLabel = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[2],
  110.             false);

  111.         if (s_bBlog) System.out.println ("Index Label: " + strIndexLabel);

  112.         java.lang.String strIndexName = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[3],
  113.             false);

  114.         if (s_bBlog) System.out.println ("Index Name: " + strIndexName);

  115.         java.lang.String strCurveName = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[4],
  116.             false);

  117.         if (s_bBlog) System.out.println ("Curve Name: " + strCurveName);

  118.         org.drip.analytics.date.JulianDate dtIssueDate =
  119.             org.drip.analytics.date.DateUtil.MakeJulianFromDDMMMYY
  120.                 (org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[5], false), "-");

  121.         if (null == dtIssueDate) {
  122.             System.out.println ("Bad Issue Date for Curve ID " + strCurveID);

  123.             return null;
  124.         }

  125.         if (s_bBlog) System.out.println ("Issue Date: " + dtIssueDate);

  126.         org.drip.analytics.date.JulianDate dtMaturityDate =
  127.             org.drip.analytics.date.DateUtil.MakeJulianFromDDMMMYY
  128.                 (org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[6], false), "-");

  129.         if (null == dtMaturityDate) {
  130.             System.out.println ("Bad Maturity Date for Curve ID " + strCurveID);

  131.             return null;
  132.         }

  133.         if (s_bBlog) System.out.println ("Maturity Date: " + dtMaturityDate);

  134.         double dblCoupon = java.lang.Double.NaN;

  135.         try {
  136.             dblCoupon = 0.0001 * java.lang.Double.parseDouble (astrArgs[7]);
  137.         } catch (java.lang.Exception e) {
  138.             if (!s_bSuppressErr) e.printStackTrace();

  139.             dblCoupon = 0.;
  140.         }

  141.         if (s_bBlog) System.out.println ("Coupon: " + dblCoupon);

  142.         java.lang.String strCurrency = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[8],
  143.             false);

  144.         if (s_bBlog) System.out.println ("Currency: " + strCurrency);

  145.         java.lang.String strDayCount = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[9],
  146.             false);

  147.         if (s_bBlog) System.out.println ("DayCount: " + strDayCount);

  148.         java.lang.String strFullFirstStub = org.drip.numerical.common.StringUtil.ProcessInputForNULL
  149.             (astrArgs[10], false);

  150.         boolean bFullFirstStub = "lf".equalsIgnoreCase (strFullFirstStub);

  151.         if (s_bBlog) System.out.println ("Full First Stub: " + bFullFirstStub);

  152.         double dblRecovery = java.lang.Double.NaN;

  153.         try {
  154.             dblRecovery = 0.01 * java.lang.Double.parseDouble (astrArgs[11]);
  155.         } catch (java.lang.Exception e) {
  156.             if (!s_bSuppressErr) e.printStackTrace();

  157.             dblRecovery = 0.;
  158.         }

  159.         if (s_bBlog) System.out.println ("Recovery: " + dblRecovery);

  160.         int iFrequency = 0;

  161.         java.lang.String strFrequency = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[12],
  162.             false);

  163.         if ("Q".equalsIgnoreCase (strFrequency))
  164.             iFrequency = 4;
  165.         else if ("S".equalsIgnoreCase (strFrequency))
  166.             iFrequency = 2;

  167.         if (s_bBlog) System.out.println ("Frequency: " + iFrequency);

  168.         java.lang.String strRedID = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[13],
  169.             false);

  170.         if (s_bBlog) System.out.println ("RedID: " + strRedID);

  171.         java.lang.String strIndexClass = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[14],
  172.             false);

  173.         if (s_bBlog) System.out.println ("Index Class: " + strIndexClass);

  174.         int iIndexSeries = 0;

  175.         try {
  176.             iIndexSeries = java.lang.Integer.parseInt (astrArgs[15]);
  177.         } catch (java.lang.Exception e) {
  178.             if (!s_bSuppressErr) e.printStackTrace();
  179.         }

  180.         if (s_bBlog) System.out.println ("Index Series: " + iIndexSeries);

  181.         java.lang.String strIndexGroupName = org.drip.numerical.common.StringUtil.ProcessInputForNULL
  182.             (astrArgs[16], false);

  183.         if (s_bBlog) System.out.println ("Index Group Name: " + strIndexGroupName);

  184.         java.lang.String strIndexShortName = org.drip.numerical.common.StringUtil.ProcessInputForNULL
  185.             (astrArgs[17], false);

  186.         if (s_bBlog) System.out.println ("Index Short Name: " + strIndexShortName);

  187.         java.lang.String strIndexShortGroupName = org.drip.numerical.common.StringUtil.ProcessInputForNULL
  188.             (astrArgs[18], false);

  189.         if (s_bBlog) System.out.println ("Index Short Group Name: " + strIndexShortGroupName);

  190.         int iIndexVersion = 0;

  191.         try {
  192.             iIndexVersion = java.lang.Integer.parseInt (astrArgs[19]);
  193.         } catch (java.lang.Exception e) {
  194.             if (!s_bSuppressErr) e.printStackTrace();
  195.         }

  196.         if (s_bBlog) System.out.println ("Index Version: " + iIndexVersion);

  197.         int iIndexLifeSpan = 0;

  198.         try {
  199.             iIndexLifeSpan = java.lang.Integer.parseInt (astrArgs[20]);
  200.         } catch (java.lang.Exception e) {
  201.             if (!s_bSuppressErr) e.printStackTrace();
  202.         }

  203.         if (s_bBlog) System.out.println ("Index Life Span: " + iIndexLifeSpan);

  204.         java.lang.String strCurvyCurveID = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[21],
  205.             false);

  206.         if (s_bBlog) System.out.println ("Curvy Curve ID: " + strCurvyCurveID);

  207.         double dblIndexFactor = java.lang.Double.NaN;

  208.         try {
  209.             dblIndexFactor = 0.01 * java.lang.Double.parseDouble (astrArgs[22]);
  210.         } catch (java.lang.Exception e) {
  211.             if (!s_bSuppressErr) e.printStackTrace();
  212.         }

  213.         if (s_bBlog) System.out.println ("Index Factor: " + dblIndexFactor);

  214.         int iOriginalComponentCount = 0;

  215.         try {
  216.             iOriginalComponentCount = java.lang.Integer.parseInt (astrArgs[23]);
  217.         } catch (java.lang.Exception e) {
  218.             if (!s_bSuppressErr) e.printStackTrace();
  219.         }

  220.         if (s_bBlog) System.out.println ("Original Component Count: " + iOriginalComponentCount);

  221.         int iDefaultedComponentCount = 0;

  222.         try {
  223.             java.lang.Integer.parseInt (astrArgs[24]);
  224.         } catch (java.lang.Exception e) {
  225.             if (!s_bSuppressErr) e.printStackTrace();
  226.         }

  227.         if (s_bBlog) System.out.println ("Defaulted Component Count: " + iDefaultedComponentCount);

  228.         java.lang.String strLocation = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[26],
  229.             false);

  230.         if (s_bBlog) System.out.println ("Location: " + strLocation);

  231.         boolean bPayAccrued = "1".equalsIgnoreCase (astrArgs[27]);

  232.         if (s_bBlog) System.out.println ("Pay Accrued: " + bPayAccrued);

  233.         boolean bKnockOutOnDefault = "1".equalsIgnoreCase (astrArgs[28]);

  234.         if (s_bBlog) System.out.println ("KO Def: " + bKnockOutOnDefault);

  235.         boolean bQuoteAsCDS = "1".equalsIgnoreCase (astrArgs[33]);

  236.         if (s_bBlog) System.out.println ("Quote As CDS: " + bQuoteAsCDS);

  237.         java.lang.String strBBGTicker = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[41],
  238.             false);

  239.         if (s_bBlog) System.out.println ("BBG Ticker: " + strBBGTicker);

  240.         java.lang.String strShortName = org.drip.numerical.common.StringUtil.ProcessInputForNULL (astrArgs[42],
  241.             false);

  242.         if (s_bBlog) System.out.println ("Short Name: " + strShortName);

  243.         org.drip.product.params.CDXRefDataParams cdxrd =
  244.             org.drip.product.params.CDXRefDataParams.CreateCDXRefDataBuilder (strCurveID, strSPN,
  245.                 strIndexLabel, strIndexName, strCurveName, dtIssueDate.julian(),
  246.                     dtMaturityDate.julian(), dblCoupon, strCurrency, strDayCount, bFullFirstStub,
  247.                         dblRecovery, iFrequency, strRedID, strIndexClass, iIndexSeries, strIndexGroupName,
  248.                             strIndexShortName, strIndexShortGroupName, iIndexVersion, iIndexLifeSpan,
  249.                                 strCurvyCurveID, dblIndexFactor, iOriginalComponentCount,
  250.                                     iDefaultedComponentCount, strLocation, bPayAccrued, bKnockOutOnDefault,
  251.                                         bQuoteAsCDS, strBBGTicker, strShortName);

  252.         if (s_bBlog) System.out.println ("CDXRD = " + cdxrd);

  253.         if (null == cdxrd) return null;

  254.         java.lang.String strCDXRD = cdxrd.setConstructionString();

  255.         if (s_bPrintCDXRefDataDump) System.out.println (strCDXRD);

  256.         try {
  257.             if (null != bw) {
  258.                 bw.write (strCDXRD);

  259.                 bw.flush();
  260.             }
  261.         } catch (java.lang.Exception e) {
  262.             e.printStackTrace();
  263.         }

  264.         return cdxrd;
  265.     }

  266.     private static final boolean LoadCDXDefinitions (
  267.         final java.lang.String strCDXRefDataFile)
  268.     {
  269.         if (null == strCDXRefDataFile || strCDXRefDataFile.isEmpty()) {
  270.             System.out.println ("Invalid CDX Ref Data File: " + strCDXRefDataFile);

  271.             return false;
  272.         }

  273.         int iNumIndices = 0;
  274.         int iNumFunctions = 0;
  275.         int iNumFailedToLoad = 0;
  276.         int iNumIndicesPerFunction = 100;
  277.         java.io.BufferedWriter bw = null;
  278.         java.lang.String strCDXRefDataLine = "";
  279.         java.io.BufferedReader iobrCDXRefData = null;

  280.         try {
  281.             iobrCDXRefData = new java.io.BufferedReader (new java.io.FileReader (strCDXRefDataFile));
  282.         } catch (java.lang.Exception e) {
  283.             e.printStackTrace();

  284.             return false;
  285.         }

  286.         try {
  287.             bw = new java.io.BufferedWriter (new java.io.FileWriter
  288.                 ("C:\\Lakshmi\\BondAnal\\org\\drip\\product\\creator\\CDXRefDataHolder.java"));

  289.             bw.write ("\npackage org.drip.product.creator;\n\n");

  290.             bw.write
  291.                 ("/*\n * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-\n */\n");

  292.             bw.write ("\n/*\n *    GENERATED on " + new java.util.Date().toString() +
  293.                 " ---- DO NOT DELETE\n */\n");

  294.             bw.write ("\n/*!\n * Copyright (C) 2012 Lakshmi Krishnamurthy\n *\n");

  295.             bw.write (" * This file is part of CreditAnalytics, a free-software/open-source library for\n");

  296.             bw.write
  297.                 (" *        fixed income analysts and developers - http://www.credit-trader.org\n *\n");

  298.             bw.write
  299.                 (" * CreditAnalytics is a free, full featured, fixed income credit analytics library,\n");

  300.             bw.write (" *       developed with a special focus");

  301.             bw.write (" towards the needs of the bonds and credit products community.\n *\n");

  302.             bw.write (" *  Licensed under the Apache License, Version 2.0 (the \"License\");\n");

  303.             bw.write (" *       you may not use this file except in compliance with the License.\n");

  304.             bw.write (" *\n *  You may obtain a copy of the License at\n");

  305.             bw.write (" *   http://www.apache.org/licenses/LICENSE-2.0\n *\n");

  306.             bw.write (" *  Unless required by applicable law or agreed to in writing, software\n");

  307.             bw.write (" *   distributed under the License is distributed on an \"AS IS\" BASIS,\n");

  308.             bw.write (" *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n");

  309.             bw.write (" *  \n *  See the License for the specific language governing permissions and\n");

  310.             bw.write (" *   limitations under the License.\n */\n\n");

  311.             bw.write ("public class CDXRefDataHolder {\n\tpublic ");

  312.             bw.write ("static org.drip.analytics.support.CaseInsensitiveMap<org.drip.product.creator.CDXRefDataBuilder> ");

  313.             bw.write ("_mapCDXRefData\n\t\t= new ");

  314.             bw.write ("org.drip.analytics.support.AnalyticsHelper.CaseInsensitiveMap<org.drip.product.creator.CDXRefDataBuilder>();");

  315.             bw.write ("\n\n\tpublic static org.drip.analytics.support.CaseInsensitiveMap<");

  316.             bw.write ("java.util.Map<org.drip.analytics.date.JulianDate,\n\t\tjava.lang.Integer>> ");

  317.             bw.write ("_mmCDXRDBFirstCouponSeries = new org.drip.analytics.support.CaseInsensitiveMap<\n\t\t\t");

  318.             bw.write ("java.util.Map<org.drip.analytics.date.JulianDate, java.lang.Integer>>();\n\n\t");

  319.             bw.write ("public static org.drip.analytics.support.CaseInsensitiveMap<java.util.Map<java.lang.Integer,");

  320.             bw.write ("\n\t\torg.drip.analytics.date.JulianDate>> _mmCDXRDBSeriesFirstCoupon = new ");

  321.             bw.write ("org.drip.analytics.support.CaseInsensitiveMap<\n\t\t\t");

  322.             bw.write ("java.util.Map<java.lang.Integer, org.drip.analytics.date.JulianDate>>();\n\n\t");

  323.             bw.write ("private static final boolean UpdateCDXRefDataMap (\n\t\tfinal java.lang.String ");

  324.             bw.write ("strCDXName,\n\t\tfinal org.drip.product.creator.CDXRefDataBuilder cdxrd)\n\t{\n");

  325.             bw.write ("\t\tif (null == cdxrd) {\n");

  326.             bw.write ("\t\t\tSystem.out.println (\"No CDX ref data for \" + strCDXName);\n\n");

  327.             bw.write ("\t\t\treturn false;\n\t\t}\n\n");

  328.             bw.write ("\t\t_mapCDXRefData.put (strCDXName, cdxrd);\n\n\t\t");

  329.             bw.write ("java.util.Map<org.drip.analytics.date.JulianDate, java.lang.Integer> ");

  330.             bw.write ("mapFirstCouponSeries =\n\t\t\t_mmCDXRDBFirstCouponSeries.get ");

  331.             bw.write ("(cdxrd._strIndexClass + \".\" + cdxrd._strIndexGroupName);\n\n\t\t");

  332.             bw.write ("if (null == mapFirstCouponSeries)\n\t\t\tmapFirstCouponSeries = new ");

  333.             bw.write ("java.util.TreeMap<org.drip.analytics.date.JulianDate, java.lang.Integer>();\n\n\t\t");

  334.             bw.write ("mapFirstCouponSeries.put (cdxrd._dtMaturity.subtractTenor (cdxrd._iIndexLifeSpan + ");

  335.             bw.write ("\"Y\"),\n\t\t\tcdxrd._iIndexSeries);");

  336.             bw.write ("\n\n\t\t_mmCDXRDBFirstCouponSeries.put (cdxrd._strIndexClass + \".\" + ");

  337.             bw.write ("cdxrd._strIndexGroupName,\n\t\t\tmapFirstCouponSeries);\n\n");

  338.             bw.write ("\t\tjava.util.Map<java.lang.Integer, org.drip.analytics.date.JulianDate> ");

  339.             bw.write ("mapSeriesFirstCoupon = \n\t\t\t");

  340.             bw.write ("_mmCDXRDBSeriesFirstCoupon.get (cdxrd._strIndexClass + \".\" + ");

  341.             bw.write ("cdxrd._strIndexGroupName);\n\n");

  342.             bw.write ("\t\tif (null == mapSeriesFirstCoupon)\n");

  343.             bw.write ("\t\t\tmapSeriesFirstCoupon = new java.util.TreeMap<java.lang.Integer, ");

  344.             bw.write ("org.drip.analytics.date.JulianDate>();\n\n");

  345.             bw.write ("\t\tmapSeriesFirstCoupon.put (cdxrd._iIndexSeries, cdxrd._dtMaturity.subtractTenor ");

  346.             bw.write ("(cdxrd._iIndexLifeSpan\n\t\t\t+ \"Y\"));\n\n");

  347.             bw.write ("\t\t_mmCDXRDBSeriesFirstCoupon.put (cdxrd._strIndexClass + \".\" + ");

  348.             bw.write ("cdxrd._strIndexGroupName,\n\t\t\tmapSeriesFirstCoupon);\n\n");

  349.             bw.write ("\t\treturn true;\n\t}\n");

  350.             bw.write ("\n\tprivate static final boolean InitCDXRefDataSet" + ++iNumFunctions + "()\n\t{\n");

  351.             while (null != (strCDXRefDataLine = iobrCDXRefData.readLine())) {
  352.                 ++iNumIndices;

  353.                 java.lang.String[] astrCDXRefDataRecord = strCDXRefDataLine.split (",");

  354.                 org.drip.product.params.CDXRefDataParams cdxrd = CreateCDXRefDataFromRecord
  355.                     (astrCDXRefDataRecord, bw);

  356.                 if (null == cdxrd)
  357.                     System.out.println (++iNumFailedToLoad + " / " + iNumIndices + " failed to load!");

  358.                 if (0 == (iNumIndices % iNumIndicesPerFunction)) {
  359.                     bw.write ("\t\treturn true;\n\t}\n\n\tprivate ");

  360.                     bw.write ("static final boolean InitCDXRefDataSet" + ++iNumFunctions + "()\n\t{\n");
  361.                 }
  362.             }

  363.             bw.write ("\t\treturn true;\n\t}\n\n\t");

  364.             bw.write ("public static final boolean InitFullCDXRefDataSet()\n\t{\n");

  365.             for (int i = 1 ; i <= iNumFunctions; ++i)
  366.                 bw.write ("\t\tif (!InitCDXRefDataSet" + i + "()) return false;\n\n");

  367.             bw.write ("\t\treturn true;\n\t}\n}\n");

  368.             bw.close();

  369.             iobrCDXRefData.close();
  370.         } catch (java.lang.Exception e) {
  371.             e.printStackTrace();

  372.             return false;
  373.         }

  374.         System.out.println (iNumFailedToLoad + " / " + iNumIndices + " failed to load!");

  375.         return true;
  376.     }

  377.     public static void main (
  378.         final java.lang.String[] astrArgs)
  379.     {
  380.         LoadCDXDefinitions ("C:\\Lakshmi\\RefDataAndMarks\\CDXRefData1Raw.csv");
  381.     }
  382. }