Package com.opengamma.master.marketdatasnapshot

Examples of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotSearchRequest


    final MarketDataSnapshotDocument doc2Loaded = _snpMaster.get(doc2.getUniqueId());
    assertEquivalent(doc2, doc2Loaded);

    // Search by name with data
    final MarketDataSnapshotSearchRequest request1 = new MarketDataSnapshotSearchRequest();
    request1.setIncludeData(true);
    request1.setName(doc1.getName());
    final MarketDataSnapshotSearchResult result1 = _snpMaster.search(request1);
    assertTrue(result1.getDocuments().size() > 0);

    // Search by name without data
    final MarketDataSnapshotSearchRequest request2 = new MarketDataSnapshotSearchRequest();
    request2.setIncludeData(false);
    request2.setName(doc1.getName());
    final MarketDataSnapshotSearchResult result2 = _snpMaster.search(request2);
    assertTrue(result2.getDocuments().size() > 0);
    assertEquals(result1.getDocuments().size(), result2.getDocuments().size());

    // Search by ID
    final MarketDataSnapshotSearchRequest request3 = new MarketDataSnapshotSearchRequest();
    request3.setSnapshotIds(ImmutableSet.of(doc1.getUniqueId().getObjectId()));
    final MarketDataSnapshotSearchResult result3 = _snpMaster.search(request3);
    assertEquals(1, result3.getDocuments().size());
    assertEquals(doc1.getUniqueId(), result3.getFirstDocument().getUniqueId());
  }
View Full Code Here


    final MasterConfigSource configSource = new MasterConfigSource(getToolContext().getConfigMaster());
    final SecurityMaster securityMaster = getToolContext().getSecurityMaster();

    String snapshotName = "Sameday spread";
    MarketDataSnapshotSearchRequest marketDataSnapshotSearchRequest = new MarketDataSnapshotSearchRequest();
    marketDataSnapshotSearchRequest.setName(snapshotName);
    MarketDataSnapshotSearchResult marketDataSnapshotSearchResult = getToolContext().getMarketDataSnapshotMaster().search(marketDataSnapshotSearchRequest);
    ManageableMarketDataSnapshot snapshot = marketDataSnapshotSearchResult.getFirstSnapshot();

    PortfolioSearchRequest portfolioSearchRequest = new PortfolioSearchRequest();
    portfolioSearchRequest.setName("CDSOpts");
View Full Code Here

    if (snapshotOption != null) {
      MarketDataSnapshotMaster snapshotMaster = toolContext.getMarketDataSnapshotMaster();
      if (snapshotMaster == null) {
        throw new OpenGammaRuntimeException("MarketDataSnapshotMaster is missing from given Toolcontext");
      }
      MarketDataSnapshotSearchRequest request = new MarketDataSnapshotSearchRequest();
      request.setName(snapshotOption);
      MarketDataSnapshotSearchResult searchResult = snapshotMaster.search(request);
      if (searchResult.getDocuments().isEmpty()) {
        throw new OpenGammaRuntimeException("No matching snapshot for given name [" + marketDataOption + "]");
      }
      return new UserMarketDataSpecification(searchResult.getFirstDocument().getUniqueId());
View Full Code Here

    AbstractTool<ToolContext> remoteServerTool = new AbstractTool<ToolContext>() {

      @Override
      protected void doRun() throws Exception {
        MarketDataSnapshotMaster remoteSnapshotMaster = getToolContext().getMarketDataSnapshotMaster();
        MarketDataSnapshotSearchRequest request = new MarketDataSnapshotSearchRequest();
        for (MarketDataSnapshotDocument snapshotDocument : MarketDataSnapshotSearchIterator.iterable(remoteSnapshotMaster, request)) {
          marketDataSnapshotMaster.add(snapshotDocument);
        }
      }
    };
View Full Code Here

  /**
   * Get a list of all available snapshots
   * @return the list of all available snapshot ids and names or an empty list if no snapshots found
   */
  public List<String> allSnapshots() {
    MarketDataSnapshotSearchRequest searchRequest = new MarketDataSnapshotSearchRequest();
    searchRequest.setIncludeData(false);
    MarketDataSnapshotSearchResult searchResult = _snapshotMaster.search(searchRequest);
    List<String> results = new ArrayList<>();
    for (MarketDataSnapshotDocument doc : searchResult.getDocuments()) {
      results.add(getSnapshotNameId(doc));
    }
View Full Code Here

   * Get a list of snapshot according to a glob query string
   * @param query the query string, which can contain wildcards
   * @return the list of resulting snapshot ids and names or an empty list if no matches
   */
  public List<String> snapshotByGlob(String query) {
    MarketDataSnapshotSearchRequest searchRequest = new MarketDataSnapshotSearchRequest();
    searchRequest.setName(query);
    searchRequest.setIncludeData(false);
    MarketDataSnapshotSearchResult searchResult = _snapshotMaster.search(searchRequest);
    List<String> results = new ArrayList<>();
    for (MarketDataSnapshotDocument doc : searchResult.getDocuments()) {
      results.add(getSnapshotNameId(doc));
    }
View Full Code Here

   * @param name exact name of the snapshot, not null
   * @return the UniqueId of the matched snapshot, or null if no match found
   * @throws OpenGammaRuntimeException if multiple matches are found
   */
  public UniqueId latestSnapshotByName(String name) {
    MarketDataSnapshotSearchRequest searchRequest = new MarketDataSnapshotSearchRequest();
    searchRequest.setName(name);
    searchRequest.setIncludeData(false);
    MarketDataSnapshotSearchResult searchResult = _snapshotMaster.search(searchRequest);
    if (searchResult.getDocuments().size() > 1) {
      throw new OpenGammaRuntimeException("More than one snapshot matches supplied name");
    }
    if (searchResult.getDocuments().size() == 0) {
View Full Code Here

   * @param dateTime the date/time of the version of the snapshot to fetch
   * @return the UniqueId of the matched snapshot, or null if no match found
   * @throws OpenGammaRuntimeException if multiple matches are found
   */
  public UniqueId latestSnapshotByNameAndDate(String name, ZonedDateTime dateTime) {
    MarketDataSnapshotSearchRequest searchRequest = new MarketDataSnapshotSearchRequest();
    searchRequest.setName(name);
    searchRequest.setIncludeData(false);
    MarketDataSnapshotSearchResult searchResult = _snapshotMaster.search(searchRequest);
    searchRequest.setVersionCorrection(VersionCorrection.ofVersionAsOf(dateTime.toInstant()));
    if (searchResult.getDocuments().size() > 1) {
      throw new OpenGammaRuntimeException("More than one snapshot matches supplied name");
    }
    if (searchResult.getDocuments().size() == 0) {
      return null;
View Full Code Here

   * @param name exact name of the snapshot, not null
   * @return a list of VersionInfo meta data objects containing version correction ranges and unique ids
   * @throws OpenGammaRuntimeException if multiple name matches are found
   */
  public List<VersionInfo> snapshotVersionsByName(String name) {
    MarketDataSnapshotSearchRequest searchRequest = new MarketDataSnapshotSearchRequest();
    searchRequest.setName(name);
    searchRequest.setIncludeData(false);
    MarketDataSnapshotSearchResult searchResult = _snapshotMaster.search(searchRequest);
    if (searchResult.getDocuments().size() > 1) {
      s_logger.warn("More than one snapshot matches supplied name, using first");
    }
    if (searchResult.getDocuments().size() == 0) {
View Full Code Here

   * @return JSON {@code [{basisViewName: basisViewName1, snapshots: [{id: snapshot1Id, name: snapshot1Name}, ...]}, ...]}
   */
  @GET
  @Produces(MediaType.APPLICATION_JSON)
  public String getMarketDataSnapshotList() {
    MarketDataSnapshotSearchRequest snapshotSearchRequest = new MarketDataSnapshotSearchRequest();
    snapshotSearchRequest.setIncludeData(false);
   
    Multimap<String, ManageableMarketDataSnapshot> snapshotsByBasisView = ArrayListMultimap.create();
    for (MarketDataSnapshotDocument doc : MarketDataSnapshotSearchIterator.iterable(_snapshotMaster, snapshotSearchRequest)) {
      ManageableMarketDataSnapshot snapshot = doc.getSnapshot();
      if (snapshot.getUniqueId() == null) {
View Full Code Here

TOP

Related Classes of com.opengamma.master.marketdatasnapshot.MarketDataSnapshotSearchRequest

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.