Package com.opengamma.financial.security.swap

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


      payLeg = floatingLeg;
      payLegDescription = floatingLegDescription;
      receiveLeg = fixedLeg;
      receiveLegDescription = fixedLegDescription;
    }
    final SwapSecurity swap = new SwapSecurity(tradeDateTime, tradeDateTime, maturityDateTime, counterparty, payLeg, receiveLeg);
    swap.addExternalId(ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString()));
    swap.setName("IR Swap " + ccy + " " + PortfolioLoaderHelper.NOTIONAL_FORMATTER.format(notional) + " " +
      maturityDateTime.toString(PortfolioLoaderHelper.OUTPUT_DATE_FORMATTER) + " - " + payLegDescription + " / " + receiveLegDescription);
    return swap;
  }
View Full Code Here


    assertNull(ids);
  }

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

    assertNull(ids);
  }

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

    assertNull(ids);
  }

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

  public Set<ValueSpecification> getResults(final FunctionCompilationContext context, final ComputationTarget target, final Map<ValueSpecification, ValueRequirement> inputs) {
    final Set<String> payLegCurveNames = new HashSet<>();
    final Set<String> receiveLegCurveNames = new HashSet<>();
    String payCurveCalculationConfig = null;
    String receiveCurveCalculationConfig = null;
    final SwapSecurity swap = (SwapSecurity) target.getSecurity();
    final ComputationTargetSpecification payCurrencySpec = ComputationTargetSpecification.of(((InterestRateNotional) swap.getPayLeg().getNotional()).getCurrency());
    final ComputationTargetSpecification receiveCurrencySpec = ComputationTargetSpecification.of(((InterestRateNotional) swap.getReceiveLeg().getNotional()).getCurrency());
    for (final Map.Entry<ValueSpecification, ValueRequirement> entry : inputs.entrySet()) {
      final ValueSpecification valueSpec = entry.getKey();
      final String valueName = valueSpec.getValueName();
      if (valueName.equals(ValueRequirementNames.YIELD_CURVE)) {
        final String curveName = valueSpec.getProperty(ValuePropertyNames.CURVE);
View Full Code Here

  static InstrumentDerivative getDerivative(final FinancialSecurity security, final ZonedDateTime now, final HistoricalTimeSeriesBundle timeSeries, final String[] curveNames,
      final InstrumentDefinition<?> definition, final FixedIncomeConverterDataProvider definitionConverter) {
    final InstrumentDerivative derivative;
    if (security instanceof SwapSecurity) {
      final SwapSecurity swapSecurity = (SwapSecurity) security;
      final InterestRateInstrumentType type = SwapSecurityUtils.getSwapType(swapSecurity);
      if (type == InterestRateInstrumentType.SWAP_FIXED_IBOR || type == InterestRateInstrumentType.SWAP_FIXED_IBOR_WITH_SPREAD || type == InterestRateInstrumentType.SWAP_FIXED_OIS) {
        final Frequency resetFrequency;
        if (swapSecurity.getPayLeg() instanceof FloatingInterestRateLeg) {
          resetFrequency = ((FloatingInterestRateLeg) swapSecurity.getPayLeg()).getFrequency();
        } else {
          resetFrequency = ((FloatingInterestRateLeg) swapSecurity.getReceiveLeg()).getFrequency();
        }
        derivative = definitionConverter.convert(security, definition, now,
            FixedIncomeInstrumentCurveExposureHelper.getCurveNamesForSecurity(security, curveNames, resetFrequency), timeSeries);
      } else {
        derivative = definitionConverter.convert(security, definition, now,
View Full Code Here

    final ZonedDateTime maturityDate = effectiveDate.plusYears(10);
    final Expiry expiry = new Expiry(effectiveDate.minusDays(2));
    final InterestRateNotional notional = new InterestRateNotional(CURRENCY, 10000000);
    final FloatingInterestRateLeg payLeg = new FloatingInterestRateLeg(ACT_360, QUARTERLY, REGION, MODIFIED_FOLLOWING, notional, true, LIBOR_3M, FloatingRateType.IBOR);
    final FixedInterestRateLeg receiveLeg = new FixedInterestRateLeg(THIRTYU_360, SEMI_ANNUAL, REGION, MODIFIED_FOLLOWING, notional, true, 0.02);
    final SwapSecurity underlyingSwap1 = new SwapSecurity(tradeDate, effectiveDate, maturityDate, COUNTERPARTY, payLeg, receiveLeg);
    underlyingSwap1.setName("Receive fixed @ 2% v USD 3m Libor");
    final SwapSecurity underlyingSwap2 = new SwapSecurity(tradeDate, effectiveDate, maturityDate, COUNTERPARTY, receiveLeg, payLeg);
    underlyingSwap2.setName("Pay fixed @ 2% v USD 3m Libor");
    SecurityDocument toAddDoc = new SecurityDocument();
    toAddDoc.setSecurity(underlyingSwap1);
    securityMaster.add(toAddDoc);
    toAddDoc = new SecurityDocument();
    toAddDoc.setSecurity(underlyingSwap2);
View Full Code Here

    @SuppressWarnings("synthetic-access")
    @Override
    public PortfolioNode createPortfolioNode() {
      final SimplePortfolioNode node = new SimplePortfolioNode("CM Swap");
      for (final Tenor tenor : _tenors) {
        final SwapSecurity swap = createSwap(tenor);
        final ManageableTrade trade = new ManageableTrade(BigDecimal.ONE, getSecurityPersister().storeSecurity(swap), _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

          iborReferenceRate, FloatingRateType.IBOR);
      final String ticker = "USDISDA10" + tenor.getPeriod().toString();
      final ExternalId cmsReferenceRate = ExternalSchemes.syntheticSecurityId(ticker);
      final FloatingInterestRateLeg cmsLeg = new FloatingInterestRateLeg(ACT_360, frequency, REGION, FOLLOWING, _notional, true,
          cmsReferenceRate, FloatingRateType.CMS);
      SwapSecurity security;
      boolean payIbor;
      if (RANDOM.nextBoolean()) {
        security = new SwapSecurity(_tradeDate, _tradeDate, maturityDate, COUNTERPARTY, iborLeg, cmsLeg);
        payIbor = true;
      } else {
        security = new SwapSecurity(_tradeDate, _tradeDate, maturityDate, COUNTERPARTY, cmsLeg, iborLeg);
        payIbor = false;
      }
      security.setName(CURRENCY.getCode() + " " + FORMAT.format(_notional.getAmount() / 1000000) + "MM Swap, pay " +
          (payIbor ? frequency.getPeriod().getMonths() + "M Libor, receive " + tenor.getPeriod().getYears() + "Y ISDA fixing (" :
            tenor.getPeriod().getYears() + "Y ISDA fixing, receive " + frequency.getPeriod().getMonths() + "M Libor (") +
            _tradeDate.toLocalDate().toString() + " - " + maturityDate.toLocalDate().toString() + ")");
      return security;
    }
View Full Code Here

        receiveLeg = fixedLeg;
        swapName = swapYears + "Y receive " + currency + " " + notional.getAmount() + " @ " + STRIKE_FORMATTER.format(rate);
        swaptionName = (isLong ? "Long " : "Short ") + swaptionYears + "Y x " + swapYears + "Y receive " + currency + " " + notional.getAmount() + " @ " + STRIKE_FORMATTER.format(rate);
        payer = false;
      }
      final SwapSecurity swap = new SwapSecurity(swaptionExpiry, swaptionExpiry.plusDays(2), swapMaturity, COUNTER_PARTY_OPT, payLeg, receiveLeg);
      swap.setName(swapName);
      final SecurityDocument toAddDoc = new SecurityDocument();
      toAddDoc.setSecurity(swap);
      securityMaster.add(toAddDoc);
      final ExternalId swapId = getSecurityPersister().storeSecurity(swap).iterator().next();
      final SwaptionSecurity swaption = new SwaptionSecurity(payer, swapId, isLong, new Expiry(swaptionExpiry), isCashSettled, currency);
View Full Code Here

TOP

Related Classes of com.opengamma.financial.security.swap.SwapSecurity

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.