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


Java OffsetTime.now方法代码示例

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


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

示例1: multipleInstancesOfSamePosition

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
@Test(enabled = false)
public void multipleInstancesOfSamePosition() {
  SimplePortfolio portfolio = new SimplePortfolio(id("portfolio"), "portfolio");
  SimplePortfolioNode root = new SimplePortfolioNode(id("root"), "root");
  SimplePortfolioNode node1 = new SimplePortfolioNode(id("node1"), "node1");
  SimplePortfolioNode node2 = new SimplePortfolioNode(id("node2"), "node2");
  ExternalId securityId = ExternalId.of("sec", "123");
  SimplePosition position = new SimplePosition(id("position"), BigDecimal.ONE, securityId);
  SimpleCounterparty counterparty = new SimpleCounterparty(ExternalId.of("cpty", "123"));
  SimpleSecurityLink securityLink = new SimpleSecurityLink(securityId);
  Trade trade = new SimpleTrade(securityLink, BigDecimal.ONE, counterparty, LocalDate.now(), OffsetTime.now());
  position.addTrade(trade);
  portfolio.setRootNode(root);
  node1.addPosition(position);
  node2.addPosition(position);
  root.addChildNode(node1);
  root.addChildNode(node2);

  CounterpartyAggregationFunction fn = new CounterpartyAggregationFunction();
  Portfolio aggregate = new PortfolioAggregator(fn).aggregate(portfolio);
  PortfolioNode aggregateRoot = aggregate.getRootNode();
  assertEquals(1, aggregateRoot.getChildNodes().size());
  PortfolioNode node = aggregateRoot.getChildNodes().get(0);
  assertEquals(1, node.getPositions().size());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:26,代码来源:PortfolioAggregatorTest.java

示例2: testMultipleCurveConfigs

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
@Test
public void testMultipleCurveConfigs() {
  ConfigMaster configMaster = new InMemoryConfigMaster();
  ConfigSource configSource = new MasterConfigSource(configMaster);
  SecuritySource securitySource = new MasterSecuritySource(new InMemorySecurityMaster());

  FRASecurity security = ExposureFunctionTestHelper.getFRASecurity();
  
  String name = "test";
  List<String> exposureFunctions = Lists.newArrayList(SecurityTypeExposureFunction.NAME, CurrencyExposureFunction.NAME);
  Map<ExternalId, String> idsToNames = new HashMap<>();
  String securityTypeCurveConfig = "SecurityTypeConfig";
  idsToNames.put(ExternalId.of(ExposureFunction.SECURITY_IDENTIFIER, security.getSecurityType()), securityTypeCurveConfig);
  String currencyCurveConfig = "CurrencyConfig";
  idsToNames.put(ExternalId.of(Currency.OBJECT_SCHEME, security.getCurrency().getCode()), currencyCurveConfig);
  ExposureFunctions exposures = new ExposureFunctions(name, exposureFunctions, idsToNames);
  ConfigMasterUtils.storeByName(configMaster, ConfigItem.of(exposures));
  
  ConfigDBInstrumentExposuresProvider provider = new ConfigDBInstrumentExposuresProvider(configSource, securitySource, VersionCorrection.LATEST);
  
  Trade trade = new SimpleTrade(security, BigDecimal.ONE, new SimpleCounterparty(ExternalId.of(Counterparty.DEFAULT_SCHEME, "TEST")), LocalDate.now(), OffsetTime.now());
  Set<String> curveConfigs = provider.getCurveConstructionConfigurationsForConfig(name, trade);
  assertEquals("Expected single curve config", 1, curveConfigs.size());
  assertTrue("Expected configs to contain security type config", curveConfigs.contains(securityTypeCurveConfig));
  assertFalse("Expected configs to not contain currency config", curveConfigs.contains(currencyCurveConfig));
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:27,代码来源:ConfigDBInstrumentExposuresProviderTest.java

示例3: currencyUsdExposureViaSecurityPass

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
@Test
public void currencyUsdExposureViaSecurityPass() {

  FunctionModelConfig config = createFunctionModelConfig(InterestRateMockSources.mockCurrencyExposureFunctions());

  ExposureFunctionsDiscountingMulticurveCombinerFn multicurveCombinerFunction =
      FunctionModel.build(
          ExposureFunctionsDiscountingMulticurveCombinerFn.class,
          config,
          ComponentMap.of(_components));

  FRASecurity security = createSingleFra(Currency.USD);

  Trade trade = new SimpleTrade(security,
                                BigDecimal.ONE,
                                new SimpleCounterparty(ExternalId.of(Counterparty.DEFAULT_SCHEME, "CPARTY")),
                                LocalDate.now(),
                                OffsetTime.now());
  FraTrade tradeWrapper = new FraTrade(trade);

  Result<MulticurveBundle> result = multicurveCombinerFunction.getMulticurveBundle(_environment, tradeWrapper);

  assertThat(result.isSuccess(), is((true)));

  MulticurveProviderDiscount multicurveProviderDiscount = result.getValue().getMulticurveProvider();

  assertThat(multicurveProviderDiscount.getAllCurveNames(),
             containsInAnyOrder(
                 InterestRateMockSources.USD_LIBOR3M_CURVE_NAME,
                 InterestRateMockSources.USD_OIS_CURVE_NAME));
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:32,代码来源:ExposureFunctionTest.java

示例4: testEmptyCurveConfigs

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
@Test
public void testEmptyCurveConfigs() {

  ConfigMaster configMaster = new InMemoryConfigMaster();
  SecuritySource securitySource = new MasterSecuritySource(new InMemorySecurityMaster());

  String name = "test";
  List<String> exposureFunctions = Lists.newArrayList(CurrencyExposureFunction.NAME);
  Map<ExternalId, String> idsToNames = Maps.newHashMap();
  ExposureFunctions exposures = new ExposureFunctions(name, exposureFunctions, idsToNames);
  ConfigMasterUtils.storeByName(configMaster, ConfigItem.of(exposures));
  
  MarketExposureSelector selector = new MarketExposureSelector(exposures, securitySource);

  FRASecurity security = getFRASecurity();
  Trade trade = new SimpleTrade(security,
                                BigDecimal.ONE,
                                new SimpleCounterparty(ExternalId.of(Counterparty.DEFAULT_SCHEME, "TEST")),
                                LocalDate.now(),
                                OffsetTime.now());
  
  Set<CurveConstructionConfiguration> configs = selector.determineCurveConfigurations(trade);
  assertTrue("Expected curve configs to be empty", configs.isEmpty());
  
  configs = selector.findCurveConfigurationsForSecurity(security);
  assertTrue("Expected curve configs to be empty", configs.isEmpty());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:28,代码来源:MarketExposureSelectorTest.java

示例5: createPosition

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
private ManageablePosition createPosition(ManageableSecurity security, boolean includeTrade) {
  ManageablePosition position = new ManageablePosition(BigDecimal.ONE, security.getExternalIdBundle());
  if (includeTrade) {
    ManageableTrade trade = new ManageableTrade(BigDecimal.ONE, security.getExternalIdBundle(), LocalDate.now().minusDays(3), OffsetTime.now(), ExternalId.of("Cpty", "GOLDMAN"));
    position.addTrade(trade);
  }
  return position;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:9,代码来源:PortfolioZipFormatExamplesGenerator.java

示例6: createTrade

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
private ManageableTrade createTrade(final ManageableSecurity security) {
  final ManageableTrade trade = new ManageableTrade(BigDecimal.ONE, getBundle(security), LocalDate.now(), OffsetTime.now(), ExternalId.of(
      "counterparty", "Foo"));
  if (BondFutureOptionSecurity.SECURITY_TYPE.equals(security.getSecurityType())) {
    trade.setPremium(-100d);
  } else if (IRFutureOptionSecurity.SECURITY_TYPE.equals(security.getSecurityType())) {
    trade.setPremium(100d);
  }
  return trade;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:11,代码来源:BloombergReferencePortfolioMaker.java

示例7: createFxForwardPosition

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
private Position createFxForwardPosition() {
  ExternalId externalId = ExternalId.parse("a~1");
  FXForwardSecurity security = new FXForwardSecurity(Currency.EUR, 1, Currency.USD, 1, ZonedDateTime.now(), externalId);
  security.setName("An FX Forward");
  SimplePosition position = new SimplePosition(BigDecimal.ONE, security.getExternalIdBundle());
  position.setUniqueId(UniqueId.parse(_id1));
  SimpleCounterparty counterparty = new SimpleCounterparty(ExternalId.parse("a~b"));
  SimpleTrade trade = new SimpleTrade(security, BigDecimal.ONE, counterparty, LocalDate.now(), OffsetTime.now());
  SimpleSecurityLink securityLink = new SimpleSecurityLink();
  securityLink.setTarget(security);
  position.setSecurityLink(securityLink);
  position.addTrade(trade);
  return position;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:15,代码来源:ScenarioResultsWriterTest.java

示例8: createFraPosition

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
private Position createFraPosition() {
  ZonedDateTime now = ZonedDateTime.now();
  FRASecurity security = new FRASecurity(Currency.GBP, ExternalId.parse("b~2"), now, now, 1, 1, ExternalId.parse("c~3"), now);
  security.setName("A FRA");
  SimplePosition position = new SimplePosition(BigDecimal.ONE, security.getExternalIdBundle());
  position.setUniqueId(UniqueId.parse(_id2));
  SimpleCounterparty counterparty = new SimpleCounterparty(ExternalId.parse("a~b"));
  SimpleTrade trade = new SimpleTrade(security, BigDecimal.ONE, counterparty, LocalDate.now(), OffsetTime.now());
  SimpleSecurityLink securityLink = new SimpleSecurityLink();
  securityLink.setTarget(security);
  position.setSecurityLink(securityLink);
  position.addTrade(trade);
  return position;
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:15,代码来源:ScenarioResultsWriterTest.java

示例9: wrapInTrade

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
private InterestRateSwapTrade wrapInTrade(InterestRateSwapSecurity security) {
  Trade trade = new SimpleTrade(security,
                                BigDecimal.ONE,
                                new SimpleCounterparty(ExternalId.of(Counterparty.DEFAULT_SCHEME, "CPARTY")),
                                LocalDate.now(),
                                OffsetTime.now());
  return new InterestRateSwapTrade(trade);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:9,代码来源:SwapPricingTest.java

示例10: getPremiumTime

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
public void getPremiumTime() {
  final Trade trade = Mockito.mock(Trade.class);
  final ResolutionLogger logger = Mockito.mock(ResolutionLogger.class);
  final Trade logged = new LoggedResolutionTrade(trade, logger);
  final OffsetTime result = OffsetTime.now();
  Mockito.when(trade.getPremiumTime()).thenReturn(result);
  assertSame(logged.getPremiumTime(), result);
  Mockito.verifyZeroInteractions(logger);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:10,代码来源:LoggedResolutionTradeTest.java

示例11: createCalculator

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
@Override
public Result<SwaptionCalculator> createCalculator(Environment env,
                                                   SwaptionSecurity security) {

  Trade trade = new SimpleTrade(security,
                                BigDecimal.ONE,
                                new SimpleCounterparty(ExternalId.of(Counterparty.DEFAULT_SCHEME, "CPARTY")),
                                LocalDate.now(),
                                OffsetTime.now());
  SwaptionTrade tradeWrapper = new SwaptionTrade(trade);

  Result<MulticurveBundle> bundleResult = _discountingMulticurveCombinerFn.getMulticurveBundle(env, tradeWrapper);

  Result<HistoricalTimeSeriesBundle> fixingsResult = _fixingsFn.getFixingsForSecurity(env, security);

  Result<SabrParametersConfiguration> sabrResult = _sabrParametersProviderFn.getSabrParameters(env, security);

  if (Result.allSuccessful(bundleResult, fixingsResult, sabrResult)) {

    MulticurveProviderDiscount multicurveBundle = bundleResult.getValue().getMulticurveProvider();
    CurveBuildingBlockBundle blockBundle = bundleResult.getValue().getCurveBuildingBlockBundle();
    SwaptionPhysicalFixedIbor swaption =
        createInstrumentDerivative(security, env.getValuationTime(), fixingsResult.getValue());
    SabrParametersConfiguration sabrConfig = sabrResult.getValue();

    SwaptionCalculator calculator =
        new SabrSwaptionCalculator(swaption, buildSabrBundle(multicurveBundle, sabrConfig), blockBundle, sabrConfig.getSabrParameters());

    return Result.success(calculator);
  } else {
    return Result.failure(bundleResult, fixingsResult, sabrResult);
  }
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:34,代码来源:SabrSwaptionCalculatorFactory.java

示例12: createCalculator

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
@Override
public Result<FRACalculator> createCalculator(Environment env, FRASecurity security) {

  Trade trade = new SimpleTrade(security,
                                BigDecimal.ONE,
                                new SimpleCounterparty(ExternalId.of(Counterparty.DEFAULT_SCHEME, "CPARTY")),
                                LocalDate.now(),
                                OffsetTime.now());
  FraTrade tradeWrapper = new FraTrade(trade);

  Result<MulticurveBundle> bundleResult = _discountingMulticurveCombinerFn.getMulticurveBundle(env, tradeWrapper);

  if (bundleResult.isSuccess()) {

    Set<String> curveNames = bundleResult.getValue().getCurveBuildingBlockBundle().getData().keySet();
    Result<Map<String, CurveMatrixLabeller>> curveLabellers =
        _curveLabellingFn.getCurveLabellers(curveNames);

    if (curveLabellers.isSuccess()) {
      FRACalculator calculator = new DiscountingFRACalculator(security,
          bundleResult.getValue().getMulticurveProvider(),
          _fraConverter,
          env.getValuationTime(),
          bundleResult.getValue().getCurveBuildingBlockBundle(),
          curveLabellers.getValue());
      return Result.success(calculator);
    } else {
      return Result.failure(curveLabellers);
    }
  } else {
    return Result.failure(bundleResult);
  }
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:34,代码来源:DiscountingFRACalculatorFactory.java

示例13: buildTrade

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
private Trade buildTrade(Security security) {
  return new SimpleTrade(security,
      BigDecimal.ONE,
      new SimpleCounterparty(ExternalId.of(Counterparty.DEFAULT_SCHEME, "CPARTY")),
      LocalDate.now(),
      OffsetTime.now());
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:8,代码来源:AbstractCreditRiskMeasureFn.java

示例14: createBundle

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
private Result<MulticurveBundle> createBundle(Environment env, FXForwardSecurity security) {
  Trade trade = new SimpleTrade(security,
                                BigDecimal.ONE,
                                new SimpleCounterparty(ExternalId.of(Counterparty.DEFAULT_SCHEME, "CPARTY")),
                                LocalDate.now(),
                                OffsetTime.now());
  FXForwardTrade tradeWrapper = new FXForwardTrade(trade);
  return _discountingMulticurveCombinerFn.getMulticurveBundle(env, tradeWrapper);
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:10,代码来源:FXForwardDiscountingCalculatorFn.java

示例15: createCalculator

import org.threeten.bp.OffsetTime; //导入方法依赖的package包/类
@Override
public Result<InterestRateSwapCalculator> createCalculator(Environment env, InterestRateSwapSecurity security) {

  Trade trade = new SimpleTrade(security,
                                BigDecimal.ONE,
                                new SimpleCounterparty(ExternalId.of(Counterparty.DEFAULT_SCHEME, "CPARTY")),
                                LocalDate.now(),
                                OffsetTime.now());
  InterestRateSwapTrade tradeWrapper = new InterestRateSwapTrade(trade);
  return createCalculator(env, tradeWrapper);

}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:13,代码来源:DiscountingInterestRateSwapCalculatorFactory.java


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