本文整理汇总了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);
}
示例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);
}
示例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());
}
示例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());
}
示例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());
}