Package com.opengamma.master.security

Examples of com.opengamma.master.security.SecuritySearchRequest


  private void createSurfaces(String name, boolean dryRun) {
    ConfigMaster configMaster = getToolContext().getConfigMaster();
    SecurityMaster securityMaster = getToolContext().getSecurityMaster();
    ReferenceDataProvider bbgRefData = getToolContext().getBloombergReferenceDataProvider();

    SecuritySearchRequest securityRequest = new SecuritySearchRequest();
    securityRequest.setName(name);
    securityRequest.setSortOrder(SecuritySearchSortOrder.NAME_ASC);

    for (SecurityDocument doc : SecuritySearchIterator.iterable(securityMaster, securityRequest)) {
      FinancialSecurity security = (FinancialSecurity) doc.getSecurity();
      try {
        security.accept(new VolSurfaceCreatorVisitor(configMaster, bbgRefData, _volSpecificationNames, _volDefinitionNames, dryRun));
View Full Code Here


      final SecureRandom random = new SecureRandom();
      for (PositionDocument positionDocument : positions.values()) {
        ManageablePosition position = positionDocument.getValue();

        ManageableSecurityLink link = position.getSecurityLink();
        SecuritySearchRequest ssr = new SecuritySearchRequest();
        ssr.addExternalIds(link.getExternalIds());
        SecuritySearchResult securitySearchResult = getToolContext().getSecurityMaster().search(ssr);
        Security security = securitySearchResult.getFirstSecurity();
        //Security security = position.getSecurity();
        if (security != null && security instanceof CreditDefaultSwapOptionSecurity) {
          CreditDefaultSwapOptionSecurity cdsOption = (CreditDefaultSwapOptionSecurity) security;
View Full Code Here

    for (String securityType : metaData.getSecurityTypes()) {
      if (UNSUPPORTED_SECURITY_TYPES.contains(securityType)) {
        continue;
      }
      s_logger.info("Processing security type " + securityType);
      SecuritySearchRequest searchRequest = new SecuritySearchRequest();
      searchRequest.setName("*");
      searchRequest.setSecurityType(securityType);
      searchRequest.setPagingRequest(PagingRequest.FIRST_PAGE);
      SecuritySearchResult search = securityMaster.search(searchRequest);
      s_logger.info("Search returned " + search.getPaging().getTotalItems() + " securities");
      List<ManageableSecurity> securities = search.getSecurities();
      int count = 0;
      for (ManageableSecurity security : securities) {
View Full Code Here

   * {@link SecuritySearchResult}.  The current version of the existing securities are used.
   * @param security new security to search for in Master
   * @return search result
   */
  protected SecuritySearchResult lookupSecurity(ManageableSecurity security) {
    SecuritySearchRequest searchReq = new SecuritySearchRequest();
    ExternalIdSearch idSearch = new ExternalIdSearch(security.getExternalIdBundle())// match any one of the IDs
    searchReq.setVersionCorrection(VersionCorrection.ofVersionAsOf(Instant.now())); // valid now
    searchReq.setExternalIdSearch(idSearch);
    searchReq.setFullDetail(true);
    searchReq.setSortOrder(SecuritySearchSortOrder.VERSION_FROM_INSTANT_DESC);
    SecuritySearchResult searchResult = _securityMaster.search(searchReq);
    return searchResult;
  }
View Full Code Here

      }
      ManageableSecurity security = (ManageableSecurity) position.getSecurityLink().resolve(_securitySource);
      ExternalId underlyingId = FinancialSecurityUtils.getUnderlyingId(security);
      ManageableSecurity underlying;
      if (underlyingId != null) {
        SecuritySearchResult searchResult = _securityMaster.search(new SecuritySearchRequest(underlyingId));
        underlying = searchResult.getFirstSecurity();
      } else {
        underlying = null;
      }
      T result = function.apply(node, position, security, underlying);
View Full Code Here

  /**
   * Deletes securities from the specified sec master.
   */
  @Override
  protected void doRun() {   
    SecuritySearchRequest securitySearchRequest = new SecuritySearchRequest();

    if (getCommandLine().hasOption(SECURITY_NAMES_OPT)) {
      securitySearchRequest.setName(
          getCommandLine().getOptionValue(SECURITY_NAMES_OPT));
    }
    if (getCommandLine().hasOption(SECURITY_IDS_OPT)) {
      List<ObjectId> ids = new ArrayList<ObjectId>();
      for (String s : getCommandLine().getOptionValues(SECURITY_IDS_OPT)) {
        ids.add(ObjectId.parse(s));
      }
      securitySearchRequest.setObjectIds(ids);
    }
    if (getCommandLine().hasOption(EXTERNAL_ID_SCHEMES_OPT)) {
      securitySearchRequest.setExternalIdScheme(
          getCommandLine().getOptionValue(EXTERNAL_ID_SCHEMES_OPT));
    }
    if (getCommandLine().hasOption(EXTERNAL_ID_VALUES_OPT)) {
      securitySearchRequest.setExternalIdValue(
          getCommandLine().getOptionValue(EXTERNAL_ID_VALUES_OPT));
    }
   
    SecurityMaster securityMaster = getToolContext().getSecurityMaster();
    for (SecurityDocument securityDocument : SecuritySearchIterator.iterable(securityMaster, securitySearchRequest)) {
View Full Code Here

   * @return the list of missing bundles, not null
   */
  protected Map<ExternalIdBundle, Security> findMissing(SecurityLoaderRequest request, SecurityLoaderResult result) {
    Map<ExternalIdBundle, Security> missing = Maps.newHashMap();
    for (ExternalIdBundle requestedBundle : request.getExternalIdBundles()) {
      SecuritySearchRequest searchRequest = new SecuritySearchRequest(requestedBundle);
      searchRequest.setSortOrder(SecuritySearchSortOrder.OBJECT_ID_ASC);
      searchRequest.setFullDetail(request.isReturnSecurityObjects() || request.isForceUpdate());
     
      SecuritySearchResult searchResult = _securityMaster.search(searchRequest);
      if (searchResult.getDocuments().size() == 0) {
        missing.put(requestedBundle, null);
      } else {
View Full Code Here

    }
   
    // check which are missing
    List<ExternalIdBundle> missing = Lists.newArrayList();
    for (ExternalIdBundle underlyingId : underlyingIds) {
      SecuritySearchRequest searchRequest = new SecuritySearchRequest(underlyingId);
      searchRequest.setSortOrder(SecuritySearchSortOrder.OBJECT_ID_ASC);
      searchRequest.setFullDetail(false);
      SecuritySearchResult searchResult = _securityMaster.search(searchRequest);
      if (searchResult.getDocuments().size() == 0) {
        missing.add(underlyingId);
      }
    }
View Full Code Here

  }

  //-------------------------------------------------------------------------
  @Test(enabled = false, description = "Queries the entire database")
  public void test_queryAll() throws Exception {
    final SecuritySearchRequest request = new SecuritySearchRequest();
    request.setPagingRequest(PagingRequest.NONE);
    final int total = getSecurityMaster().search(request).getPaging().getTotalItems();
    final int pages = (total / PAGE_SIZE) + 1;
    for (int page = 1; page <= pages; page++) {
      request.setPagingRequest(PagingRequest.ofPage(page, PAGE_SIZE));
      System.out.println("Checking security master, page " + request.getPagingRequest());
      try {
        final SecuritySearchResult result = getSecurityMaster().search(request);
        for (final SecurityDocument doc : result.getDocuments()) {
          assertNotNull(doc);
          assertNotNull(doc.getUniqueId());
View Full Code Here

    SecurityMaster securityMaster = getToolContext().getSecurityMaster();
    SecurityMetaDataRequest metaRequest = new SecurityMetaDataRequest();
    SecurityMetaDataResult metaData = securityMaster.metaData(metaRequest);
    for (String securityType : metaData.getSecurityTypes()) {
      s_logger.info("Processing security type " + securityType);
      SecuritySearchRequest searchRequest = new SecuritySearchRequest();
      searchRequest.setName("*");
      searchRequest.setSecurityType(securityType);
      searchRequest.setPagingRequest(PagingRequest.ONE);
      SecuritySearchResult search = securityMaster.search(searchRequest);
      s_logger.info("Search returned " + search.getPaging().getTotalItems() + " securities");
      dumpSecurityStructure(csvWriter, securityType, search.getFirstSecurity());
    }
    csvWriter.close();
View Full Code Here

TOP

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

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.