Package com.opengamma.master.security

Examples of com.opengamma.master.security.SecurityDocument


  }

  @Test
  public void testPositionSecurityWithoutObligorIsIgnored() {

    SecurityDocument document = new SecurityDocument();
    CashSecurity security = new CashSecurity(Currency.of("USD"),
                                             ExternalSchemes.financialRegionId("US"),
                                             ZonedDateTime.now(),
                                             ZonedDateTime.now().plusYears(5),
                                             DayCountFactory.INSTANCE.getDayCount("Actual/360"),
                                             0.05,
                                             100000);
    ExternalId secId = ExternalId.of("SEC_ID", "12345");
    security.addExternalId(secId);
    document.setSecurity(security);
    _securityMaster.add(document);

    Position posn = new SimplePosition(BigDecimal.ONE, secId);
    assertEquals(_aggregator.classifyPosition(posn), "N/A");
  }
View Full Code Here


                                                            CreditRatingFitch.NR, CreditRatingMoodys.NR,
                                                            CreditRatingStandardAndPoors.NR, false);

    _organizationMaster.add(new OrganizationDocument(org));

    SecurityDocument document = new SecurityDocument();
    ManageableSecurity cds = createCdsWithRedCode("39FF64");
    ExternalId secId = ExternalId.of("SEC_ID", "12345");
    cds.addExternalId(secId);
    document.setSecurity(cds);
    _securityMaster.add(document);

    Position posn = new SimplePosition(BigDecimal.ONE, secId);

    assertEquals(_aggregator.classifyPosition(posn), "FINANCIALS");
View Full Code Here

  }

  @Test
  public void testPositionSecurityWithoutObligorIsIgnored() {

    SecurityDocument document = new SecurityDocument();
    CashSecurity security = new CashSecurity(Currency.of("USD"),
                                             ExternalSchemes.financialRegionId("US"),
                                             ZonedDateTime.now(),
                                             ZonedDateTime.now().plusYears(5),
                                             DayCountFactory.INSTANCE.getDayCount("Actual/360"),
                                             0.05,
                                             100000);
    ExternalId secId = ExternalId.of("SEC_ID", "12345");
    security.addExternalId(secId);
    document.setSecurity(security);
    _securityMaster.add(document);

    Position posn = new SimplePosition(BigDecimal.ONE, secId);
    assertEquals(_aggregator.classifyPosition(posn), "N/A");
  }
View Full Code Here

  }

  @Test
  public void testPositionSecurityWithRedCodeIsUsed() {

    SecurityDocument document = new SecurityDocument();
    ManageableSecurity cds = new StandardVanillaCDSSecurity(true, ExternalId.of("EXTERNAL_CODE" ,"ProtBuyer"),
                                                                    ExternalId.of("EXTERNAL_CODE" ,"ProtSeller"), ExternalSchemes.markItRedCode("39FF64"),
                                                                    DebtSeniority.SNRFOR, RestructuringClause.MM, ExternalSchemes.financialRegionId("US"),
                                                                    createZdt(2013, 3, 20), createZdt(2013, 3, 21), createZdt(2014,3,20), StubType.SHORT_START,
                                                                    SimpleFrequency.SEMI_ANNUAL, DayCountFactory.INSTANCE.getDayCount("Actual/360"),
                                                                    BusinessDayConventionFactory.INSTANCE.getBusinessDayConvention("Following"),
                                                                    true, true, true, new InterestRateNotional(Currency.USD, 10000000), true, true, 500,
                                                                    new InterestRateNotional(Currency.USD, 500000), 500, createZdt(2013,3,21), true);
    ExternalId secId = ExternalId.of("SEC_ID", "12345");
    cds.addExternalId(secId);
    document.setSecurity(cds);
    _securityMaster.add(document);

    Position posn = new SimplePosition(BigDecimal.ONE, secId);

    assertEquals(_aggregator.classifyPosition(posn), "SNRFOR");
View Full Code Here

        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);
      swaption.setName(swaptionName);
      swaptions[i] = swaption;
View Full Code Here

   */
  protected Collection<EquitySecurity> createAndPersistEquitySecurities() {
    SecurityMaster secMaster = getToolContext().getSecurityMaster();
    Collection<EquitySecurity> securities = loadEquitySecurities();
    for (EquitySecurity security : securities) {
      SecurityDocument doc = new SecurityDocument(security);
      secMaster.add(doc);
    }
    return securities;
  }
View Full Code Here

    portfolioMaster.add(portfolioDoc);
  }

  private void storeFinancialSecurity(final FinancialSecurity security) {
    SecurityMaster securityMaster = getToolContext().getSecurityMaster();
    SecurityDocument toAddDoc = new SecurityDocument();
    toAddDoc.setSecurity(security);
    securityMaster.add(toAddDoc);
  }
View Full Code Here

      ConventionBundle swapConvention = getSwapConventionBundle(ccy, toolContext.getConventionBundleSource());
      ConventionBundle liborConvention = getLiborConventionBundle(swapConvention, toolContext.getConventionBundleSource());
      sb.append("\t").append(liborConvention.getIdentifiers()).append("\n");
      RawSecurity rawSecurity = new RawSecurity(LIBOR_RATE_SECURITY_TYPE, rawData);
      rawSecurity.setExternalIdBundle(liborConvention.getIdentifiers());
      SecurityDocument secDoc = new SecurityDocument();
      secDoc.setSecurity(rawSecurity);
      securityMaster.add(secDoc);
    }
    s_logger.info(sb.toString());
  }
View Full Code Here

  protected void doRun() throws Exception {
   
    final SecurityMaster secMaster = getToolContext().getSecurityMaster();
   
    final ManageableSecurity cds = makeOneCDS();
    final SecurityDocument cdsDoc = new SecurityDocument(cds);
   
    secMaster.add(cdsDoc);
   
    portfolioWithSecurity(cds, "Test CDS Port 1");
  }
View Full Code Here

  }

  @Test
  public void testPositionSecurityWithoutObligorIsIgnored() {

    SecurityDocument document = new SecurityDocument();
    CashSecurity security = new CashSecurity(Currency.of("USD"),
                                             ExternalSchemes.financialRegionId("US"),
                                             ZonedDateTime.now(),
                                             ZonedDateTime.now().plusYears(5),
                                             DayCountFactory.INSTANCE.getDayCount("Actual/360"),
                                             0.05,
                                             100000);
    ExternalId secId = ExternalId.of("SEC_ID", "12345");
    security.addExternalId(secId);
    document.setSecurity(security);
    _securityMaster.add(document);

    Position posn = new SimplePosition(BigDecimal.ONE, secId);
    assertEquals(_aggregator.classifyPosition(posn), "N/A");
  }
View Full Code Here

TOP

Related Classes of com.opengamma.master.security.SecurityDocument

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.