FixFloatForwardCurve.java

  1. package org.drip.sample.multicurve;

  2. import java.util.*;

  3. import org.drip.analytics.date.*;
  4. import org.drip.analytics.support.*;
  5. import org.drip.market.otc.*;
  6. import org.drip.numerical.common.FormatUtil;
  7. import org.drip.param.creator.*;
  8. import org.drip.param.market.CurveSurfaceQuoteContainer;
  9. import org.drip.param.period.*;
  10. import org.drip.param.valuation.*;
  11. import org.drip.product.creator.*;
  12. import org.drip.product.definition.CalibratableComponent;
  13. import org.drip.product.rates.*;
  14. import org.drip.service.env.EnvManager;
  15. import org.drip.spline.basis.*;
  16. import org.drip.spline.stretch.MultiSegmentSequenceBuilder;
  17. import org.drip.state.creator.*;
  18. import org.drip.state.discount.*;
  19. import org.drip.state.forward.ForwardCurve;
  20. import org.drip.state.identifier.ForwardLabel;

  21. /*
  22.  * -*- mode: java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  23.  */

  24. /*!
  25.  * Copyright (C) 2018 Lakshmi Krishnamurthy
  26.  * Copyright (C) 2017 Lakshmi Krishnamurthy
  27.  * Copyright (C) 2016 Lakshmi Krishnamurthy
  28.  * Copyright (C) 2015 Lakshmi Krishnamurthy
  29.  * Copyright (C) 2014 Lakshmi Krishnamurthy
  30.  *
  31.  *  This file is part of DRIP, a free-software/open-source library for buy/side financial/trading model
  32.  *      libraries targeting analysts and developers
  33.  *      https://lakshmidrip.github.io/DRIP/
  34.  *  
  35.  *  DRIP is composed of four main libraries:
  36.  *  
  37.  *  - DRIP Fixed Income - https://lakshmidrip.github.io/DRIP-Fixed-Income/
  38.  *  - DRIP Asset Allocation - https://lakshmidrip.github.io/DRIP-Asset-Allocation/
  39.  *  - DRIP Numerical Optimizer - https://lakshmidrip.github.io/DRIP-Numerical-Optimizer/
  40.  *  - DRIP Statistical Learning - https://lakshmidrip.github.io/DRIP-Statistical-Learning/
  41.  *
  42.  *  - DRIP Fixed Income: Library for Instrument/Trading Conventions, Treasury Futures/Options,
  43.  *      Funding/Forward/Overnight Curves, Multi-Curve Construction/Valuation, Collateral Valuation and XVA
  44.  *      Metric Generation, Calibration and Hedge Attributions, Statistical Curve Construction, Bond RV
  45.  *      Metrics, Stochastic Evolution and Option Pricing, Interest Rate Dynamics and Option Pricing, LMM
  46.  *      Extensions/Calibrations/Greeks, Algorithmic Differentiation, and Asset Backed Models and Analytics.
  47.  *
  48.  *  - DRIP Asset Allocation: Library for model libraries for MPT framework, Black Litterman Strategy
  49.  *      Incorporator, Holdings Constraint, and Transaction Costs.
  50.  *
  51.  *  - DRIP Numerical Optimizer: Library for Numerical Optimization and Spline Functionality.
  52.  *
  53.  *  - DRIP Statistical Learning: Library for Statistical Evaluation and Machine Learning.
  54.  *
  55.  *  Licensed under the Apache License, Version 2.0 (the "License");
  56.  *      you may not use this file except in compliance with the License.
  57.  *  
  58.  *  You may obtain a copy of the License at
  59.  *      http://www.apache.org/licenses/LICENSE-2.0
  60.  *  
  61.  *  Unless required by applicable law or agreed to in writing, software
  62.  *      distributed under the License is distributed on an "AS IS" BASIS,
  63.  *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  64.  *  
  65.  *  See the License for the specific language governing permissions and
  66.  *      limitations under the License.
  67.  */

  68. /**
  69.  * FixFloatForwardCurve contains the sample demonstrating the full functionality behind creating highly
  70.  *  customized spline based forward curves from fix-float swaps and the discount curves.
  71.  *
  72.  * @author Lakshmi Krishnamurthy
  73.  */

  74. public class FixFloatForwardCurve {

  75.     private static final FixFloatComponent OTCFixFloat (
  76.         final JulianDate dtSpot,
  77.         final String strCurrency,
  78.         final String strMaturityTenor,
  79.         final double dblCoupon)
  80.     {
  81.         FixedFloatSwapConvention ffConv = IBORFixedFloatContainer.ConventionFromJurisdiction (
  82.             strCurrency,
  83.             "ALL",
  84.             strMaturityTenor,
  85.             "MAIN"
  86.         );

  87.         return ffConv.createFixFloatComponent (
  88.             dtSpot,
  89.             strMaturityTenor,
  90.             dblCoupon,
  91.             0.,
  92.             1.
  93.         );
  94.     }

  95.     /*
  96.      * Construct the Array of Deposit Instruments from the given set of parameters
  97.      *
  98.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  99.      */

  100.     private static final CalibratableComponent[] DepositInstrumentsFromMaturityDays (
  101.         final JulianDate dtEffective,
  102.         final int[] aiDay,
  103.         final int iNumFutures,
  104.         final String strCurrency)
  105.         throws Exception
  106.     {
  107.         CalibratableComponent[] aCalibComp = new CalibratableComponent[aiDay.length + iNumFutures];

  108.         for (int i = 0; i < aiDay.length; ++i)
  109.             aCalibComp[i] = SingleStreamComponentBuilder.Deposit (
  110.                 dtEffective,
  111.                 dtEffective.addBusDays (
  112.                     aiDay[i],
  113.                     strCurrency
  114.                 ),
  115.                 ForwardLabel.Create (
  116.                     strCurrency,
  117.                     "3M"
  118.                 )
  119.             );

  120.         CalibratableComponent[] aEDF = SingleStreamComponentBuilder.ForwardRateFuturesPack (
  121.             dtEffective,
  122.             iNumFutures,
  123.             strCurrency
  124.         );

  125.         for (int i = aiDay.length; i < aiDay.length + iNumFutures; ++i)
  126.             aCalibComp[i] = aEDF[i - aiDay.length];

  127.         return aCalibComp;
  128.     }

  129.     /*
  130.      * Construct the Array of Swap Instruments from the given set of parameters
  131.      *
  132.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  133.      */

  134.     private static final CalibratableComponent[] SwapInstrumentsFromMaturityTenor (
  135.         final JulianDate dtSpot,
  136.         final String strCurrency,
  137.         final String[] astrMaturityTenor,
  138.         final double[] adblCoupon)
  139.         throws Exception
  140.     {
  141.         FixFloatComponent[] aIRS = new FixFloatComponent[astrMaturityTenor.length];

  142.         for (int i = 0; i < astrMaturityTenor.length; ++i)
  143.             aIRS[i] = OTCFixFloat (
  144.                 dtSpot,
  145.                 strCurrency,
  146.                 astrMaturityTenor[i],
  147.                 adblCoupon[i]
  148.             );

  149.         return aIRS;
  150.     }

  151.     /*
  152.      * Construct the discount curve using the following steps:
  153.      *  - Construct the array of cash instruments and their quotes.
  154.      *  - Construct the array of swap instruments and their quotes.
  155.      *  - Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments.
  156.      *
  157.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  158.      */

  159.     private static final MergedDiscountForwardCurve MakeDC (
  160.         final JulianDate dtSpot,
  161.         final String strCurrency,
  162.         final double dblBump)
  163.         throws Exception
  164.     {
  165.         /*
  166.          * Construct the array of Deposit instruments and their quotes.
  167.          */

  168.         CalibratableComponent[] aDepositComp = DepositInstrumentsFromMaturityDays (
  169.             dtSpot,
  170.             new int[] {},
  171.             0,
  172.             strCurrency
  173.         );

  174.         double[] adblDepositQuote = new double[] {};

  175.         /*
  176.          * Construct the array of Swap instruments and their quotes.
  177.          */

  178.         double[] adblSwapQuote = new double[] {
  179.             // 0.00092 + dblBump,     //  6M
  180.             0.0009875 + dblBump,   //  9M
  181.             0.00122 + dblBump,     //  1Y
  182.             0.00223 + dblBump,     // 18M
  183.             0.00383 + dblBump,     //  2Y
  184.             0.00827 + dblBump,     //  3Y
  185.             0.01245 + dblBump,     //  4Y
  186.             0.01605 + dblBump,     //  5Y
  187.             0.02597 + dblBump      // 10Y
  188.         };

  189.         String[] astrSwapManifestMeasure = new String[] {
  190.             // "SwapRate",     //  6M
  191.             "SwapRate",     //  9M
  192.             "SwapRate",     //  1Y
  193.             "SwapRate",     // 18M
  194.             "SwapRate",     //  2Y
  195.             "SwapRate",     //  3Y
  196.             "SwapRate",     //  4Y
  197.             "SwapRate",     //  5Y
  198.             "SwapRate"      // 10Y
  199.         };

  200.         CalibratableComponent[] aSwapComp = SwapInstrumentsFromMaturityTenor (
  201.             dtSpot,
  202.             strCurrency,
  203.             new java.lang.String[] {
  204.                 "9M", "1Y", "18M", "2Y", "3Y", "4Y", "5Y", "10Y"
  205.             },
  206.             adblSwapQuote
  207.         );

  208.         /*
  209.          * Construct a shape preserving and smoothing KLK Hyperbolic Spline from the cash/swap instruments.
  210.          */

  211.         return ScenarioDiscountCurveBuilder.CubicKLKHyperbolicDFRateShapePreserver (
  212.             "KLK_HYPERBOLIC_SHAPE_TEMPLATE",
  213.             new ValuationParams (
  214.                 dtSpot,
  215.                 dtSpot,
  216.                 "USD"
  217.             ),
  218.             aDepositComp,
  219.             adblDepositQuote,
  220.             null,
  221.             aSwapComp,
  222.             adblSwapQuote,
  223.             astrSwapManifestMeasure,
  224.             true
  225.         );
  226.     }

  227.     /*
  228.      * Construct an array of fix-float swaps from the fixed reference and the xM floater derived legs.
  229.      *
  230.      *      USE WITH CARE: This sample ignores errors and does not handle exceptions.
  231.      */

  232.     private static final FixFloatComponent[] MakeFixFloatxMSwap (
  233.         final JulianDate dtEffective,
  234.         final String strCurrency,
  235.         final String[] astrMaturityTenor,
  236.         final double[] adblCoupon,
  237.         final int iTenorInMonths)
  238.         throws Exception
  239.     {
  240.         FixFloatComponent[] aFFC = new FixFloatComponent[astrMaturityTenor.length];

  241.         UnitCouponAccrualSetting ucasFixed = new UnitCouponAccrualSetting (
  242.             2,
  243.             "Act/360",
  244.             false,
  245.             "Act/360",
  246.             false,
  247.             strCurrency,
  248.             true,
  249.             CompositePeriodBuilder.ACCRUAL_COMPOUNDING_RULE_GEOMETRIC
  250.         );

  251.         ComposableFloatingUnitSetting cfusFloating = new ComposableFloatingUnitSetting (
  252.             iTenorInMonths + "M",
  253.             CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR,
  254.             null,
  255.             ForwardLabel.Create (
  256.                 strCurrency,
  257.                 iTenorInMonths + "M"
  258.             ),
  259.             CompositePeriodBuilder.REFERENCE_PERIOD_IN_ADVANCE,
  260.             0.
  261.         );

  262.         CompositePeriodSetting cpsFloating = new CompositePeriodSetting (
  263.             12 / iTenorInMonths,
  264.             iTenorInMonths + "M",
  265.             strCurrency,
  266.             null,
  267.             -1.,
  268.             null,
  269.             null,
  270.             null,
  271.             null
  272.         );

  273.         CompositePeriodSetting cpsFixed = new CompositePeriodSetting (
  274.             2,
  275.             "6M",
  276.             strCurrency,
  277.             null,
  278.             1.,
  279.             null,
  280.             null,
  281.             null,
  282.             null
  283.         );

  284.         CashSettleParams csp = new CashSettleParams (
  285.             0,
  286.             strCurrency,
  287.             0
  288.         );

  289.         for (int i = 0; i < astrMaturityTenor.length; ++i) {
  290.             ComposableFixedUnitSetting cfusFixed = new ComposableFixedUnitSetting (
  291.                 "6M",
  292.                 CompositePeriodBuilder.EDGE_DATE_SEQUENCE_REGULAR,
  293.                 null,
  294.                 adblCoupon[i],
  295.                 0.,
  296.                 strCurrency
  297.             );

  298.             List<Integer> lsFixedStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates (
  299.                 dtEffective,
  300.                 "6M",
  301.                 astrMaturityTenor[i],
  302.                 null
  303.             );

  304.             List<Integer> lsFloatingStreamEdgeDate = CompositePeriodBuilder.RegularEdgeDates (
  305.                 dtEffective,
  306.                 iTenorInMonths + "M",
  307.                 astrMaturityTenor[i],
  308.                 null
  309.             );

  310.             Stream floatingStream = new Stream (
  311.                 CompositePeriodBuilder.FloatingCompositeUnit (
  312.                     lsFloatingStreamEdgeDate,
  313.                     cpsFloating,
  314.                     cfusFloating
  315.                 )
  316.             );

  317.             Stream fixedStream = new Stream (
  318.                 CompositePeriodBuilder.FixedCompositeUnit (
  319.                     lsFixedStreamEdgeDate,
  320.                     cpsFixed,
  321.                     ucasFixed,
  322.                     cfusFixed
  323.                 )
  324.             );

  325.             aFFC[i] = new FixFloatComponent (
  326.                 fixedStream,
  327.                 floatingStream,
  328.                 csp
  329.             );
  330.         }

  331.         return aFFC;
  332.     }

  333.     private static final Map<String, ForwardCurve> FixFloatxMBasisSample (
  334.         final JulianDate dtSpot,
  335.         final String strCurrency,
  336.         final MergedDiscountForwardCurve dc,
  337.         final int iTenorInMonths,
  338.         final String[] astrxM6MFwdTenor,
  339.         final String strManifestMeasure,
  340.         final double[] adblxM6MBasisSwapQuote,
  341.         final double[] adblSwapCoupon)
  342.         throws Exception
  343.     {
  344.         System.out.println ("-----------------------------------------------------------------------------------------------------------------------------");

  345.         System.out.println (" SPL =>              n=3              |              n=4               |              KLK               |         |         |");

  346.         System.out.println ("--------------------------------------------------------------------------------------------------------|  LOG DF |  LIBOR  |");

  347.         System.out.println (" MSR =>  RECALC |  REFEREN |  DERIVED |  RECALC  |  REFEREN |  DERIVED |  RECALC  |  REFEREN |  DERIVED |         |         |");

  348.         System.out.println ("-----------------------------------------------------------------------------------------------------------------------------");

  349.         /*
  350.          * Construct the 6M-xM float-float basis swap.
  351.          */

  352.         FixFloatComponent[] aFFC = MakeFixFloatxMSwap (
  353.             dtSpot,
  354.             strCurrency,
  355.             astrxM6MFwdTenor,
  356.             adblSwapCoupon,
  357.             iTenorInMonths
  358.         );

  359.         String strBasisTenor = iTenorInMonths + "M";

  360.         ValuationParams valParams = new ValuationParams (
  361.             dtSpot,
  362.             dtSpot,
  363.             strCurrency
  364.         );

  365.         /*
  366.          * Calculate the starting forward rate off of the discount curve.
  367.          */

  368.         double dblStartingFwd = dc.forward (
  369.             dtSpot.julian(),
  370.             dtSpot.addTenor (strBasisTenor).julian()
  371.         );

  372.         /*
  373.          * Set the discount curve based component market parameters.
  374.          */

  375.         CurveSurfaceQuoteContainer mktParams = MarketParamsBuilder.Create (
  376.             dc,
  377.             null,
  378.             null,
  379.             null,
  380.             null,
  381.             null,
  382.             null
  383.         );

  384.         Map<String, ForwardCurve> mapForward = new HashMap<String, ForwardCurve>();

  385.         /*
  386.          * Construct the shape preserving forward curve off of Cubic Polynomial Basis Spline.
  387.          */

  388.         ForwardCurve fcxMCubic = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve (
  389.             "CUBIC_FWD" + strBasisTenor,
  390.             ForwardLabel.Create (
  391.                 strCurrency,
  392.                 strBasisTenor
  393.             ),
  394.             valParams,
  395.             null,
  396.             mktParams,
  397.             null,
  398.             MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL,
  399.             new PolynomialFunctionSetParams (4),
  400.             aFFC,
  401.             strManifestMeasure,
  402.             adblxM6MBasisSwapQuote,
  403.             dblStartingFwd
  404.         );

  405.         mapForward.put (
  406.             "   CUBIC_FWD" + strBasisTenor,
  407.             fcxMCubic
  408.         );

  409.         /*
  410.          * Set the discount curve + cubic polynomial forward curve based component market parameters.
  411.          */

  412.         CurveSurfaceQuoteContainer mktParamsCubicFwd = MarketParamsBuilder.Create (
  413.             dc,
  414.             fcxMCubic,
  415.             null,
  416.             null,
  417.             null,
  418.             null,
  419.             null,
  420.             null
  421.         );

  422.         /*
  423.          * Construct the shape preserving forward curve off of Quartic Polynomial Basis Spline.
  424.          */

  425.         ForwardCurve fcxMQuartic = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve (
  426.             "QUARTIC_FWD" + strBasisTenor,
  427.             ForwardLabel.Create (
  428.                 strCurrency,
  429.                 strBasisTenor
  430.             ),
  431.             valParams,
  432.             null,
  433.             mktParams,
  434.             null,
  435.             MultiSegmentSequenceBuilder.BASIS_SPLINE_POLYNOMIAL,
  436.             new PolynomialFunctionSetParams (5),
  437.             aFFC,
  438.             strManifestMeasure,
  439.             adblxM6MBasisSwapQuote,
  440.             dblStartingFwd
  441.         );

  442.         mapForward.put (
  443.             " QUARTIC_FWD" + strBasisTenor,
  444.             fcxMQuartic
  445.         );

  446.         /*
  447.          * Set the discount curve + quartic polynomial forward curve based component market parameters.
  448.          */

  449.         CurveSurfaceQuoteContainer mktParamsQuarticFwd = MarketParamsBuilder.Create (
  450.             dc,
  451.             fcxMQuartic,
  452.             null,
  453.             null,
  454.             null,
  455.             null,
  456.             null,
  457.             null
  458.         );

  459.         /*
  460.          * Construct the shape preserving forward curve off of Hyperbolic Tension Based Basis Spline.
  461.          */

  462.         ForwardCurve fcxMKLKHyper = ScenarioForwardCurveBuilder.ShapePreservingForwardCurve (
  463.             "KLKHYPER_FWD" + strBasisTenor,
  464.             ForwardLabel.Create (
  465.                 strCurrency,
  466.                 strBasisTenor
  467.             ),
  468.             valParams,
  469.             null,
  470.             mktParams,
  471.             null,
  472.             MultiSegmentSequenceBuilder.BASIS_SPLINE_KLK_HYPERBOLIC_TENSION,
  473.             new ExponentialTensionSetParams (1.),
  474.             aFFC,
  475.             strManifestMeasure,
  476.             adblxM6MBasisSwapQuote,
  477.             dblStartingFwd
  478.         );

  479.         mapForward.put (
  480.             "KLKHYPER_FWD" + strBasisTenor,
  481.             fcxMKLKHyper
  482.         );

  483.         /*
  484.          * Set the discount curve + hyperbolic tension forward curve based component market parameters.
  485.          */

  486.         CurveSurfaceQuoteContainer mktParamsKLKHyperFwd = MarketParamsBuilder.Create (
  487.             dc,
  488.             fcxMKLKHyper,
  489.             null,
  490.             null,
  491.             null,
  492.             null,
  493.             null,
  494.             null
  495.         );

  496.         int i = 0;
  497.         int iFreq = 12 / iTenorInMonths;

  498.         /*
  499.          * Compute the following forward curve metrics for each of cubic polynomial forward, quartic
  500.          *  polynomial forward, and KLK Hyperbolic tension forward curves:
  501.          *  - Reference Basis Par Spread
  502.          *  - Derived Basis Par Spread
  503.          *
  504.          * Further compare these with a) the forward rate off of the discount curve, b) the LIBOR rate, and
  505.          *  c) Input Basis Swap Quote.
  506.          */

  507.         for (String strMaturityTenor : astrxM6MFwdTenor) {
  508.             int iFwdEndDate = dtSpot.addTenor (strMaturityTenor).julian();

  509.             int iFwdStartDate = dtSpot.addTenor (strMaturityTenor).subtractTenor (strBasisTenor).julian();

  510.             FixFloatComponent ffc = aFFC[i++];

  511.             CaseInsensitiveTreeMap<Double> mapCubicValue = ffc.value (
  512.                 valParams,
  513.                 null,
  514.                 mktParamsCubicFwd,
  515.                 null
  516.             );

  517.             CaseInsensitiveTreeMap<Double> mapQuarticValue = ffc.value (
  518.                 valParams,
  519.                 null,
  520.                 mktParamsQuarticFwd,
  521.                 null
  522.             );

  523.             CaseInsensitiveTreeMap<Double> mapKLKHyperValue = ffc.value (
  524.                 valParams,
  525.                 null,
  526.                 mktParamsKLKHyperFwd,
  527.                 null
  528.             );

  529.             System.out.println (" " + strMaturityTenor + " =>  " +
  530.                 FormatUtil.FormatDouble (fcxMCubic.forward (iFwdStartDate), 2, 2, 100.) + "  |  " +
  531.                 FormatUtil.FormatDouble (mapCubicValue.get ("ReferenceParBasisSpread"), 2, 2, 1.) + "  |  " +
  532.                 FormatUtil.FormatDouble (mapCubicValue.get ("DerivedParBasisSpread"), 2, 2, 1.) + "  |  " +
  533.                 FormatUtil.FormatDouble (fcxMQuartic.forward (iFwdStartDate), 2, 2, 100.) + "  |  " +
  534.                 FormatUtil.FormatDouble (mapQuarticValue.get ("ReferenceParBasisSpread"), 2, 2, 1.) + "  |  " +
  535.                 FormatUtil.FormatDouble (mapQuarticValue.get ("DerivedParBasisSpread"), 2, 2, 1.) + "  |  " +
  536.                 FormatUtil.FormatDouble (fcxMKLKHyper.forward (iFwdStartDate), 2, 2, 100.) + "  |  " +
  537.                 FormatUtil.FormatDouble (mapKLKHyperValue.get ("ReferenceParBasisSpread"), 2, 2, 1.) + "  |  " +
  538.                 FormatUtil.FormatDouble (mapKLKHyperValue.get ("DerivedParBasisSpread"), 2, 2, 1.) + "  |  " +
  539.                 FormatUtil.FormatDouble (iFreq * java.lang.Math.log (dc.df (iFwdStartDate) / dc.df (iFwdEndDate)), 1, 2, 100.) + "  |  " +
  540.                 FormatUtil.FormatDouble (dc.libor (iFwdStartDate, iFwdEndDate), 1, 2, 100.) + "  |  "
  541.             );
  542.         }

  543.         return mapForward;
  544.     }

  545.     private static final Map<String, ForwardCurve> CustomFixFloatForwardCurveSample (
  546.         final JulianDate dtValue,
  547.         final String strCurrency,
  548.         final MergedDiscountForwardCurve dc,
  549.         final String strCalibMeasure,
  550.         final int iTenorInMonths)
  551.         throws Exception
  552.     {
  553.         return FixFloatxMBasisSample (
  554.             dtValue,
  555.             "USD",
  556.             dc,
  557.             iTenorInMonths,
  558.             new java.lang.String[] {
  559.                 "4Y", "5Y", "6Y", "7Y", "8Y", "9Y", "10Y", "11Y", "12Y", "15Y", "20Y", "25Y", "30Y", "40Y", "50Y"
  560.             },
  561.             strCalibMeasure,
  562.             new double[] {
  563.                 0.0005,    //  4Y
  564.                 0.0005,    //  5Y
  565.                 0.0005,    //  6Y
  566.                 0.0005,    //  7Y
  567.                 0.0005,    //  8Y
  568.                 0.0005,    //  9Y
  569.                 0.0005,    // 10Y
  570.                 0.0005,    // 11Y
  571.                 0.0005,    // 12Y
  572.                 0.0005,    // 15Y
  573.                 0.0005,    // 20Y
  574.                 0.0005,    // 25Y
  575.                 0.0005,    // 30Y
  576.                 0.0005,    // 40Y
  577.                 0.0005     // 50Y
  578.             },
  579.             new double[] {
  580.                 0.02604,    //  4Y
  581.                 0.02808,    //  5Y
  582.                 0.02983,    //  6Y
  583.                 0.03136,    //  7Y
  584.                 0.03268,    //  8Y
  585.                 0.03383,    //  9Y
  586.                 0.03488,    // 10Y
  587.                 0.03583,    // 11Y
  588.                 0.03668,    // 12Y
  589.                 0.03833,    // 15Y
  590.                 0.03854,    // 20Y
  591.                 0.03672,    // 25Y
  592.                 0.03510,    // 30Y
  593.                 0.03266,    // 40Y
  594.                 0.03145     // 50Y
  595.             }
  596.         );
  597.     }

  598.     public static final void main (
  599.         final String[] astrArgs)
  600.         throws Exception
  601.     {
  602.         /*
  603.          * Initialize the Credit Analytics Library
  604.          */

  605.         EnvManager.InitEnv ("");

  606.         String strCurrency = "USD";

  607.         JulianDate dtToday = DateUtil.Today().addTenor ("0D");

  608.         /*
  609.          * Construct the Discount Curve using its instruments and quotes
  610.          */

  611.         MergedDiscountForwardCurve dc = MakeDC (
  612.             dtToday,
  613.             strCurrency,
  614.             0.
  615.         );

  616.         CustomFixFloatForwardCurveSample (
  617.             dtToday,
  618.             strCurrency,
  619.             dc,
  620.             "DerivedParBasisSpread",
  621.             3
  622.         );

  623.         CustomFixFloatForwardCurveSample (
  624.             dtToday,
  625.             strCurrency,
  626.             dc,
  627.             "ReferenceParBasisSpread",
  628.             3
  629.         );
  630.     }
  631. }