当前位置: 首页>>代码示例>>Java>>正文


Java ZonedDateTime.getZone方法代码示例

本文整理汇总了Java中org.threeten.bp.ZonedDateTime.getZone方法的典型用法代码示例。如果您正苦于以下问题:Java ZonedDateTime.getZone方法的具体用法?Java ZonedDateTime.getZone怎么用?Java ZonedDateTime.getZone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.threeten.bp.ZonedDateTime的用法示例。


在下文中一共展示了ZonedDateTime.getZone方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFederalFundsFuture

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
/**
 * Creates a Federal fund future from a rate future node.
 * @param rateFuture The rate future node
 * @param futureConvention The future convention
 * @param price The price
 * @return The Fed fund future
 */
private InstrumentDefinition<?> getFederalFundsFuture(RateFutureNode rateFuture, FederalFundsFutureConvention futureConvention,
    Double price) {
  String expiryCalculatorName = futureConvention.getExpiryConvention().getValue();
  OvernightIndex index =
      SecurityLink.resolvable(futureConvention.getIndexConvention(), OvernightIndex.class).resolve();

  OvernightIndexConvention indexConvention =
      ConventionLink.resolvable(index.getConventionId(), OvernightIndexConvention.class).resolve();

  IndexON indexON = ConverterUtils.indexON(index.getName(), indexConvention);
  double paymentAccrualFactor = 1 / 12.;
  Calendar calendar = CalendarUtils.getCalendar(_regionSource, _holidaySource, indexConvention.getRegionCalendar());
  ExchangeTradedInstrumentExpiryCalculator expiryCalculator =
      ExchangeTradedInstrumentExpiryCalculatorFactory.getCalculator(expiryCalculatorName);
  ZonedDateTime startDate = _valuationTime.plus(rateFuture.getStartTenor().getPeriod());
  LocalTime time = startDate.toLocalTime();
  ZoneId timeZone = startDate.getZone();
  ZonedDateTime expiryDate = ZonedDateTime.of(
      expiryCalculator.getExpiryDate(rateFuture.getFutureNumber(), startDate.toLocalDate(), calendar), time, timeZone);
  FederalFundsFutureSecurityDefinition securityDefinition =
      FederalFundsFutureSecurityDefinition.from(expiryDate, indexON, 1, paymentAccrualFactor, "", calendar);
  return new FederalFundsFutureTransactionDefinition(securityDefinition, 1, _valuationTime, price);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:31,代码来源:RateFutureNodeConverter.java

示例2: visitDeliverableSwapFutureNode

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
@Override
  public InstrumentDefinition<?> visitDeliverableSwapFutureNode(DeliverableSwapFutureNode swapFuture) {
    Double price = _marketData.getDataPoint(_dataId);
    if (price == null) {
      price = 0.99;
//      throw new OpenGammaRuntimeException("Could not get market data for " + _dataId);
    }
    DeliverablePriceQuotedSwapFutureConvention futureConvention =
        ConventionLink.resolvable(swapFuture.getFutureConvention(), DeliverablePriceQuotedSwapFutureConvention.class)
            .resolve();
    SwapConvention underlyingSwapConvention =
        ConventionLink.resolvable(swapFuture.getSwapConvention(), SwapConvention.class).resolve();
    Tenor maturityTenor = swapFuture.getUnderlyingTenor();
    SwapFixedLegConvention fixedLegConvention =
        ConventionLink.resolvable(underlyingSwapConvention.getPayLegConvention(), SwapFixedLegConvention.class)
            .resolve();
    VanillaIborLegConvention iborLegConvention =
        ConventionLink.resolvable(underlyingSwapConvention.getReceiveLegConvention(), VanillaIborLegConvention.class)
            .resolve();

    String expiryCalculatorName = futureConvention.getExpiryConvention().getValue();
    ZonedDateTime startDate = _valuationTime.plus(swapFuture.getStartTenor().getPeriod());
    Calendar calendar =
        CalendarUtils.getCalendar(_regionSource, _holidaySource, futureConvention.getExchangeCalendar());
    ExchangeTradedInstrumentExpiryCalculator expiryCalculator =
        ExchangeTradedInstrumentExpiryCalculatorFactory.getCalculator(expiryCalculatorName);
    LocalTime time = startDate.toLocalTime();
    ZoneId timeZone = startDate.getZone();
    double notional = 1.0;
    int spotLagSwap = fixedLegConvention.getSettlementDays();
    ZonedDateTime lastTradeDate = ZonedDateTime.of(expiryCalculator.getExpiryDate(
        swapFuture.getFutureNumber(), startDate.toLocalDate(), calendar), time, timeZone);
    ZonedDateTime deliveryDate = ScheduleCalculator.getAdjustedDate(lastTradeDate, spotLagSwap, calendar);
    IborIndexConvention indexConvention =
        ConventionLink.resolvable(iborLegConvention.getIborIndexConvention(), IborIndexConvention.class).resolve();
    Currency currency = indexConvention.getCurrency();
    DayCount dayCount = indexConvention.getDayCount();
    BusinessDayConvention businessDayConvention = indexConvention.getBusinessDayConvention();
    boolean eom = indexConvention.isIsEOM();
    Period indexTenor = iborLegConvention.getResetTenor().getPeriod();
    int spotLagIndex = indexConvention.getSettlementDays();
    IborIndex iborIndex =
        new IborIndex(currency, indexTenor, spotLagIndex, dayCount,
                      businessDayConvention, eom, indexConvention.getName());
    GeneratorSwapFixedIbor generator = new GeneratorSwapFixedIbor(
        "", fixedLegConvention.getPaymentTenor().getPeriod(), fixedLegConvention.getDayCount(), iborIndex, calendar);
    SwapFixedIborDefinition underlying = SwapFixedIborDefinition.from(
        deliveryDate, maturityTenor.getPeriod(), generator, notional, 0.0, false); //FIXME: rate of underlying?
    SwapFuturesPriceDeliverableSecurityDefinition securityDefinition =
        new SwapFuturesPriceDeliverableSecurityDefinition(lastTradeDate, underlying, notional);
    return new SwapFuturesPriceDeliverableTransactionDefinition(securityDefinition, 1, _valuationTime, price);
  }
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:53,代码来源:DeliverableSwapFutureNodeConverter.java

示例3: of

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
/**
 * Obtains a time-series from a single instant and value.
 * 
 * @param instant  the singleton instant, not null
 * @param value  the singleton value
 * @return the time-series, not null
 */
public static ImmutableZonedDateTimeDoubleTimeSeries of(ZonedDateTime instant, double value) {
  Objects.requireNonNull(instant, "instant");
  long[] timesArray = new long[] {ZonedDateTimeToLongConverter.convertToLong(instant)};
  double[] valuesArray = new double[] {value};
  return new ImmutableZonedDateTimeDoubleTimeSeries(timesArray, valuesArray, instant.getZone());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:14,代码来源:ImmutableZonedDateTimeDoubleTimeSeries.java

示例4: of

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
/**
 * Obtains a time-series from a single instant and value.
 * 
 * @param <V>  the value being viewed over time
 * @param instant  the singleton instant, not null
 * @param value  the singleton value
 * @return the time-series, not null
 */
public static <V> ImmutableZonedDateTimeObjectTimeSeries<V> of(ZonedDateTime instant, V value) {
  Objects.requireNonNull(instant, "instant");
  long[] timesArray = new long[] {ZonedDateTimeToLongConverter.convertToLong(instant)};
  @SuppressWarnings("unchecked")
  V[] valuesArray = (V[]) new Object[] {value};
  return new ImmutableZonedDateTimeObjectTimeSeries<V>(timesArray, valuesArray, instant.getZone());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:16,代码来源:ImmutableZonedDateTimeObjectTimeSeries.java

示例5: of

import org.threeten.bp.ZonedDateTime; //导入方法依赖的package包/类
/**
 * Obtains a flexi date-time, specifying the zoned date-time.
 * <p>
 * This factory is strict and requires the date-time.
 * 
 * @param dateTime  the date-time, not null
 * @return the date-time, not null
 */
public static FlexiDateTime of(ZonedDateTime dateTime) {
  ArgumentChecker.notNull(dateTime, "dateTime");
  return new FlexiDateTime(dateTime.toLocalDate(), dateTime.toLocalTime(), dateTime.getZone());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:13,代码来源:FlexiDateTime.java


注:本文中的org.threeten.bp.ZonedDateTime.getZone方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。