Package com.opengamma.financial.security.bond

Examples of com.opengamma.financial.security.bond.GovernmentBondSecurity


        return bondSecurity;
      }

      @Override
      public BondSecurity visitGovernmentBondSecurity(GovernmentBondSecurity bond) {
        BondSecurity bondSecurity = new GovernmentBondSecurity(bean.getIssuerName(), bean.getIssuerType().getName(), bean.getIssuerDomicile(),
          bean.getMarket().getName(), currencyBeanToCurrency(bean.getCurrency()),
          yieldConventionBeanToYieldConvention(bean.getYieldConvention()), expiryBeanToExpiry(bean.getLastTradeDate()),
          bean.getCouponType().getName(), bean.getCouponRate(), frequencyBeanToFrequency(bean.getCouponFrequency()),
          dayCountBeanToDayCount(bean.getDayCountConvention()), zonedDateTimeBeanToDateTimeWithZone(bean.getInterestAccrualDate()),
          zonedDateTimeBeanToDateTimeWithZone(bean.getSettlementDate()),
          zonedDateTimeBeanToDateTimeWithZone(bean.getFirstCouponDate()), bean.getIssuancePrice(), bean.getTotalAmountIssued(),
          bean.getMinimumAmount(), bean.getMinimumIncrement(), bean.getParAmount(), bean.getRedemptionValue());
        bondSecurity.setBusinessDayConvention(businessDayConventionBeanToBusinessDayConvention(bean.getBusinessDayConvention()));
        bondSecurity.setAnnouncementDate(zonedDateTimeBeanToDateTimeWithZone(bean.getAnnouncementDate()));
        bondSecurity.setGuaranteeType(bean.getGuaranteeType() != null ? bean.getGuaranteeType().getName() : null);
        return bondSecurity;
      }

      @Override
      public BondSecurity visitMunicipalBondSecurity(MunicipalBondSecurity bond) {
        BondSecurity bondSecurity = new MunicipalBondSecurity(bean.getIssuerName(), bean.getIssuerType().getName(), bean.getIssuerDomicile(),
          bean.getMarket().getName(), currencyBeanToCurrency(bean.getCurrency()),
          yieldConventionBeanToYieldConvention(bean.getYieldConvention()), expiryBeanToExpiry(bean.getLastTradeDate()),
          bean.getCouponType().getName(), bean.getCouponRate(), frequencyBeanToFrequency(bean.getCouponFrequency()),
          dayCountBeanToDayCount(bean.getDayCountConvention()), zonedDateTimeBeanToDateTimeWithZone(bean.getInterestAccrualDate()),
          zonedDateTimeBeanToDateTimeWithZone(bean.getSettlementDate()),
          zonedDateTimeBeanToDateTimeWithZone(bean.getFirstCouponDate()),
          bean.getIssuancePrice(), bean.getTotalAmountIssued(), bean.getMinimumAmount(), bean.getMinimumIncrement(),
          bean.getParAmount(), bean.getRedemptionValue());
        bondSecurity.setBusinessDayConvention(businessDayConventionBeanToBusinessDayConvention(bean.getBusinessDayConvention()));
        bondSecurity.setAnnouncementDate(zonedDateTimeBeanToDateTimeWithZone(bean.getAnnouncementDate()));
        bondSecurity.setGuaranteeType(bean.getGuaranteeType() != null ? bean.getGuaranteeType().getName() : null);
        return bondSecurity;
      }
     
      @Override
      public BondSecurity visitInflationBondSecurity(InflationBondSecurity bond) {
        BondSecurity bondSecurity = new InflationBondSecurity(bean.getIssuerName(), bean.getIssuerType().getName(), bean.getIssuerDomicile(),
          bean.getMarket().getName(), currencyBeanToCurrency(bean.getCurrency()),
          yieldConventionBeanToYieldConvention(bean.getYieldConvention()), expiryBeanToExpiry(bean.getLastTradeDate()),
          bean.getCouponType().getName(), bean.getCouponRate(), frequencyBeanToFrequency(bean.getCouponFrequency()),
          dayCountBeanToDayCount(bean.getDayCountConvention()), zonedDateTimeBeanToDateTimeWithZone(bean.getInterestAccrualDate()),
          zonedDateTimeBeanToDateTimeWithZone(bean.getSettlementDate()),
          zonedDateTimeBeanToDateTimeWithZone(bean.getFirstCouponDate()),
          bean.getIssuancePrice(), bean.getTotalAmountIssued(), bean.getMinimumAmount(), bean.getMinimumIncrement(),
          bean.getParAmount(), bean.getRedemptionValue());
        bondSecurity.setBusinessDayConvention(businessDayConventionBeanToBusinessDayConvention(bean.getBusinessDayConvention()));
        bondSecurity.setAnnouncementDate(zonedDateTimeBeanToDateTimeWithZone(bean.getAnnouncementDate()));
        bondSecurity.setGuaranteeType(bean.getGuaranteeType() != null ? bean.getGuaranteeType().getName() : null);
        return bondSecurity;
      }

    });
  }
View Full Code Here


  //-------------------------------------------------------------------------
  @Test(enabled = false)
  public void test_bond() throws Exception {
    ZonedDateTime zdt = ZonedDateTime.parse("2011-01-31T12:00Z[Europe/London]");
    GovernmentBondSecurity sec = new GovernmentBondSecurity("US TREASURY N/B", "issuerType", "issuerDomicile", "market",
        Currency.GBP, SimpleYieldConvention.US_TREASURY_EQUIVALANT, new Expiry(zdt),
        "couponType", 23.5d, SimpleFrequency.ANNUAL, DayCountFactory.INSTANCE.getDayCount("Act/Act"),
        zdt, zdt, zdt, 129d, 1324d, 12d, 1d, 2d, 3d);
    sec.addExternalId(ExternalId.of("abc", "def"));
    SecurityDocument addDoc = new SecurityDocument(sec);
    SecurityDocument added = _secMaster.add(addDoc);
   
    SecurityDocument loaded = _secMaster.get(added.getUniqueId());
    assertEquals(added, loaded);
View Full Code Here

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

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

    assertTrue(ids.containsAll(Arrays.asList(ExternalId.of(SCHEME, "FX_OPTION_USD"), ExternalId.of(SCHEME, "FX_OPTION_EUR"))));
  }

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

    assertNull(ids);
  }

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

    assertTrue(ids.containsAll(Arrays.asList(ExternalId.of(SCHEME, "USD"), ExternalId.of(SCHEME, "EUR"))));
  }

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

    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "54"));
    return security;
  }

  public static GovernmentBondSecurity getGovernmentBondSecurity() {
    final GovernmentBondSecurity security = new GovernmentBondSecurity("US", "US", "US", "US", USD, SimpleYieldConvention.TRUE, new Expiry(DateUtils.getUTCDate(2020, 1, 1)),
        "Coupon", 0.01, PeriodFrequency.SEMI_ANNUAL,
        DC, DateUtils.getUTCDate(2010, 1, 1), DateUtils.getUTCDate(2010, 1, 1), DateUtils.getUTCDate(2010, 1, 1), 100., 300, 1, 1, 100, 1);
    security.setUniqueId(UniqueId.of(UniqueId.EXTERNAL_SCHEME.getName(), "78"));
    return security;
  }
View Full Code Here

    final double totalAmountIssued = 1e9;
    final double minimumAmount = 50000;
    final double minimumIncrement = 50000;
    final double parAmount = 50000;
    final double redemptionValue = 100;
    final GovernmentBondSecurity security = new GovernmentBondSecurity(issuerName, issuerType, issuerDomicile, market, currency, yieldConvention, lastTradeDate, couponType, couponRate,
          couponFrequency, dayCountConvention, interestAccrualDate, settlementDate, firstCouponDate, issuancePrice, totalAmountIssued, minimumAmount, minimumIncrement, parAmount, redemptionValue);
    store(security);
    return security;
  }
View Full Code Here

            totalAmountIssued, minimumAmount, minimumIncrement, parAmount,
            redemptionValue);
        ((BondSecurity) bondSecurity).setAnnouncementDate(announcementDate);
        ((BondSecurity) bondSecurity).setGuaranteeType(guaranteeType);
      } else if (issuerType.trim().equals(SOVEREIGN)) {
        bondSecurity = new GovernmentBondSecurity(issuerName, issuerType, issuerDomicile, market, currency,
            yieldConvention, maturity, couponType, couponRate,
            couponFrequency, dayCount, interestAccrualDate, settlementDate, firstCouponDate, issuancePrice,
            totalAmountIssued, minimumAmount, minimumIncrement, parAmount,
            redemptionValue);
        ((BondSecurity) bondSecurity).setAnnouncementDate(announcementDate);
View Full Code Here

    assertNull(ids);
  }

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

TOP

Related Classes of com.opengamma.financial.security.bond.GovernmentBondSecurity

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.