Package org.threeten.bp

Examples of org.threeten.bp.Clock


    _usrMaster = null;
  }

  //-------------------------------------------------------------------------
  protected ObjectId setupTestData(Instant now) {
    Clock origClock = _usrMaster.getClock();
    try {
      _usrMaster.setClock(Clock.fixed(now, ZoneOffset.UTC));

      final ExternalIdBundle bundle = ExternalIdBundle.of("B", "B0");
      ManageableOGUser user = new ManageableOGUser("initial");
View Full Code Here


    assertNotNull(hts);
    assertEquals(getLatestWeekDay(), hts.getLatestTime());
  }
 
  private LocalDate getLatestWeekDay() {
    Clock clock = Clock.systemUTC();
    return DateUtils.previousWeekDay(LocalDate.now(clock).plusDays(1));
  }
View Full Code Here

        // that ultimately in OG-LiveData normalization and pull out the OGRate key rather than
        // the crazy IndicativeValue name.
        final FixedIncomeStripIdentifierAndMaturityBuilder builder = new FixedIncomeStripIdentifierAndMaturityBuilder(OpenGammaExecutionContext.getRegionSource(executionContext),
            OpenGammaExecutionContext.getConventionBundleSource(executionContext), executionContext.getSecuritySource(), OpenGammaExecutionContext.getHolidaySource(executionContext));
        final InterpolatedYieldCurveSpecificationWithSecurities specWithSecurities = builder.resolveToSecurity(specification, marketData);
        final Clock snapshotClock = executionContext.getValuationClock();
        final ZonedDateTime today = ZonedDateTime.now(snapshotClock); // TODO: change to times
        final Map<Double, Double> timeInYearsToRates = new TreeMap<Double, Double>();
        boolean isFirst = true;
        for (final FixedIncomeStripWithSecurity strip : specWithSecurities.getStrips()) {
          Double price = marketData.getDataPoint(strip.getSecurityIdentifier());
View Full Code Here

    }
    if (surfaceQuoteUnits == null) {
      throw new OpenGammaRuntimeException("Could not get surface quote units");
    }

    final Clock snapshotClock = executionContext.getValuationClock();
    final ZonedDateTime now = ZonedDateTime.now(snapshotClock);
    final ValueProperties surfaceProperties = ValueProperties.builder()
        .with(ValuePropertyNames.SURFACE, surfaceName)
        .with(InstrumentTypeProperties.PROPERTY_SURFACE_INSTRUMENT_TYPE, InstrumentTypeProperties.IR_FUTURE_OPTION)
        .with(SurfaceAndCubePropertyNames.PROPERTY_SURFACE_QUOTE_TYPE, surfaceQuoteType)
View Full Code Here

    _results = Collections.singleton(_result);
  }

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final Clock snapshotClock = executionContext.getValuationClock();
    final ZonedDateTime now = ZonedDateTime.now(snapshotClock);
    final Object volatilitySurfaceDataObject = inputs.getValue(_requirement);
    if (volatilitySurfaceDataObject == null) {
      throw new OpenGammaRuntimeException("Could not get " + _requirement);
    }
View Full Code Here

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final Position position = target.getPosition();
    final ConfigSource configSource = OpenGammaExecutionContext.getConfigSource(executionContext);
    final Clock snapshotClock = executionContext.getValuationClock();
    final LocalDate now = ZonedDateTime.now(snapshotClock).toLocalDate();
    final Currency currency = FinancialSecurityUtils.getCurrency(position.getSecurity());
    final String currencyString = currency.getCode();
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final ValueProperties constraints = desiredValue.getConstraints();
View Full Code Here

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target,
      final Set<ValueRequirement> desiredValues) throws AsynchronousExecution {
    final Position position = target.getPosition();
    final Clock snapshotClock = executionContext.getValuationClock();
    final LocalDate now = ZonedDateTime.now(snapshotClock).toLocalDate();
    final String currency = FinancialSecurityUtils.getCurrency(position.getSecurity()).getCode();
    final ValueRequirement desiredValue = Iterables.getOnlyElement(desiredValues);
    final ValueProperties constraints = desiredValue.getConstraints();
    final String desiredCurrency;
    final Set<String> desiredCurrencies = constraints.getValues(ValuePropertyNames.CURRENCY);
    if (desiredCurrencies != null && !desiredCurrencies.isEmpty()) {
      desiredCurrency = Iterables.getOnlyElement(desiredCurrencies);
    } else {
      desiredCurrency = currency;
    }
    final Period samplingPeriod = getSamplingPeriod(desiredValue.getConstraint(ValuePropertyNames.SAMPLING_PERIOD));
    final LocalDate startDate = now.minus(samplingPeriod);
    final Schedule scheduleCalculator = getScheduleCalculator(desiredValue.getConstraint(ValuePropertyNames.SCHEDULE_CALCULATOR));
    final TimeSeriesSamplingFunction samplingFunction = getSamplingFunction(desiredValue.getConstraint(ValuePropertyNames.SAMPLING_FUNCTION));
    final LocalDate[] schedule = HOLIDAY_REMOVER.getStrippedSchedule(scheduleCalculator.getSchedule(startDate, now, true, false), WEEKEND_CALENDAR);
    final ConfigSource configSource = OpenGammaExecutionContext.getConfigSource(executionContext);
    final CreditSecurityToIdentifierVisitor identifierVisitor = new CreditSecurityToIdentifierVisitor(OpenGammaExecutionContext.getSecuritySource(executionContext));
    final FinancialSecurity security = (FinancialSecurity) target.getPosition().getSecurity();
    final String spreadCurveName = security.accept(identifierVisitor).getUniqueId().getValue();
    //TODO
    final String curveName = getCurvePrefix() + "_" + spreadCurveName;
    final CurveSpecification curveSpecification = CurveUtils.getCurveSpecification(snapshotClock.instant(), configSource, now, curveName);
    DoubleTimeSeries<?> fxSeries = null;
    boolean isInverse = true;
    if (!desiredCurrency.equals(currency)) {
      final Object fxSeriesObject = inputs.getValue(ValueRequirementNames.HISTORICAL_FX_TIME_SERIES);
      if (fxSeriesObject == null) {
View Full Code Here

    _valueRequirementName = valueRequirementName;
  }

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final Clock snapshotClock = executionContext.getValuationClock();
    final ZonedDateTime now = ZonedDateTime.now(snapshotClock);
    final FinancialSecurity security = (FinancialSecurity) target.getSecurity();
    final Currency putCurrency = security.accept(ForexVisitors.getPutCurrencyVisitor());
    final Currency callCurrency = security.accept(ForexVisitors.getCallCurrencyVisitor());
    final ValueRequirement desiredValue = desiredValues.iterator().next();
View Full Code Here

        currency = newCurrency;
      }
    }
    final Position position = target.getPosition();
    final ComputationTargetSpecification positionSpec = target.toSpecification();
    final Clock snapshotClock = executionContext.getValuationClock();
    final LocalDate now = ZonedDateTime.now(snapshotClock).toLocalDate();
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final Set<String> samplingPeriodName = desiredValue.getConstraints().getValues(ValuePropertyNames.SAMPLING_PERIOD);
    final Set<String> scheduleCalculatorName = desiredValue.getConstraints().getValues(ValuePropertyNames.SCHEDULE_CALCULATOR);
    final Set<String> samplingFunctionName = desiredValue.getConstraints().getValues(ValuePropertyNames.SAMPLING_FUNCTION);
View Full Code Here

  @Override
  public Set<ComputedValue> execute(final FunctionExecutionContext executionContext, final FunctionInputs inputs, final ComputationTarget target, final Set<ValueRequirement> desiredValues) {
    final Position position = target.getPosition();
    final FXFutureSecurity security = (FXFutureSecurity) position.getSecurity();
    final Clock snapshotClock = executionContext.getValuationClock();
    final LocalDate now = ZonedDateTime.now(snapshotClock).toLocalDate();
    final ValueRequirement desiredValue = desiredValues.iterator().next();
    final Set<String> samplingPeriodName = desiredValue.getConstraints().getValues(ValuePropertyNames.SAMPLING_PERIOD);
    final Set<String> scheduleCalculatorName = desiredValue.getConstraints().getValues(ValuePropertyNames.SCHEDULE_CALCULATOR);
    final Set<String> samplingFunctionName = desiredValue.getConstraints().getValues(ValuePropertyNames.SAMPLING_FUNCTION);
View Full Code Here

TOP

Related Classes of org.threeten.bp.Clock

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.