Examples of FixedHistoricalMarketDataSpecification


Examples of com.opengamma.engine.marketdata.spec.FixedHistoricalMarketDataSpecification

      }
      return new ArbitraryViewCycleExecutionSequence(executionSequence);
    }

    private MarketDataSpecification createMarketDataSpec(LocalDate previousHistoricalDate, LocalDate historicalDate, LocalDate valuationDate) {
      FixedHistoricalMarketDataSpecification historicalDateSpec = new FixedHistoricalMarketDataSpecification(historicalDate);
      switch (_marketDataMode) {
        case HISTORICAL:
          return historicalDateSpec;
        case RELATIVE_SHOCK:
          if (previousHistoricalDate == null) {
            return null;
          }
          FixedHistoricalMarketDataSpecification valuationDateSpec = new FixedHistoricalMarketDataSpecification(valuationDate);
          FixedHistoricalMarketDataSpecification previousHistoricalDateSpec = new FixedHistoricalMarketDataSpecification(previousHistoricalDate);
          return new HistoricalShockMarketDataSpecification(ShockType.PROPORTIONAL, previousHistoricalDateSpec, historicalDateSpec, valuationDateSpec);
        default:
          throw new OpenGammaRuntimeException("Unsupported market data mode: " + _marketDataMode);
      }
    }
View Full Code Here

Examples of com.opengamma.engine.marketdata.spec.FixedHistoricalMarketDataSpecification

    if (strings.length > 1) {
      String timeSeriesRating = strings[1].trim();
      if (timeSeriesRating.isEmpty()) {
        throw new IllegalArgumentException(specStr + " doesn't match 'fixedhistorical:timestamp[,time series rating]'");
      }
      return new FixedHistoricalMarketDataSpecification(timeSeriesRating, date);
    } else {
      return new FixedHistoricalMarketDataSpecification(date);
    }
  }
View Full Code Here

Examples of com.opengamma.engine.marketdata.spec.FixedHistoricalMarketDataSpecification

        try {
          snapshotDate = LocalDate.parse(localDateStr);
        } catch (DateTimeParseException ex) {
          throw new OpenGammaRuntimeException("Error parsing given snapshot date [" + snapshotDate + "]", ex.getCause());
        }
        return new FixedHistoricalMarketDataSpecification(htsKey, snapshotDate);
      } else {
        throw new OpenGammaRuntimeException("Given historical option [" + historicalOption + "] does not match expected format localdate/htskey");
      }
    }
    return MarketData.live();
View Full Code Here

Examples of com.opengamma.engine.marketdata.spec.FixedHistoricalMarketDataSpecification

      appContext.start();

      ViewProcessor viewProcessor = appContext.getBean("viewProcessor", ViewProcessor.class);

      ViewClient viewClient = viewProcessor.createViewClient(UserPrincipal.getLocalUser());
      MarketDataSpecification marketDataSpec = new FixedHistoricalMarketDataSpecification(s_observationDateTime.toLocalDate());
      ViewCycleExecutionOptions cycleOptions = ViewCycleExecutionOptions.builder().setValuationTime(s_valuationInstant).setMarketDataSpecification(marketDataSpec)
          .setResolverVersionCorrection(VersionCorrection.of(s_versionAsOf, s_correctedTo)).create();
      ViewCycleExecutionSequence executionSequence = ArbitraryViewCycleExecutionSequence.of(cycleOptions);

      ExecutionOptions executionOptions = new ExecutionOptions(executionSequence, ExecutionFlags.none().awaitMarketData().get(), null, null);
View Full Code Here

Examples of com.opengamma.engine.marketdata.spec.FixedHistoricalMarketDataSpecification

  /** Builds instances of {@link FixedHistoricalMarketDataSpecification}. */
  private static class FixedHistoricalSpecificationBuilder implements SpecificationBuilder {

    @Override
    public MarketDataSpecification build(JSONObject json) throws JSONException {
      return new FixedHistoricalMarketDataSpecification(
          json.getString(MarketDataSpecificationJsonReader.RESOLVER_KEY),
          LocalDate.parse(json.getString(DATE)));
    }
View Full Code Here

Examples of com.opengamma.engine.marketdata.spec.FixedHistoricalMarketDataSpecification

    return super.isCompatible(marketDataSpec);
  }

  @Override
  public MarketDataSnapshot snapshot(final MarketDataSpecification marketDataSpec) {
    final FixedHistoricalMarketDataSpecification historicalSpec = (FixedHistoricalMarketDataSpecification) marketDataSpec;
    // TODO something better thought-out here
    //Instant snapshotInstant = historicalSpec.getSnapshotDate().atMidnight().atZone(ZoneOffset.UTC).toInstant();
    final Instant snapshotInstant = historicalSpec.getSnapshotDate().atTime(16, 0).atZone(ZoneOffset.UTC).toInstant();
    final LocalDate snapshotDate = historicalSpec.getSnapshotDate();
    return new HistoricalMarketDataSnapshot(getTimeSeriesSource(), snapshotInstant, snapshotDate);
  }
View Full Code Here

Examples of com.opengamma.engine.marketdata.spec.FixedHistoricalMarketDataSpecification

  @Test
  public void fixedHistoricalValid() {
    MarketDataSpecification specNoRating = MarketDataSpecificationParser.parse("fixedhistorical:2011-03-08");
    LocalDate date = LocalDate.of(2011, 3, 8);
    assertEquals(new FixedHistoricalMarketDataSpecification(date), specNoRating);
    MarketDataSpecification specWithRating =
        MarketDataSpecificationParser.parse("fixedhistorical:2011-03-08,RATING_NAME");
    assertEquals(new FixedHistoricalMarketDataSpecification("RATING_NAME", date), specWithRating);
  }
View Full Code Here

Examples of com.opengamma.engine.marketdata.spec.FixedHistoricalMarketDataSpecification

  public void historicalMarketDataOption() throws Exception {
    String[] args = {"-n", PORTFOLIO_NAME, "--historical", "2013-06-20/timeSeriesResolverKey"};
    ViewStatusOption statusOption = ViewStatusOption.getViewStatusReporterOption(s_parser.parse(s_options, args), s_toolContext);
    assertNotNull(statusOption);
    assertTrue(statusOption.getMarketDataSpecification() instanceof FixedHistoricalMarketDataSpecification);
    FixedHistoricalMarketDataSpecification marketDataSpecification = (FixedHistoricalMarketDataSpecification) statusOption.getMarketDataSpecification();
    assertNotNull(marketDataSpecification.getSnapshotDate());
    assertEquals("2013-06-20", marketDataSpecification.getSnapshotDate().toString());
    assertEquals("timeSeriesResolverKey", marketDataSpecification.getTimeSeriesResolverKey());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.