Tabnine Logo
AdjustableDate.of
Code IndexAdd Tabnine to your IDE (free)

How to use
of
method
in
com.opengamma.strata.basics.date.AdjustableDate

Best Java code snippets using com.opengamma.strata.basics.date.AdjustableDate.of (Showing top 20 results out of 315)

origin: OpenGamma/Strata

/**
 * Obtains an instance representing an amount where the date is fixed.
 * <p>
 * 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.
 * <p>
 * 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.
 * <p>
 * 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));
}
com.opengamma.strata.basics.dateAdjustableDateof

Javadoc

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.

Popular methods of AdjustableDate

  • getUnadjusted
    Gets the unadjusted date. This date may be a non-business day. The business day adjustment is used t
  • adjusted
    Adjusts the date using the business day adjustment. This returns the adjusted date, calculated by ap
  • getAdjustment
    Gets the business day adjustment that is to be applied to the unadjusted date. This is used to adju
  • <init>
  • equals
  • toString
    Returns a string describing the adjustable date.

Popular in Java

  • Updating database using SQL prepared statement
  • addToBackStack (FragmentTransaction)
  • startActivity (Activity)
  • requestLocationUpdates (LocationManager)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • ServletException (javax.servlet)
    Defines a general exception a servlet can throw when it encounters difficulty.
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now