Пример #1
0
 public static YieldCurveBundle createCurvesUSD() {
   final String discountingCurvename = "USD Discounting";
   final String forward3MCurveName = "Forward USDLIBOR3M";
   final String forward6MCurveName = "Forward USDLIBOR6M";
   final InterpolatedDoublesCurve dscC =
       new InterpolatedDoublesCurve(
           new double[] {0.05, 1.0, 2.0, 5.0, 10.0, 20.0},
           new double[] {0.0050, 0.0100, 0.0150, 0.0200, 0.0200, 0.0300},
           CombinedInterpolatorExtrapolatorFactory.getInterpolator(
               Interpolator1DFactory.DOUBLE_QUADRATIC, Interpolator1DFactory.LINEAR_EXTRAPOLATOR),
           true,
           discountingCurvename);
   final InterpolatedDoublesCurve fwd3C =
       new InterpolatedDoublesCurve(
           new double[] {0.05, 1.0, 2.0, 5.0, 10.0, 25.0},
           new double[] {0.0070, 0.0120, 0.0165, 0.0215, 0.0210, 0.0310},
           CombinedInterpolatorExtrapolatorFactory.getInterpolator(
               Interpolator1DFactory.DOUBLE_QUADRATIC, Interpolator1DFactory.LINEAR_EXTRAPOLATOR),
           true,
           forward3MCurveName);
   final InterpolatedDoublesCurve fwd6C =
       new InterpolatedDoublesCurve(
           new double[] {0.05, 1.0, 2.0, 5.0, 10.0, 30.0},
           new double[] {0.0075, 0.0125, 0.0170, 0.0220, 0.0212, 0.0312},
           CombinedInterpolatorExtrapolatorFactory.getInterpolator(
               Interpolator1DFactory.DOUBLE_QUADRATIC, Interpolator1DFactory.LINEAR_EXTRAPOLATOR),
           true,
           forward6MCurveName);
   final YieldCurveBundle curves = new YieldCurveBundle();
   curves.setCurve(discountingCurvename, YieldCurve.from(dscC));
   curves.setCurve(forward3MCurveName, YieldCurve.from(fwd3C));
   curves.setCurve(forward6MCurveName, YieldCurve.from(fwd6C));
   return curves;
 }
Пример #2
0
 /**
  * Create a yield curve bundle with three curves. One called "Credit" with a constant rate of 5%,
  * one called "Discounting" with a constant rate of 4%, and one called "Forward" with a constant
  * rate of 4.5%.
  *
  * @return The yield curve bundle.
  */
 public static YieldCurveBundle createCurvesBond() {
   final String CREDIT_CURVE_NAME = "Credit";
   final String DISCOUNTING_CURVE_NAME = "Repo";
   final String FORWARD_CURVE_NAME = "Forward";
   final YieldAndDiscountCurve CURVE_5 = YieldCurve.from(ConstantDoublesCurve.from(0.05));
   final YieldAndDiscountCurve CURVE_4 = YieldCurve.from(ConstantDoublesCurve.from(0.04));
   final YieldAndDiscountCurve CURVE_45 = YieldCurve.from(ConstantDoublesCurve.from(0.045));
   final YieldCurveBundle curves = new YieldCurveBundle();
   curves.setCurve(CREDIT_CURVE_NAME, CURVE_5);
   curves.setCurve(DISCOUNTING_CURVE_NAME, CURVE_4);
   curves.setCurve(FORWARD_CURVE_NAME, CURVE_45);
   return curves;
 }