Examples of SwapSecurity


Examples of com.opengamma.financial.security.swap.SwapSecurity

    assertEquals(ExternalSchemes.syntheticSecurityId("3m Euribor"), ids.get(0));
  }

  @Test
  public void testXCcySwapSecurity() {
    final SwapSecurity security = ExposureFunctionTestHelper.getXCcySwapSecurity();
    final List<ExternalId> ids = security.accept(EXPOSURE_FUNCTION);
    assertEquals(2, ids.size());
    assertTrue(ids.containsAll(Arrays.asList(ExternalSchemes.syntheticSecurityId("3m Euribor"), ExternalSchemes.syntheticSecurityId("3m USD Libor"))));
  }
View Full Code Here

Examples of com.opengamma.financial.security.swap.SwapSecurity

  public static SwapSecurity getPayFixedFloatSwapSecurity() {
    final InterestRateNotional notional = new InterestRateNotional(EUR, 1000000);
    final SwapLeg payLeg = new FixedInterestRateLeg(DC, PeriodFrequency.SEMI_ANNUAL, DE, BDC, notional, false, 0.04);
    final SwapLeg receiveLeg = new FloatingInterestRateLeg(DC, PeriodFrequency.QUARTERLY, DE, BDC, notional, false, ExternalSchemes.syntheticSecurityId("3m Euribor"), FloatingRateType.IBOR);
    final SwapSecurity security = new SwapSecurity(DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2023, 1, 1), "OG",
        payLeg, receiveLeg);
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "65456"));
    return security;
  }
View Full Code Here

Examples of com.opengamma.financial.security.swap.SwapSecurity

  public static SwapSecurity getReceiveFixedFloatSwapSecurity() {
    final InterestRateNotional notional = new InterestRateNotional(EUR, 1000000);
    final SwapLeg receiveLeg = new FixedInterestRateLeg(DC, PeriodFrequency.SEMI_ANNUAL, DE, BDC, notional, false, 0.04);
    final SwapLeg payLeg = new FloatingInterestRateLeg(DC, PeriodFrequency.QUARTERLY, DE, BDC, notional, false, ExternalSchemes.syntheticSecurityId("3m Euribor"), FloatingRateType.IBOR);
    final SwapSecurity security = new SwapSecurity(DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2023, 1, 1), "OG",
        payLeg, receiveLeg);
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "65456"));
    return security;
  }
View Full Code Here

Examples of com.opengamma.financial.security.swap.SwapSecurity

  public static SwapSecurity getFloatFloatSwapSecurity() {
    final InterestRateNotional notional = new InterestRateNotional(EUR, 1000000);
    final SwapLeg payLeg = new FloatingInterestRateLeg(DC, PeriodFrequency.QUARTERLY, DE, BDC, notional, false, ExternalSchemes.syntheticSecurityId("6m Euribor"), FloatingRateType.IBOR);
    final SwapLeg receiveLeg = new FloatingInterestRateLeg(DC, PeriodFrequency.QUARTERLY, DE, BDC, notional, false, ExternalSchemes.syntheticSecurityId("3m Euribor"), FloatingRateType.IBOR);
    final SwapSecurity security = new SwapSecurity(DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2023, 1, 1), "OG",
        payLeg, receiveLeg);
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "874"));
    return security;
  }
View Full Code Here

Examples of com.opengamma.financial.security.swap.SwapSecurity

  }

  public static SwapSecurity getXCcySwapSecurity() {
    final SwapLeg payLeg = new FloatingInterestRateLeg(DC, PeriodFrequency.QUARTERLY, US, BDC, new InterestRateNotional(USD, 100000), false, ExternalSchemes.syntheticSecurityId("3m USD Libor"), FloatingRateType.IBOR);
    final SwapLeg receiveLeg = new FloatingInterestRateLeg(DC, PeriodFrequency.QUARTERLY, DE, BDC, new InterestRateNotional(EUR, 100000), false, ExternalSchemes.syntheticSecurityId("3m Euribor"), FloatingRateType.IBOR);
    final SwapSecurity security = new SwapSecurity(DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2013, 1, 1), DateUtils.getUTCDate(2023, 1, 1), "OG",
        payLeg, receiveLeg);
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "311"));
    return security;
  }
View Full Code Here

Examples of com.opengamma.financial.security.swap.SwapSecurity

  }

  @Override
  public List<ExternalId> visitSwaptionSecurity(final SwaptionSecurity security) {
    final List<ExternalId> result = new ArrayList<>();
    final SwapSecurity underlyingSwap = (SwapSecurity) _securitySource.getSingle(ExternalIdBundle.of(security.getUnderlyingId())); //TODO version
    final SwapLeg payLeg = underlyingSwap.getPayLeg();
    final SwapLeg receiveLeg = underlyingSwap.getReceiveLeg();
    if (payLeg instanceof FloatingInterestRateLeg) {
      result.add(((FloatingInterestRateLeg) payLeg).getFloatingReferenceRateId());
    }
    if (receiveLeg instanceof FloatingInterestRateLeg) {
      result.add(((FloatingInterestRateLeg) receiveLeg).getFloatingReferenceRateId());
View Full Code Here

Examples of com.opengamma.financial.security.swap.SwapSecurity

  @Override
  public SwapFuturesPriceDeliverableSecurityDefinition visitDeliverableSwapFutureSecurity(final DeliverableSwapFutureSecurity security) {
    ArgumentChecker.notNull(security, "security");
    final ExternalId swapIdentifer = security.getUnderlyingSwapId();
    final SwapSecurity underlyingSwapSecurity = (SwapSecurity) _securitySource.getSingle(ExternalIdBundle.of(swapIdentifer)); //TODO see note in InterestRateFutureOptionSecurityConverter
    if (underlyingSwapSecurity == null) {
      throw new OpenGammaRuntimeException("Underlying swap security " + swapIdentifer + " was not found in database");
    }
    final InstrumentDefinition<?> underlyingSwap = underlyingSwapSecurity.accept(_swapConverter);
    if (!(underlyingSwap instanceof SwapFixedIborDefinition)) {
      throw new OpenGammaRuntimeException("Underlying swap was not fixed / ibor float");
    }
    final ZonedDateTime lastTradingDate = security.getExpiry().getExpiry();
    final double notional = security.getNotional();
View Full Code Here

Examples of com.opengamma.financial.security.swap.SwapSecurity

    return Arrays.asList(payLeg.getRegionId(), receiveLeg.getRegionId());
  }

  @Override
  public List<ExternalId> visitSwaptionSecurity(final SwaptionSecurity security) {
    final SwapSecurity underlyingSwap = (SwapSecurity) _securitySource.getSingle(ExternalIdBundle.of(security.getUnderlyingId())); //TODO version
    final SwapLeg payLeg = underlyingSwap.getPayLeg();
    final SwapLeg receiveLeg = underlyingSwap.getReceiveLeg();
    if (payLeg.getRegionId().equals(receiveLeg.getRegionId())) {
      return Arrays.asList(payLeg.getRegionId());
    }
    return Arrays.asList(payLeg.getRegionId(), receiveLeg.getRegionId());
  }
View Full Code Here

Examples of com.opengamma.financial.security.swap.SwapSecurity

  }

  @Override
  public List<ExternalId> visitSwaptionSecurity(final SwaptionSecurity security) {
    final List<ExternalId> result = new ArrayList<>();
    final SwapSecurity underlyingSwap = (SwapSecurity) _securitySource.getSingle(ExternalIdBundle.of(security.getUnderlyingId())); //TODO version
    final SwapLeg payLeg = underlyingSwap.getPayLeg();
    final SwapLeg receiveLeg = underlyingSwap.getReceiveLeg();
    final String securityType = security.getSecurityType();
    if (payLeg.getRegionId().equals(receiveLeg.getRegionId())) {
      return Arrays.asList(ExternalId.of(SECURITY_IDENTIFIER, securityType + "_" + payLeg.getRegionId().getValue()));
    }
    result.add(ExternalId.of(SECURITY_IDENTIFIER, securityType + "_" + payLeg.getRegionId().getValue()));
View Full Code Here

Examples of com.opengamma.financial.security.swap.SwapSecurity

    List<SwapLeg> recLegs = Lists.newArrayList(trade.getReceiveLegs());

    Preconditions.checkState(payLegs.size() == 1, format("Swaps must have one (and only one) pay leg. Found %d", payLegs.size()));
    Preconditions.checkState(recLegs.size() == 1, format("Swaps must have one (and only one) receive leg. Found %d", recLegs.size()));

    ManageableSecurity security = new SwapSecurity(
        convertLocalDate(trade.getTradeDate()),
        convertLocalDate(trade.getEffectiveDate()),
        convertLocalDate(trade.getMaturityDate()),
        trade.getCounterparty().getExternalId().getId(),
        convertLeg(payLegs.get(0)),
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.