Package com.opengamma.analytics.financial.instrument.index

Examples of com.opengamma.analytics.financial.instrument.index.IborIndex


    assertEquals(fixingPeriodEndTime, fra.accept(LDC), 1e-12);
  }

  @Test
  public void testFutures() {
    final IborIndex iborIndex = new IborIndex(CUR, Period.ofMonths(3), 2, DayCountFactory.INSTANCE.getDayCount("Actual/365"),
        BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following"), true, "Ibor");
    final double lastTradingTime = 1.473;
    final double fixingPeriodStartTime = 1.467;
    final double fixingPeriodEndTime = 1.75;
    final double fixingPeriodAccrualFactor = 0.267;
View Full Code Here


  @Test(enabled = false)
  /**
   * Analyzes the smoothness of sensitivities.
   */
  public void analysisSensitivities() {
    final IborIndex USDLIBOR3M = IndexIborMaster.getInstance().getIndex("USDLIBOR3M");
    final Period expiryTenor = Period.ofYears(5);
    final Period underlyingTenor = Period.ofYears(10);
    final ZonedDateTime expiryDate = ScheduleCalculator.getAdjustedDate(REFERENCE_DATE, expiryTenor, USDLIBOR3M, CALENDAR);
    final ZonedDateTime settleDate = ScheduleCalculator.getAdjustedDate(expiryDate, USDLIBOR3M.getSpotLag(), CALENDAR);
    final GeneratorSwapFixedIbor USD6MLIBOR3M = GeneratorSwapFixedIborMaster.getInstance().getGenerator("USD6MLIBOR3M", CALENDAR);
    final double notional = 1000000; // 1m
    final double strikeRange = 0.1150;
    final double strikeStart = 0.0050;
    final int nbStrike = 50;
View Full Code Here

    assertEquals(c1.accept(VISITOR, R2), c2);
  }

  @Test
  public void testFRA() {
    final IborIndex index = new IborIndex(CUR, Period.ofMonths(1), 2, DayCountFactory.INSTANCE.getDayCount("Actual/365"),
        BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following"), true);
    final ForwardRateAgreement fra1 = new ForwardRateAgreement(CUR, 0.5, N1, 0.5, 1, index, 0.5, 0.5, 1, 0.5, R1, N2);
    final ForwardRateAgreement fra2 = new ForwardRateAgreement(CUR, 0.5, N1, 0.5, 1, index, 0.5, 0.5, 1, 0.5, R2, N2);
    assertEquals(fra1.accept(VISITOR, R2), fra2);
  }
View Full Code Here

    assertEquals(fra1.accept(VISITOR, R2), fra2);
  }

  @Test
  public void testIRFuture() {
    final IborIndex iborIndex = new IborIndex(CUR, Period.ofMonths(3), 2, DayCountFactory.INSTANCE.getDayCount("Actual/365"),
        BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following"), true);
    final double lastTradingTime = 1.473;
    final double fixingPeriodStartTime = 1.467;
    final double fixingPeriodEndTime = 1.75;
    final double fixingPeriodAccrualFactor = 0.267;
View Full Code Here

  }

  @Test(expectedExceptions = IllegalArgumentException.class)
  public void testDifferentCurrenciesBetweenIndices() {
    new CouponIborAverageDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR, NOTIONAL,
        FIXING_DATE, new IborIndex(Currency.AUD, TENOR_1, SETTLEMENT_DAYS, DAY_COUNT_INDEX, BUSINESS_DAY, IS_EOM, "Index"), INDEX_2, WEIGHT_1, WEIGHT_2, CALENDAR, CALENDAR);
  }
View Full Code Here

  public void testEqualHash() {
    CouponIborAverageDefinition other = new CouponIborAverageDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR, NOTIONAL, FIXING_DATE, INDEX_1, INDEX_2, WEIGHT_1,
        WEIGHT_2, CALENDAR, CALENDAR);
    assertEquals(IBOR_AVERAGE_COUPON_DEFINITION_1, other);
    assertEquals(IBOR_AVERAGE_COUPON_DEFINITION_1.hashCode(), other.hashCode());
    other = new CouponIborAverageDefinition(Currency.AUD, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR, NOTIONAL, FIXING_DATE, new IborIndex(Currency.AUD, TENOR_1,
        SETTLEMENT_DAYS, DAY_COUNT_INDEX, BUSINESS_DAY, IS_EOM, "Index1"), new IborIndex(Currency.AUD, TENOR_2, SETTLEMENT_DAYS, DAY_COUNT_INDEX, BUSINESS_DAY, IS_EOM, "Index2"), WEIGHT_1, WEIGHT_2, CALENDAR, CALENDAR);
    assertFalse(IBOR_AVERAGE_COUPON_DEFINITION_1.equals(other));
    other = new CouponIborAverageDefinition(CUR, PAYMENT_DATE.plusDays(1), ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR, NOTIONAL, FIXING_DATE, INDEX_1, INDEX_2, WEIGHT_1, WEIGHT_2, CALENDAR, CALENDAR);
    assertFalse(IBOR_AVERAGE_COUPON_DEFINITION_1.equals(other));
    other = new CouponIborAverageDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE.plusDays(1), ACCRUAL_END_DATE, ACCRUAL_FACTOR, NOTIONAL, FIXING_DATE, INDEX_1, INDEX_2, WEIGHT_1, WEIGHT_2, CALENDAR, CALENDAR);
    assertFalse(IBOR_AVERAGE_COUPON_DEFINITION_1.equals(other));
    other = new CouponIborAverageDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE.plusDays(1), ACCRUAL_FACTOR, NOTIONAL, FIXING_DATE, INDEX_1, INDEX_2, WEIGHT_1, WEIGHT_2, CALENDAR, CALENDAR);
    assertFalse(IBOR_AVERAGE_COUPON_DEFINITION_1.equals(other));
    other = new CouponIborAverageDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR + 0.01, NOTIONAL, FIXING_DATE, INDEX_1, INDEX_2, WEIGHT_1, WEIGHT_2, CALENDAR, CALENDAR);
    assertFalse(IBOR_AVERAGE_COUPON_DEFINITION_1.equals(other));
    other = new CouponIborAverageDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR, NOTIONAL + 100, FIXING_DATE, INDEX_1, INDEX_2, WEIGHT_1, WEIGHT_2, CALENDAR, CALENDAR);
    assertFalse(IBOR_AVERAGE_COUPON_DEFINITION_1.equals(other));
    other = new CouponIborAverageDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR, NOTIONAL, FIXING_DATE.plusDays(1), INDEX_1, INDEX_2, WEIGHT_1, WEIGHT_2, CALENDAR, CALENDAR);
    assertFalse(IBOR_AVERAGE_COUPON_DEFINITION_1.equals(other));
    other = new CouponIborAverageDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR, NOTIONAL, FIXING_DATE, new IborIndex(CUR, TENOR_1, SETTLEMENT_DAYS + 1,
        DAY_COUNT_INDEX, BUSINESS_DAY, IS_EOM, "Index1"), new IborIndex(CUR, TENOR_2, SETTLEMENT_DAYS, DAY_COUNT_INDEX, BUSINESS_DAY, IS_EOM, "Index2"), WEIGHT_1, WEIGHT_2, CALENDAR, CALENDAR);
    assertFalse(IBOR_AVERAGE_COUPON_DEFINITION_1.equals(other));
    other = new CouponIborAverageDefinition(CUR, PAYMENT_DATE, ACCRUAL_START_DATE, ACCRUAL_END_DATE, ACCRUAL_FACTOR, NOTIONAL, FIXING_DATE, new IborIndex(CUR, TENOR_1, SETTLEMENT_DAYS,
        DAY_COUNT_INDEX, BUSINESS_DAY, IS_EOM, "Index1"), new IborIndex(CUR, TENOR_2, SETTLEMENT_DAYS + 1, DAY_COUNT_INDEX, BUSINESS_DAY, IS_EOM, "Index2"), WEIGHT_1, WEIGHT_2, CALENDAR, CALENDAR);
    assertFalse(IBOR_AVERAGE_COUPON_DEFINITION_1.equals(other));

  }
View Full Code Here

    final double paymentYearFraction = 30. / 360;
    final double fixingTime = paymentTime - 2. / 365;
    final double fixingPeriodStartTime = paymentTime;
    final double fixingPeriodEndTime = 7. / 12;
    final double fixingYearFraction = 31. / 365;
    final IborIndex index = new IborIndex(CUR, Period.ofMonths(1), 2, DayCountFactory.INSTANCE.getDayCount("Actual/365"),
        BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following"), true);
    ForwardRateAgreement fra = new ForwardRateAgreement(CUR, paymentTime, FIVE_PC_CURVE_NAME, paymentYearFraction, 1, index, fixingTime, fixingPeriodStartTime, fixingPeriodEndTime,
        fixingYearFraction, 0, FIVE_PC_CURVE_NAME);
    final double rate = fra.accept(PRC, CURVES);
    fra = new ForwardRateAgreement(CUR, paymentTime, FIVE_PC_CURVE_NAME, paymentYearFraction, 1, index, fixingTime, fixingPeriodStartTime, fixingPeriodEndTime, fixingYearFraction, rate,
View Full Code Here

        throw new OpenGammaRuntimeException("Could not get interest rate future convention with id " + ExternalId.of(SCHEME_NAME, EURODOLLAR_FUTURE));
      }
      final IborIndexConvention iborIndexConvention = conventionSource.getConvention(IborIndexConvention.class, convention.getIndexConvention());
      final Period period = Period.ofMonths(3); //TODO
      final int spotLag = iborIndexConvention.getSettlementDays();
      final IborIndex iborIndex = new IborIndex(currency, period, spotLag, iborIndexConvention.getDayCount(),
          iborIndexConvention.getBusinessDayConvention(), iborIndexConvention.isIsEOM(), iborIndexConvention.getName());
      final BlackSTIRFuturesSmileProvider blackData = new BlackSTIRFuturesSmileProvider(data, volatilitySurface.getSurface(), iborIndex);
      return blackData;
    }
View Full Code Here

        throw new OpenGammaRuntimeException("Could not get ibor index convention with the identifier " + ExternalId.of(SCHEME_NAME, iborConventionName));
      }
      final Frequency freqIbor = security.getFrequency();
      final Period tenorIbor = getTenor(freqIbor);
      final int spotLag = iborIndexConvention.getSettlementDays();
      final IborIndex iborIndex = new IborIndex(currency, tenorIbor, spotLag, iborIndexConvention.getDayCount(),
          iborIndexConvention.getBusinessDayConvention(), iborIndexConvention.isIsEOM(), iborIndexConvention.getName());
      final MulticurveProviderInterface data = getMergedProviders(inputs, fxMatrix);
      final VolatilitySurface volatilitySurface = (VolatilitySurface) inputs.getValue(INTERPOLATED_VOLATILITY_SURFACE);
      final BlackSmileCapParameters parameters = new BlackSmileCapParameters(volatilitySurface.getSurface(), iborIndex);
      final BlackSmileCapProvider blackData = new BlackSmileCapProvider(data, parameters);
View Full Code Here

              final IborIndexConvention iborIndexConvention = conventionSource.getConvention(IborIndexConvention.class, ibor.getConvention());
              if (iborIndexConvention == null) {
                throw new OpenGammaRuntimeException("Ibor index convention called " + ibor.getConvention() + " was null");
              }
              final int spotLag = iborIndexConvention.getSettlementDays();
              iborIndex.add(new IborIndex(iborIndexConvention.getCurrency(), ibor.getTenor().getPeriod(), spotLag, iborIndexConvention.getDayCount(),
                  iborIndexConvention.getBusinessDayConvention(), iborIndexConvention.isIsEOM(), iborIndexConvention.getName()));
            } else if (type instanceof OvernightCurveTypeConfiguration) {
              final OvernightCurveTypeConfiguration overnight = (OvernightCurveTypeConfiguration) type;
              final OvernightIndexConvention overnightConvention = conventionSource.getConvention(OvernightIndexConvention.class, overnight.getConvention());
              if (overnightConvention == null) {
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.financial.instrument.index.IborIndex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.