Package com.opengamma.financial.security.capfloor

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


    @Override
    public PortfolioNode createPortfolioNode() {
      final SimplePortfolioNode node = new SimplePortfolioNode("CM Cap/Floor");
      for (final Tenor tenor : _tenors) {
        for (final double strike : _strikes) {
          final CapFloorSecurity cap = createCapFloor(tenor, strike);
          final ManageableTrade trade = new ManageableTrade(BigDecimal.ONE, getSecurityPersister().storeSecurity(cap), _tradeDate.toLocalDate(),
              _tradeDate.toOffsetDateTime().toOffsetTime(), ExternalId.of(Counterparty.DEFAULT_SCHEME, COUNTERPARTY));
          trade.setPremium(0.);
          trade.setPremiumCurrency(CURRENCY);
          final Position position = SimplePositionGenerator.createPositionFromTrade(trade);
View Full Code Here


      final ZonedDateTime maturityDate = _tradeDate.plus(tenor.getPeriod());
      final boolean payer = RANDOM.nextBoolean();
      final boolean cap = RANDOM.nextBoolean();
      final String ticker = "USDISDA10" + tenor.getPeriod().toString();
      final ExternalId underlyingIdentifier = ExternalSchemes.syntheticSecurityId(ticker);
      final CapFloorSecurity security = new CapFloorSecurity(_tradeDate, maturityDate, _notional, underlyingIdentifier, strike, PeriodFrequency.SEMI_ANNUAL,
          CURRENCY, ACT_360, payer, cap, false);
      security.setName(CURRENCY.getCode() + " " + FORMAT.format(_notional / 1000000) + (cap ? "MM cap " : "MM floor ") + "@ " + FORMAT.format(strike) +
          (payer ? "%, pay " : "%, receive ") + tenor.getPeriod().normalized().getYears() + "Y ISDA fixing" +
          " (" + _tradeDate.toLocalDate().toString() + " - " + maturityDate.toLocalDate().toString() + ")");
      return security;
    }
View Full Code Here

  }

  private List<FinancialSecurity> getCMCapFloor() {
    final List<FinancialSecurity> securities = new ArrayList<FinancialSecurity>();

    final CapFloorSecurity cmsCap = new CapFloorSecurity(ZonedDateTime.of(LocalDateTime.of(2011, 4, 1, 1, 0), ZoneOffset.UTC),
        ZonedDateTime.of(LocalDateTime.of(2016, 4, 1, 1, 0), ZoneOffset.UTC), 1.5E7,
        ExternalId.of(ExternalSchemes.OG_SYNTHETIC_TICKER, "USDISDA10P10Y"), 0.03, SimpleFrequency.ANNUAL, Currency.USD,
        DayCountFactory.INSTANCE.getDayCount("Actual/360"), false, true, false);
    cmsCap.addExternalId(ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString()));
    cmsCap.setName(getCapFloorName(cmsCap));
    securities.add(cmsCap);

    final CapFloorSecurity cmsFloor = new CapFloorSecurity(ZonedDateTime.of(LocalDateTime.of(2011, 9, 9, 1, 0), ZoneOffset.UTC),
        ZonedDateTime.of(LocalDateTime.of(2016, 9, 9, 1, 0), ZoneOffset.UTC), 1.5E7,
        ExternalId.of(ExternalSchemes.OG_SYNTHETIC_TICKER, "USDISDA10P10Y"), 0.01, SimpleFrequency.SEMI_ANNUAL, Currency.USD,
        DayCountFactory.INSTANCE.getDayCount("Actual/360"), false, false, false);
    cmsFloor.setName(getCapFloorName(cmsFloor));
    cmsFloor.addExternalId(ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString()));
    securities.add(cmsFloor);
    return securities;
  }
View Full Code Here

  }

  private Collection<FinancialSecurity> getIborCapFloor() {
    final List<FinancialSecurity> securities = new ArrayList<FinancialSecurity>();
    int year = TODAY.getYear();
    final CapFloorSecurity sec1 = new CapFloorSecurity(ZonedDateTime.of(LocalDateTime.of(year + 1, 1, 1, 1, 0), ZoneOffset.UTC),
        ZonedDateTime.of(LocalDateTime.of(year + 3, 1, 1, 1, 0), ZoneOffset.UTC), 1.5E7,
        USDLIBOR3M, 0.01, SimpleFrequency.QUARTERLY, Currency.USD,
        DayCountFactory.INSTANCE.getDayCount("30U/360"), false, true, true);
    sec1.setName(getCapFloorName(sec1));
    sec1.addExternalId(ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString()));
    securities.add(sec1);

    final CapFloorSecurity sec2 = new CapFloorSecurity(ZonedDateTime.of(LocalDateTime.of(year + 1, 1, 1, 1, 0), ZoneOffset.UTC),
        ZonedDateTime.of(LocalDateTime.of(year + 3, 1, 1, 1, 0), ZoneOffset.UTC), 1.5E7,
        USDLIBOR3M, 0.01, SimpleFrequency.QUARTERLY, Currency.USD,
        DayCountFactory.INSTANCE.getDayCount("30U/360"), false, false, true);
    sec2.setName(getCapFloorName(sec2));
    sec2.addExternalId(ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString()));
    securities.add(sec2);
    return securities;
  }
View Full Code Here

    assertEquals(ExternalId.of(security.getUniqueId().getScheme(), security.getUniqueId().getValue()), ids.get(0));
  }

  @Test
  public void testCapFloorSecurity() {
    final CapFloorSecurity security = ExposureFunctionTestHelper.getCapFloorSecurity();
    final List<ExternalId> ids = security.accept(EXPOSURE_FUNCTION);
    assertEquals(1, ids.size());
    assertEquals(ExternalId.of(security.getUniqueId().getScheme(), security.getUniqueId().getValue()), ids.get(0));
  }
View Full Code Here

    assertNull(ids);
  }

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

    assertNull(ids);
  }

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

    assertNull(ids);
  }

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

     * @param fxMatrix The FX matrix, not null
     * @return The Black surface and curve data
     */
    protected BlackSmileCapProviderInterface getBlackSurface(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final FXMatrix fxMatrix) {
      final ConventionSource conventionSource = OpenGammaExecutionContext.getConventionSource(executionContext);
      final CapFloorSecurity security = (CapFloorSecurity) target.getTrade().getSecurity();
      final Currency currency = FinancialSecurityUtils.getCurrency(security);
      final String iborConventionName = getConventionName(currency, IBOR);
      final IborIndexConvention iborIndexConvention = conventionSource.getConvention(IborIndexConvention.class, ExternalId.of(SCHEME_NAME, iborConventionName));
      if (iborIndexConvention == null) {
        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);
View Full Code Here

      return null;
    }
    final double strike = 0.01 + (double) getRandom(6) / 200;
    final Frequency frequency = getRandom(FREQUENCY);
    final DayCount dayCount = getRandom(DAY_COUNT);
    final CapFloorSecurity capFloor = new CapFloorSecurity(startDate, maturityDate, notional, underlyingIdentifier, strike, frequency, currency, dayCount, payer, cap, ibor);
    capFloor.setName(createName(ibor, cap, strike, startDate, maturityDate, frequency, currency, notional));
    return capFloor;
  }
View Full Code Here

TOP

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

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.