Package com.opengamma.financial.security.capfloor

Examples of com.opengamma.financial.security.capfloor.CapFloorCMSSpreadSecurity


    final ExternalId receiveIdentifier = TICKERS.get(receiveTenor);
    if (receiveIdentifier == null) {
      throw new OpenGammaRuntimeException("Could not get swap rate ticker for " + receiveTenor);
    }
    final double notional = 1000000 * (1 + random.nextInt(50));
    final CapFloorCMSSpreadSecurity security = new CapFloorCMSSpreadSecurity(tradeDate, maturityDate, notional, payIdentifier, receiveIdentifier, strike,
        PeriodFrequency.ANNUAL, CURRENCY, ACT_360, payer, cap);
    security.setName(CURRENCY.getCode() + " " + FORMAT.format(notional / 1000000) + (cap ? "MM cap spread " : "MM floor spread ") + "@ " + FORMAT.format(strike) +
        "%, pay " + payTenor.getPeriod().normalized().getYears() + "Y ISDA fixing" + ", receive " +
        receiveTenor.getPeriod().normalized().getYears() + "Y ISDA fixing" +
        " (" + tradeDate.toLocalDate().toString() + " - " + maturityDate.toLocalDate().toString() + ")");
    security.addExternalId(ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString()));
    return security;
  }
View Full Code Here


    final ExternalId shortIdentifier = getUnderlying(currency, startDate.toLocalDate(), tenor1);
    final ExternalId longIdentifier = getUnderlying(currency, startDate.toLocalDate(), tenor2);
    final double strike = getRandom(STRIKES);
    final Frequency frequency = getRandom(FREQUENCY);
    final DayCount dayCount = getRandom(DAY_COUNT);
    CapFloorCMSSpreadSecurity security = null;
    if (shortIdentifier != null && longIdentifier != null) {
      security = new CapFloorCMSSpreadSecurity(startDate, maturityDate, notional, longIdentifier, shortIdentifier, strike, frequency, currency, dayCount, payer, cap);
      security.setName(createName(cap, tenor1, tenor2, strike, startDate, maturityDate, frequency, currency, notional));
    }
    return security;
  }
View Full Code Here

    ExternalId longIdentifier = externalIdBeanToExternalId(bean.getLongIdentifier());
    ExternalId shortIdentifier = externalIdBeanToExternalId(bean.getShortIdentifier());
    Frequency frequency = frequencyBeanToFrequency(bean.getFrequency());
    Currency currency = currencyBeanToCurrency(bean.getCurrency());
    DayCount dayCount = dayCountBeanToDayCount(bean.getDayCount());
    return new CapFloorCMSSpreadSecurity(startDate,
        maturityDate,
        bean.getNotional(),
        longIdentifier,
        shortIdentifier,
        bean.getStrike(),
View Full Code Here

    assertEquals(ExternalId.of(SCHEME, "CASH"), ids.get(0));
  }

  @Test
  public void testCapFloorCMSSpreadSecurity() {
    final CapFloorCMSSpreadSecurity security = ExposureFunctionTestHelper.getCapFloorCMSSpreadSecurity();
    final List<ExternalId> ids = security.accept(EXPOSURE_FUNCTION);
    assertEquals(1, ids.size());
    assertEquals(ExternalId.of(SCHEME, "CAP-FLOOR CMS SPREAD"), ids.get(0));
  }
View Full Code Here

    assertEquals(ExternalId.of(SCHEME, "CASH_USD"), ids.get(0));
  }

  @Test
  public void testCapFloorCMSSpreadSecurity() {
    final CapFloorCMSSpreadSecurity security = ExposureFunctionTestHelper.getCapFloorCMSSpreadSecurity();
    final List<ExternalId> ids = security.accept(EXPOSURE_FUNCTION);
    assertEquals(1, ids.size());
    assertEquals(ExternalId.of(SCHEME, "CAP-FLOOR CMS SPREAD_EUR"), ids.get(0));
  }
View Full Code Here

    assertNull(ids);
  }

  @Test
  public void testCapFloorCMSSpreadSecurity() {
    final CapFloorCMSSpreadSecurity security = ExposureFunctionTestHelper.getCapFloorCMSSpreadSecurity();
    final List<ExternalId> ids = security.accept(EXPOSURE_FUNCTION);
    assertEquals(2, ids.size());
    assertEquals(ExternalSchemes.syntheticSecurityId("USD 10y Swap"), ids.get(0));
    assertEquals(ExternalSchemes.syntheticSecurityId("USD 15y Swap"), ids.get(1));
  }
View Full Code Here

    assertEquals(ExternalId.of(SCHEME, "EUR"), ids.get(0));
  }

  @Test
  public void testCapFloorCMSSpreadSecurity() {
    final CapFloorCMSSpreadSecurity security = ExposureFunctionTestHelper.getCapFloorCMSSpreadSecurity();
    final List<ExternalId> ids = security.accept(EXPOSURE_FUNCTION);
    assertEquals(1, ids.size());
    assertEquals(ExternalId.of(SCHEME, "EUR"), ids.get(0));
  }
View Full Code Here

    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "12345"));
    return security;
  }

  public static CapFloorCMSSpreadSecurity getCapFloorCMSSpreadSecurity() {
    final CapFloorCMSSpreadSecurity security = new CapFloorCMSSpreadSecurity(DateUtils.getUTCDate(2012, 1, 1), DateUtils.getUTCDate(2022, 1, 1), 100000, ExternalSchemes.syntheticSecurityId("USD 10y Swap"),
        ExternalSchemes.syntheticSecurityId("USD 15y Swap"), 0.002, PeriodFrequency.SEMI_ANNUAL, EUR, DC, true, false);
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "2643"));
    return security;
  }
View Full Code Here

    final double strike = 0;
    final Frequency frequency = frequency();
    final DayCount dayCount = dayCount();
    final boolean payer = bool();
    final boolean cap = bool();
    final CapFloorCMSSpreadSecurity security = new CapFloorCMSSpreadSecurity(startDate, maturityDate, notional, longIdentifier, shortIdentifier, strike, frequency, currency, dayCount, payer, cap);
    store(security);
    return security;
  }
View Full Code Here

    assertEquals(ExternalId.of(ExposureFunction.SECURITY_IDENTIFIER, "FUTURE_Y"), ids.get(0));
  }

  @Test
  public void testCapFloorCMSSpreadSecurity() {
    final CapFloorCMSSpreadSecurity security = ExposureFunctionTestHelper.getCapFloorCMSSpreadSecurity();
    final List<ExternalId> ids = security.accept(EXPOSURE_FUNCTION);
    assertNull(ids);
  }
View Full Code Here

TOP

Related Classes of com.opengamma.financial.security.capfloor.CapFloorCMSSpreadSecurity

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.