Package com.opengamma.financial.security.swap

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


    final SwapSecurity swap1 = new SwapSecurity(
        ZonedDateTime.of(LocalDateTime.of(year + 1, 12, 20, 11, 0), ZoneOffset.UTC),
        ZonedDateTime.of(LocalDateTime.of(year + 1, 12, 20, 11, 0), ZoneOffset.UTC),
        ZonedDateTime.of(LocalDateTime.of(year + 5, 12, 20, 11, 0), ZoneOffset.UTC),
        "Cpty",
        new FixedInterestRateLeg(DAY_COUNT,
            SimpleFrequency.QUARTERLY,
            ExternalSchemes.countryRegionId(Country.of("US")),
            BUSINESS_DAY,
            new InterestRateNotional(Currency.USD, 21000000),
            true,
View Full Code Here


            BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Modified Following"),
            new InterestRateNotional(Currency.USD, 1.0E7),
            false,
            USDLIBOR3M,
            FloatingRateType.IBOR),
        new FixedInterestRateLeg(DayCountFactory.INSTANCE.getDayCount("30U/360"),
            SimpleFrequency.SEMI_ANNUAL,
            ExternalSchemes.financialRegionId("US+GB"),
            BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Modified Following"),
            new InterestRateNotional(Currency.USD, 1.0E7),
            false,
            0.04));
    swap1.addExternalId(ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString()));
    swap1.setName("Swap: pay 3m Libor vs 4% fixed, start=" + swap1.getEffectiveDate().toLocalDate() + ", maturity=" + swap1.getMaturityDate().toLocalDate() + ", notional=USD 10MM");
    storeFinancialSecurity(swap1);
    final SwaptionSecurity swaption1 = new SwaptionSecurity(false, swap1.getExternalIdBundle().getExternalId(ExternalScheme.of(ID_SCHEME)),
        true, new Expiry(ZonedDateTime.of(LocalDateTime.of(year + 1, 6, 1, 1, 0), ZoneOffset.UTC)),
        true, Currency.USD, null, europeanExerciseType, null);
    swaption1.addExternalId(ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString()));
    swaption1.setName("Vanilla swaption, 1Y x 10Y, USD 10,000,000 @ 4%");
    securities.add(swaption1);

    final SwapSecurity swap2 = new SwapSecurity(
        ZonedDateTime.of(LocalDateTime.of(year + 2, 6, 1, 1, 0), ZoneOffset.UTC),
        ZonedDateTime.of(LocalDateTime.of(year + 2, 6, 1, 1, 0), ZoneOffset.UTC),
        ZonedDateTime.of(LocalDateTime.of(year + 4, 6, 1, 1, 0), ZoneOffset.UTC),
        "Cpty",
        new FloatingInterestRateLeg(DAY_COUNT, SimpleFrequency.QUARTERLY,
            ExternalSchemes.financialRegionId("US+GB"),
            BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Modified Following"),
            new InterestRateNotional(Currency.USD, 3000000.0),
            false,
            USDLIBOR3M,
            FloatingRateType.IBOR),
        new FixedInterestRateLeg(DayCountFactory.INSTANCE.getDayCount("30U/360"),
            SimpleFrequency.SEMI_ANNUAL,
            ExternalSchemes.financialRegionId("US+GB"),
            BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Modified Following"),
            new InterestRateNotional(Currency.USD, 3000000.0),
            false,
            0.01));
    swap2.addExternalId(ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString()));
    swap2.setName("Swap: pay 3m Libor vs 1% fixed, start=" + swap2.getEffectiveDate().toLocalDate() + ", maturity=" + swap2.getMaturityDate().toLocalDate() + ", notional=USD 3MM");
    storeFinancialSecurity(swap2);
    final SwaptionSecurity swaption2 = new SwaptionSecurity(false, swap2.getExternalIdBundle().getExternalId(ExternalScheme.of(ID_SCHEME)),
        false, new Expiry(ZonedDateTime.of(LocalDateTime.of(year + 2, 6, 1, 1, 0), ZoneOffset.UTC)),
        true, Currency.USD, null, europeanExerciseType, null);
    swaption2.addExternalId(ExternalId.of(ID_SCHEME, GUIDGenerator.generate().toString()));
    swaption2.setName("Vanilla swaption, 2Y x 2Y, USD 3,000,000 @ 1%");
    securities.add(swaption2);

    final SwapSecurity swap3 = new SwapSecurity(
        ZonedDateTime.of(LocalDateTime.of(year + 5, 6, 1, 1, 0), ZoneOffset.UTC),
        ZonedDateTime.of(LocalDateTime.of(year + 5, 6, 1, 1, 0), ZoneOffset.UTC),
        ZonedDateTime.of(LocalDateTime.of(year + 20, 6, 1, 1, 0), ZoneOffset.UTC),
        "Cpty",
        new FloatingInterestRateLeg(DAY_COUNT, SimpleFrequency.QUARTERLY,
            ExternalSchemes.financialRegionId("US+GB"),
            BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Modified Following"),
            new InterestRateNotional(Currency.USD, 6000000.0),
            false,
            USDLIBOR3M,
            FloatingRateType.IBOR),
        new FixedInterestRateLeg(DayCountFactory.INSTANCE.getDayCount("30U/360"),
            SimpleFrequency.SEMI_ANNUAL,
            ExternalSchemes.financialRegionId("US+GB"),
            BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Modified Following"),
            new InterestRateNotional(Currency.USD, 6000000.0),
            false,
View Full Code Here

    final ZonedDateTime tradeDate = DateUtils.previousWeekDay().atStartOfDay(ZoneOffset.UTC);
    final ZonedDateTime effectiveDate = tradeDate;
    final ZonedDateTime maturity = DateUtils.getUTCDate(2024, 9, 5);
    final InterestRateNotional notional = new InterestRateNotional(CURRENCY, 10000000);
    final FloatingInterestRateLeg receiveLeg1 = new FloatingInterestRateLeg(ACT_360, QUARTERLY, REGION, MODIFIED_FOLLOWING, notional, true, LIBOR_3M, FloatingRateType.IBOR);
    final FixedInterestRateLeg payLeg1 = new FixedInterestRateLeg(THIRTYU_360, SEMI_ANNUAL, REGION, MODIFIED_FOLLOWING, notional, true, 0.02);
    final SwapSecurity swap1 = new SwapSecurity(tradeDate, effectiveDate, maturity, COUNTERPARTY, payLeg1, receiveLeg1);
    swap1.setName("Pay Fixed @ 2% v USD 3m Libor");
    final SwapSecurity swap2 = new SwapSecurity(tradeDate, effectiveDate, maturity, COUNTERPARTY, receiveLeg1, payLeg1);
    swap2.setName("Receive Fixed @ 2% v USD 3m Libor");
    final SwapSecurity[] swapParity = new SwapSecurity[] {swap1, swap2};
View Full Code Here

    final ZonedDateTime effectiveDate = tradeDate.plusYears(1);
    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 underlyingSwap = new SwapSecurity(tradeDate, effectiveDate, maturityDate, COUNTERPARTY, payLeg, receiveLeg);
    underlyingSwap.setName("Receive fixed @ 2% v USD 3m Libor");
    final SecurityDocument toAddDoc = new SecurityDocument();
    toAddDoc.setSecurity(underlyingSwap);
    securityMaster.add(toAddDoc);
View Full Code Here

    final ZonedDateTime effectiveDate = tradeDate.plusYears(1);
    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 receiveLeg1 = new FixedInterestRateLeg(ACT_360, SEMI_ANNUAL, REGION, MODIFIED_FOLLOWING, notional, true, 0.018);
    final FixedInterestRateLeg receiveLeg2 = new FixedInterestRateLeg(ACT_365, SEMI_ANNUAL, REGION, MODIFIED_FOLLOWING, notional, true, 0.01825);
    final SwapSecurity underlyingSwap1 = new SwapSecurity(tradeDate, effectiveDate, maturityDate, COUNTERPARTY, payLeg, receiveLeg1);
    underlyingSwap1.setName("Receive fixed @ 1.8% v USD 3m Libor");
    final SwapSecurity underlyingSwap2 = new SwapSecurity(tradeDate, effectiveDate, maturityDate, COUNTERPARTY, payLeg, receiveLeg2);
    underlyingSwap2.setName("Receive fixed @ 1.825% v USD 3m Libor");
    SecurityDocument toAddDoc = new SecurityDocument();
View Full Code Here

    final ZonedDateTime effectiveDate = tradeDate.plusYears(1);
    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();
View Full Code Here

        return Collections.singleton(new ComputedValue(spec, yieldCurve));
      }

      private Period getFixedLegPaymentTenor(final SwapSecurity swap) {
        if (swap.getReceiveLeg() instanceof FixedInterestRateLeg) {
          FixedInterestRateLeg fixLeg = (FixedInterestRateLeg) swap.getReceiveLeg();
          return PeriodFrequency.convertToPeriodFrequency(fixLeg.getFrequency()).getPeriod();
        } else if (swap.getPayLeg() instanceof FixedInterestRateLeg) {
          FixedInterestRateLeg fixLeg = (FixedInterestRateLeg) swap.getPayLeg();
          return PeriodFrequency.convertToPeriodFrequency(fixLeg.getFrequency()).getPeriod();
        } else {
          throw new OpenGammaRuntimeException("Got a swap without a fixed leg " + swap);
        }

      }
View Full Code Here

  }

  private SecuritySource createSecuritySource() {
    final InMemorySecuritySource securities = new InMemorySecuritySource();
    final ZonedDateTime zdt = ZonedDateTime.now();
    final SwapLeg leg = new FixedInterestRateLeg(DayCountFactory.INSTANCE.getDayCount("ACT/365"), SimpleFrequency.ANNUAL, ExternalId.of("Test", "Region"),
        BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following"), new InterestRateNotional(Currency.USD, 0d), false, 0d);
    final SwapSecurity security = new SwapSecurity(zdt, zdt, zdt, "Counterparty", leg, leg);
    security.addExternalId(ExternalId.of("Security", "Swap"));
    securities.addSecurity(security);
    return securities;
View Full Code Here

    _fooEquity.addExternalId(ExternalId.of("Test", "FooEquity"));
    _fooEquity.setName("Foo");
    _barEquity = new EquitySecurity("exchange", "exchangeCode", "Bar", Currency.USD);
    _barEquity.addExternalId(ExternalId.of("Test", "BarEquity"));
    _barEquity.setName("Bar");
    final SwapLeg swapLeg = new FixedInterestRateLeg(DayCountFactory.INSTANCE.getDayCount("ACT/365"), SimpleFrequency.SEMI_ANNUAL,
        ExternalId.of("Financial", "US"), BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following"), new InterestRateNotional(Currency.USD, 10e6), false, 0.01);
    _swap = new SwapSecurity(ZonedDateTime.now(), ZonedDateTime.now(), ZonedDateTime.now(), "counterParty", swapLeg, swapLeg);
    _swap.addExternalId(ExternalId.of("Test", "Swap"));
  }
View Full Code Here

                                                                       calendar,
                                                                       eomLeg);
    final Period paymentPeriod = convention.getPaymentTenor().getPeriod();
    final Period maturityTenor = swapNode.getMaturityTenor().getPeriod();

    return Pair.of(new FixedInterestRateLeg(dayCount,
                                            PeriodFrequency.of(paymentPeriod),
                                            convention.getRegionCalendar(),
                                            businessDayConvention,
                                            new InterestRateNotional(currency, _amount),
                                            eomLeg,
View Full Code Here

TOP

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

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.