Examples of SwaptionSecurity


Examples of com.opengamma.financial.security.option.SwaptionSecurity

      rate = getRate(underlying.getReceiveLeg());
      if (rate == null) {
        return null;
      }
    }
    final SwaptionSecurity security = new SwaptionSecurity(isPayer, getSecurityPersister().storeSecurity(underlying).iterator().next(), isLong, new Expiry(expiry), isCashSettled, currency, notional,
        new EuropeanExerciseType(), settlementDate);
    security.setName(createName(currency, optionLength, (int) MONTHS.between(underlying.getEffectiveDate(), underlying.getMaturityDate()), notional, rate));
    return security;
  }
View Full Code Here

Examples of com.opengamma.financial.security.option.SwaptionSecurity

    ManageableTrade trade = _positionMaster.getTrade(tradeId);
    UniqueId positionId = trade.getParentPositionId();
    ManageablePosition position = _positionMaster.get(positionId).getPosition();
    assertEquals(BigDecimal.ONE, trade.getQuantity());
    assertEquals(BigDecimal.ONE, position.getQuantity());
    SwaptionSecurity security = (SwaptionSecurity) _securityMaster.get(trade.getSecurityLink().getObjectId(),
                                                                       VersionCorrection.LATEST).getSecurity();
    assertNotNull(security);
    // check this later
    ExternalId underlyingId = security.getUnderlyingId();
    security.setUniqueId(null); // so it can be tested for equality against the unsaved version
    security.setUnderlyingId(BlotterTestUtils.SWAPTION.getUnderlyingId()); // will need this later
    assertEquals(BlotterTestUtils.SWAPTION, security);
    assertEquals(COUNTERPARTY_ID, trade.getCounterpartyExternalId());
    assertEquals(PREMIUM, trade.getPremium());
    assertEquals(Currency.GBP, trade.getPremiumCurrency());
    assertEquals(PREMIUM_DATE, trade.getPremiumDate());
View Full Code Here

Examples of com.opengamma.financial.security.option.SwaptionSecurity

    assertEquals(LocalDate.of(2012, 12, 22), updatedTrade.getTradeDate());
    assertEquals(4321d, updatedTrade.getPremium());
    PositionDocument positionDocument = _positionMaster.get(updatedTrade.getParentPositionId());
    ManageablePosition updatedPosition = positionDocument.getPosition();
    assertEquals(updatedTrade, updatedPosition.getTrade(updatedTradeId));
    SwaptionSecurity updatedSecurity = (SwaptionSecurity) _securityMaster.get(updatedTrade.getSecurityLink().getObjectId(),
                                                                              VersionCorrection.LATEST).getSecurity();
    assertFalse(updatedSecurity.isPayer());
    assertEquals(LongShort.LONG, updatedSecurity.getLongShort());
    assertEquals(Currency.CAD, updatedSecurity.getCurrency());

    ExternalId underlyingId = updatedSecurity.getUnderlyingId();
    SecuritySearchRequest searchRequest = new SecuritySearchRequest();
    searchRequest.setExternalIdSearch(new ExternalIdSearch(underlyingId));
    SecuritySearchResult searchResult = _securityMaster.search(searchRequest);
    SwapSecurity updatedUnderlying = (SwapSecurity) searchResult.getSingleSecurity();
    ZonedDateTime tradeDate = ZonedDateTime.of(LocalDateTime.of(2013, 1, 1, 11, 0), ZoneOffset.UTC);
View Full Code Here

Examples of com.opengamma.financial.security.option.SwaptionSecurity

    }
    final SwapSecurity swap = new SwapSecurity(swaptionExpiry, swaptionExpiry.plusDays(2), swapMaturity, COUNTERPARTY, payLeg, receiveLeg);
    swap.setName(swapName);
    final ExternalId underlyingId = ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString());
    swap.addExternalId(underlyingId);
    final SwaptionSecurity swaption = new SwaptionSecurity(payer, underlyingId, isLong, new Expiry(swaptionExpiry), isCashSettled, ccy);
    swaption.setName(swaptionName);
    swaption.addExternalId(ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString()));
    return Pair.of(swaption, swap);
  }
View Full Code Here

Examples of com.opengamma.financial.security.option.SwaptionSecurity

    for (final Map.Entry<SwaptionSecurity, SwapSecurity> entry : securities.entrySet()) {
      final SecurityDocument swapToAddDoc = new SecurityDocument();
      final SwapSecurity swap = entry.getValue();
      swapToAddDoc.setSecurity(swap);
      final SecurityDocument swaptionToAddDoc = new SecurityDocument();
      final SwaptionSecurity swaption = entry.getKey();
      swaptionToAddDoc.setSecurity(swaption);
      securityMaster.add(swaptionToAddDoc);
      securityMaster.add(swapToAddDoc);
      final ManageablePosition swaptionPosition = new ManageablePosition(BigDecimal.ONE, swaption.getExternalIdBundle());
      final PositionDocument addedDoc = positionMaster.add(new PositionDocument(swaptionPosition));
      rootNode.addPosition(addedDoc.getUniqueId());
    }
    portfolioMaster.add(portfolioDoc);
  }
View Full Code Here

Examples of com.opengamma.financial.security.option.SwaptionSecurity

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

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

Examples of com.opengamma.financial.security.option.SwaptionSecurity

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

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

Examples of com.opengamma.financial.security.option.SwaptionSecurity

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

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

Examples of com.opengamma.financial.security.option.SwaptionSecurity

  }

  @Test
  public void testSwaptionSecurity() {
    SwapSecurity underlying = ExposureFunctionTestHelper.getPayFixedFloatSwapSecurity();
    SwaptionSecurity security = ExposureFunctionTestHelper.getPaySwaptionSecurity();
    List<ExternalId> ids = security.accept(new UnderlyingExposureFunction(ExposureFunctionTestHelper.getSecuritySource(underlying)));
    assertEquals(1, ids.size());
    assertEquals(ExternalSchemes.syntheticSecurityId("3m Euribor"), ids.get(0));
    underlying = ExposureFunctionTestHelper.getReceiveFixedFloatSwapSecurity();
    security = ExposureFunctionTestHelper.getPaySwaptionSecurity();
    ids = security.accept(new UnderlyingExposureFunction(ExposureFunctionTestHelper.getSecuritySource(underlying)));
    assertEquals(1, ids.size());
    assertEquals(ExternalSchemes.syntheticSecurityId("3m Euribor"), ids.get(0));
  }
View Full Code Here

Examples of com.opengamma.financial.security.option.SwaptionSecurity

    return security;
  }

  public static SwaptionSecurity getPaySwaptionSecurity() {
    final UniqueId underlying = getPayFixedFloatSwapSecurity().getUniqueId();
    final SwaptionSecurity security = new SwaptionSecurity(false, ExternalId.of(underlying.getScheme(), underlying.getValue()), true, new Expiry(DateUtils.getUTCDate(2012, 1, 1)), false, EUR);
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "5417"));
    return security;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.