热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

com.opengamma.strata.basics.date.AdjustableDate.of()方法的使用及代码示例

本文整理了Java中com.opengamma.strata.basics.date.AdjustableDate.of()方法的一些代码示例,展示了AdjustableDate.of()的具体用法。

本文整理了Java中com.opengamma.strata.basics.date.AdjustableDate.of()方法的一些代码示例,展示了AdjustableDate.of()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AdjustableDate.of()方法的具体详情如下:
包路径:com.opengamma.strata.basics.date.AdjustableDate
类名称:AdjustableDate
方法名:of

AdjustableDate.of介绍

[英]Obtains an instance with no business day adjustment.

This creates an adjustable date from the specified date. No business day adjustment applies, thus the result of #adjusted(ReferenceData)is the specified date.
[中]获取没有工作日调整的实例。
这将从指定日期创建一个可调整的日期。不适用营业日调整,因此#调整(参考数据)的结果为指定日期。

代码示例

代码示例来源:origin: OpenGamma/Strata

/**
* Obtains an instance representing an amount where the date is fixed.
*


* Whether the payment is pay or receive is determined by the sign of the specified amount.
*
* @param value the amount of the payment
* @param date the date that the payment is made
* @return the adjustable payment instance
*/
public static AdjustablePayment of(CurrencyAmount value, LocalDate date) {
return new AdjustablePayment(value, AdjustableDate.of(date));
}

代码示例来源:origin: OpenGamma/Strata

/**
* Calculates the applicable end date.
*


* The result combines the end date and the appropriate business day adjustment.
*
* @return the calculated end date
*/
public AdjustableDate calculatedEndDate() {
return AdjustableDate.of(endDate, calculatedEndDateBusinessDayAdjustment());
}

代码示例来源:origin: OpenGamma/Strata

@Override
public AdjustableDate getStartDate() {
return AdjustableDate.of(paymentPeriods.get(0).getStartDate());
}

代码示例来源:origin: OpenGamma/Strata

@Override
public AdjustableDate getEndDate() {
return AdjustableDate.of(paymentPeriods.get(paymentPeriods.size() - 1).getEndDate());
}

代码示例来源:origin: OpenGamma/Strata

public static MockSwapLeg of(
SwapLegType type,
PayReceive payReceive,
LocalDate startDate,
LocalDate endDate,
Currency currency) {
return new MockSwapLeg(type, payReceive, AdjustableDate.of(startDate), AdjustableDate.of(endDate), currency);
}

代码示例来源:origin: OpenGamma/Strata

/**
* Obtains an instance representing an amount to be paid where the date is fixed.
*


* The sign of the amount will be normalized to be negative, indicating a payment.
*
* @param value the amount of the payment
* @param date the date that the payment is made
* @return the adjustable payment instance
*/
public static AdjustablePayment ofPay(CurrencyAmount value, LocalDate date) {
return new AdjustablePayment(value.negative(), AdjustableDate.of(date));
}

代码示例来源:origin: OpenGamma/Strata

public void test_of_null() {
assertThrowsIllegalArg(() -> AdjustableDate.of(null));
assertThrowsIllegalArg(() -> AdjustableDate.of(null, BDA_FOLLOW_SAT_SUN));
assertThrowsIllegalArg(() -> AdjustableDate.of(FRI_2014_07_11, null));
assertThrowsIllegalArg(() -> AdjustableDate.of(null, null));
}

代码示例来源:origin: OpenGamma/Strata

@Test(dataProvider = "adjusted")
public void test_adjusted(LocalDate date, LocalDate expected) {
AdjustableDate test = AdjustableDate.of(date, BDA_FOLLOW_SAT_SUN);
assertEquals(test.adjusted(REF_DATA), expected);
}

代码示例来源:origin: OpenGamma/Strata

public void test_of_2args_withNoAdjustment() {
AdjustableDate test = AdjustableDate.of(FRI_2014_07_11, BDA_NONE);
assertEquals(test.getUnadjusted(), FRI_2014_07_11);
assertEquals(test.getAdjustment(), BDA_NONE);
assertEquals(test.toString(), "2014-07-11");
assertEquals(test.adjusted(REF_DATA), FRI_2014_07_11);
}

代码示例来源:origin: OpenGamma/Strata

public void formatForCsv() {
AdjustableDate date = AdjustableDate.of(date(2016, 6, 30), BusinessDayAdjustment.of(MODIFIED_FOLLOWING, SAT_SUN));
assertThat(AdjustableDateValueFormatter.INSTANCE.formatForCsv(date)).isEqualTo("2016-06-30");
}
}

代码示例来源:origin: OpenGamma/Strata

public void test_of_1arg() {
AdjustableDate test = AdjustableDate.of(FRI_2014_07_11);
assertEquals(test.getUnadjusted(), FRI_2014_07_11);
assertEquals(test.getAdjustment(), BDA_NONE);
assertEquals(test.toString(), "2014-07-11");
assertEquals(test.adjusted(REF_DATA), FRI_2014_07_11);
}

代码示例来源:origin: OpenGamma/Strata

public void test_of_2args_withAdjustment() {
AdjustableDate test = AdjustableDate.of(FRI_2014_07_11, BDA_FOLLOW_SAT_SUN);
assertEquals(test.getUnadjusted(), FRI_2014_07_11);
assertEquals(test.getAdjustment(), BDA_FOLLOW_SAT_SUN);
assertEquals(test.toString(), "2014-07-11 adjusted by Following using calendar Sat/Sun");
assertEquals(test.adjusted(REF_DATA), FRI_2014_07_11);
}

代码示例来源:origin: OpenGamma/Strata

public void test_getEndDate() {
SwapLeg leg1 = MockSwapLeg.of(FIXED, PAY, date(2015, 6, 29), date(2017, 6, 30), Currency.USD);
SwapLeg leg2 = MockSwapLeg.of(FIXED, RECEIVE, date(2015, 6, 30), date(2017, 6, 29), Currency.USD);
assertEquals(Swap.of(leg1).getEndDate(), AdjustableDate.of(date(2017, 6, 30)));
assertEquals(Swap.of(leg2).getEndDate(), AdjustableDate.of(date(2017, 6, 29)));
assertEquals(Swap.of(leg1, leg2).getEndDate(), AdjustableDate.of(date(2017, 6, 30)));
assertEquals(Swap.of(leg2, leg1).getEndDate(), AdjustableDate.of(date(2017, 6, 30)));
}

代码示例来源:origin: OpenGamma/Strata

static Swaption sut2() {
return Swaption.builder()
.expiryDate(AdjustableDate.of(LocalDate.of(2014, 6, 10), ADJUSTMENT))
.expiryTime(LocalTime.of(14, 0))
.expiryZone(ZoneId.of("GMT"))
.longShort(SHORT)
.swaptionSettlement(CASH_SETTLE)
.underlying(FixedIborSwapConventions.USD_FIXED_6M_LIBOR_3M
.createTrade(LocalDate.of(2014, 6, 10), Tenor.TENOR_10Y, BuySell.BUY, 1d, FIXED_RATE, REF_DATA).getProduct())
.build();
}

代码示例来源:origin: OpenGamma/Strata

public void test_resolve_pay() {
BulletPayment test = BulletPayment.builder()
.payReceive(PayReceive.PAY)
.value(GBP_P1000)
.date(AdjustableDate.of(DATE_2015_06_30))
.build();
ResolvedBulletPayment expected = ResolvedBulletPayment.of(Payment.of(GBP_M1000, DATE_2015_06_30));
assertEquals(test.resolve(REF_DATA), expected);
}

代码示例来源:origin: OpenGamma/Strata

public void test_resolve_receive() {
BulletPayment test = BulletPayment.builder()
.payReceive(PayReceive.RECEIVE)
.value(GBP_P1000)
.date(AdjustableDate.of(DATE_2015_06_30))
.build();
ResolvedBulletPayment expected = ResolvedBulletPayment.of(Payment.of(GBP_P1000, DATE_2015_06_30));
assertEquals(test.resolve(REF_DATA), expected);
}

代码示例来源:origin: OpenGamma/Strata

public void test_serialization() {
BulletPayment test = BulletPayment.builder()
.payReceive(PayReceive.PAY)
.value(GBP_P1000)
.date(AdjustableDate.of(DATE_2015_06_30))
.build();
assertSerialization(test);
}

代码示例来源:origin: OpenGamma/Strata

public void test_builder_expiryAfterStart() {
assertThrowsIllegalArg(() -> Swaption.builder()
.expiryDate(AdjustableDate.of(LocalDate.of(2014, 6, 17), ADJUSTMENT))
.expiryTime(EXPIRY_TIME)
.expiryZone(ZONE)
.longShort(LONG)
.swaptionSettlement(PHYSICAL_SETTLE)
.underlying(SWAP)
.build());
}

代码示例来源:origin: OpenGamma/Strata

public void test_physicalSettlement() {
Swaption swaption = Swaption
.builder()
.expiryDate(AdjustableDate.of(MATURITY, BDA_MF))
.expiryTime(LocalTime.NOON)
.expiryZone(ZoneOffset.UTC)
.swaptionSettlement(PhysicalSwaptionSettlement.DEFAULT)
.longShort(LONG)
.underlying(SWAP_PAY)
.build();
assertThrowsIllegalArg(() -> PRICER.impliedVolatility(swaption.resolve(REF_DATA), RATE_PROVIDER, VOLS));
}

代码示例来源:origin: OpenGamma/Strata

public void test_physicalSettlement() {
Swaption swaption = Swaption.builder()
.swaptionSettlement(PhysicalSwaptionSettlement.DEFAULT)
.expiryDate(AdjustableDate.of(SWAPTION_EXERCISE_DATE))
.expiryTime(SWAPTION_EXPIRY_TIME)
.expiryZone(SWAPTION_EXPIRY_ZONE)
.longShort(LongShort.LONG)
.underlying(SWAP_REC)
.build();
assertThrowsIllegalArg(() -> PRICER_SWAPTION.presentValue(swaption.resolve(REF_DATA), RATE_PROVIDER, VOLS));
}

推荐阅读
  • 向QTextEdit拖放文件的方法及实现步骤
    本文介绍了在使用QTextEdit时如何实现拖放文件的功能,包括相关的方法和实现步骤。通过重写dragEnterEvent和dropEvent函数,并结合QMimeData和QUrl等类,可以轻松实现向QTextEdit拖放文件的功能。详细的代码实现和说明可以参考本文提供的示例代码。 ... [详细]
  • Java太阳系小游戏分析和源码详解
    本文介绍了一个基于Java的太阳系小游戏的分析和源码详解。通过对面向对象的知识的学习和实践,作者实现了太阳系各行星绕太阳转的效果。文章详细介绍了游戏的设计思路和源码结构,包括工具类、常量、图片加载、面板等。通过这个小游戏的制作,读者可以巩固和应用所学的知识,如类的继承、方法的重载与重写、多态和封装等。 ... [详细]
  • Iamtryingtomakeaclassthatwillreadatextfileofnamesintoanarray,thenreturnthatarra ... [详细]
  • 在Android开发中,使用Picasso库可以实现对网络图片的等比例缩放。本文介绍了使用Picasso库进行图片缩放的方法,并提供了具体的代码实现。通过获取图片的宽高,计算目标宽度和高度,并创建新图实现等比例缩放。 ... [详细]
  • Spring源码解密之默认标签的解析方式分析
    本文分析了Spring源码解密中默认标签的解析方式。通过对命名空间的判断,区分默认命名空间和自定义命名空间,并采用不同的解析方式。其中,bean标签的解析最为复杂和重要。 ... [详细]
  • Spring特性实现接口多类的动态调用详解
    本文详细介绍了如何使用Spring特性实现接口多类的动态调用。通过对Spring IoC容器的基础类BeanFactory和ApplicationContext的介绍,以及getBeansOfType方法的应用,解决了在实际工作中遇到的接口及多个实现类的问题。同时,文章还提到了SPI使用的不便之处,并介绍了借助ApplicationContext实现需求的方法。阅读本文,你将了解到Spring特性的实现原理和实际应用方式。 ... [详细]
  • 本文讨论了一个关于cuowu类的问题,作者在使用cuowu类时遇到了错误提示和使用AdjustmentListener的问题。文章提供了16个解决方案,并给出了两个可能导致错误的原因。 ... [详细]
  • Python正则表达式学习记录及常用方法
    本文记录了学习Python正则表达式的过程,介绍了re模块的常用方法re.search,并解释了rawstring的作用。正则表达式是一种方便检查字符串匹配模式的工具,通过本文的学习可以掌握Python中使用正则表达式的基本方法。 ... [详细]
  • Java容器中的compareto方法排序原理解析
    本文从源码解析Java容器中的compareto方法的排序原理,讲解了在使用数组存储数据时的限制以及存储效率的问题。同时提到了Redis的五大数据结构和list、set等知识点,回忆了作者大学时代的Java学习经历。文章以作者做的思维导图作为目录,展示了整个讲解过程。 ... [详细]
  • 阿,里,云,物,联网,net,core,客户端,czgl,aliiotclient, ... [详细]
  • 本文主要解析了Open judge C16H问题中涉及到的Magical Balls的快速幂和逆元算法,并给出了问题的解析和解决方法。详细介绍了问题的背景和规则,并给出了相应的算法解析和实现步骤。通过本文的解析,读者可以更好地理解和解决Open judge C16H问题中的Magical Balls部分。 ... [详细]
  • JavaSE笔试题-接口、抽象类、多态等问题解答
    本文解答了JavaSE笔试题中关于接口、抽象类、多态等问题。包括Math类的取整数方法、接口是否可继承、抽象类是否可实现接口、抽象类是否可继承具体类、抽象类中是否可以有静态main方法等问题。同时介绍了面向对象的特征,以及Java中实现多态的机制。 ... [详细]
  • 本文介绍了Java高并发程序设计中线程安全的概念与synchronized关键字的使用。通过一个计数器的例子,演示了多线程同时对变量进行累加操作时可能出现的问题。最终值会小于预期的原因是因为两个线程同时对变量进行写入时,其中一个线程的结果会覆盖另一个线程的结果。为了解决这个问题,可以使用synchronized关键字来保证线程安全。 ... [详细]
  • 在重复造轮子的情况下用ProxyServlet反向代理来减少工作量
    像不少公司内部不同团队都会自己研发自己工具产品,当各个产品逐渐成熟,到达了一定的发展瓶颈,同时每个产品都有着自己的入口,用户 ... [详细]
  • 自动轮播,反转播放的ViewPagerAdapter的使用方法和效果展示
    本文介绍了如何使用自动轮播、反转播放的ViewPagerAdapter,并展示了其效果。该ViewPagerAdapter支持无限循环、触摸暂停、切换缩放等功能。同时提供了使用GIF.gif的示例和github地址。通过LoopFragmentPagerAdapter类的getActualCount、getActualItem和getActualPagerTitle方法可以实现自定义的循环效果和标题展示。 ... [详细]
author-avatar
沈婧颖_491
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有