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

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

Best Java code snippets using com.opengamma.strata.basics.date.AdjustableDate (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

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

@Override
public AdjustableDate build() {
 return new AdjustableDate(
   unadjusted,
   adjustment);
}
origin: OpenGamma/Strata

@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
 switch (propertyName.hashCode()) {
  case 482476551:  // unadjusted
   return ((AdjustableDate) bean).getUnadjusted();
  case 1977085293:  // adjustment
   return ((AdjustableDate) bean).getAdjustment();
 }
 return super.propertyGet(bean, propertyName, quiet);
}
origin: OpenGamma/Strata

public void equals() {
 AdjustableDate a1 = AdjustableDate.of(FRI_2014_07_11, BDA_FOLLOW_SAT_SUN);
 AdjustableDate a2 = AdjustableDate.of(FRI_2014_07_11, BDA_FOLLOW_SAT_SUN);
 AdjustableDate b = AdjustableDate.of(SAT_2014_07_12, BDA_FOLLOW_SAT_SUN);
 AdjustableDate c = AdjustableDate.of(FRI_2014_07_11, BDA_NONE);
 assertEquals(a1.equals(a2), true);
 assertEquals(a1.equals(b), false);
 assertEquals(a1.equals(c), false);
}
origin: OpenGamma/Strata

/**
 * Gets the expiry date-time.
 * <p>
 * The option expires at this date and time.
 * <p>
 * The result is returned by combining the expiry date, time and time-zone.
 * 
 * @return the expiry date and time
 */
public ZonedDateTime getExpiry() {
 return expiryDate.getUnadjusted().atTime(expiryTime).atZone(expiryZone);
}
origin: OpenGamma/Strata

  .orElse(BusinessDayAdjustment.NONE);
PeriodicSchedule.Builder scheduleBuilder = PeriodicSchedule.builder()
  .startDate(effectiveDate.getUnadjusted())
  .startDateBusinessDayAdjustment(effectiveDate.getAdjustment())
  .endDate(terminationDate.getUnadjusted())
  .endDateBusinessDayAdjustment(terminationDate.getAdjustment())
  .businessDayAdjustment(bda);
 LocalDate date = initialPaymentEl.findChild("adjustablePaymentDate")
   .map(el -> document.parseDate(el))
   .orElse(effectiveDate.getUnadjusted());
 AdjustableDate adjDate = AdjustableDate.of(date, bda);
 upfrontFee = payRec.isPay() ? AdjustablePayment.ofPay(amount, adjDate) : AdjustablePayment.ofReceive(amount, adjDate);
  .ifPresent(el -> scheduleBuilder.firstRegularStartDate(document.parseDate(el)));
periodicPaymentEl.findChild("firstPeriodStartDate")
  .ifPresent(el -> scheduleBuilder.overrideStartDate(AdjustableDate.of(document.parseDate(el))));
periodicPaymentEl.findChild("lastRegularPaymentDate")
  .ifPresent(el -> scheduleBuilder.lastRegularEndDate(document.parseDate(el)));
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

/**
 * Resolves the date on this payment, returning a payment with a fixed date.
 * <p>
 * This returns a {@link Payment} with the same amount and resolved date.
 * 
 * @param refData  the reference data, used to find the holiday calendar
 * @return the resolved payment
 */
@Override
public Payment resolve(ReferenceData refData) {
 return Payment.of(value, date.adjusted(refData));
}
origin: OpenGamma/Strata

 baseDate = parseDate(relativeToEl);
} else if (relativeToEl.getName().contains("relative")) {
 baseDate = parseAdjustedRelativeDateOffset(relativeToEl).getUnadjusted();
} else {
 throw new FpmlParseException(
 resolvedDate = bda1.adjust(datePlusBusDays, refData);
return AdjustableDate.of(resolvedDate, bda2);
origin: OpenGamma/Strata

@Override
public String formatForCsv(AdjustableDate amount) {
 return amount.getUnadjusted().toString();
}
origin: OpenGamma/Strata

  .map(el -> document.parseAdjustableDate(el))
  .orElseGet(() -> document.parseAdjustedRelativeDateOffset(calcPeriodDatesEl.getChild("relativeEffectiveDate")));
accrualScheduleBuilder.startDate(startDate.getUnadjusted());
if (!bda.equals(startDate.getAdjustment())) {
 accrualScheduleBuilder.startDateBusinessDayAdjustment(startDate.getAdjustment());
  .map(el -> document.parseAdjustableDate(el))
  .orElseGet(() -> document.parseAdjustedRelativeDateOffset(calcPeriodDatesEl.getChild("relativeTerminationDate")));
accrualScheduleBuilder.endDate(endDate.getUnadjusted());
if (!bda.equals(endDate.getAdjustment())) {
 accrualScheduleBuilder.endDateBusinessDayAdjustment(endDate.getAdjustment());
origin: OpenGamma/Strata

private List<LocalDate> applyBusinessDayAdjustment(List<LocalDate> unadj, ReferenceData refData) {
 List<LocalDate> adj = new ArrayList<>(unadj.size());
 adj.add(calculatedStartDate().adjusted(refData));
 for (int i = 1; i < unadj.size() - 1; i++) {
  adj.add(businessDayAdjustment.adjust(unadj.get(i), refData));
 }
 adj.add(calculatedEndDate().adjusted(refData));
 return adj;
}
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

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

@Override
public String formatForDisplay(AdjustableDate amount) {
 return amount.getUnadjusted().toString();
}
origin: OpenGamma/Strata

private void assertFra(List<Trade> trades, boolean interpolatedParty1) {
 assertEquals(trades.size(), 1);
 Trade trade = trades.get(0);
 assertEquals(trade.getClass(), FraTrade.class);
 FraTrade fraTrade = (FraTrade) trade;
 assertEquals(fraTrade.getInfo().getTradeDate(), Optional.of(date(1991, 5, 14)));
 StandardId party1id = StandardId.of("http://www.hsbc.com/swaps/trade-id", "MB87623");
 StandardId party2id = StandardId.of("http://www.abnamro.com/swaps/trade-id", "AA9876");
 assertEquals(fraTrade.getInfo().getId(), Optional.of(interpolatedParty1 ? party1id : party2id));
 Fra fra = fraTrade.getProduct();
 assertEquals(fra.getBuySell(), interpolatedParty1 ? BUY : SELL);
 assertEquals(fra.getStartDate(), date(1991, 7, 17));
 assertEquals(fra.getEndDate(), date(1992, 1, 17));
 assertEquals(fra.getBusinessDayAdjustment(), Optional.empty());
 assertEquals(fra.getPaymentDate().getUnadjusted(), date(1991, 7, 17));
 assertEquals(fra.getPaymentDate().getAdjustment(), BusinessDayAdjustment.of(FOLLOWING, CHZU));
 assertEquals(fra.getFixingDateOffset().getDays(), -2);
 assertEquals(fra.getFixingDateOffset().getCalendar(), GBLO);
 assertEquals(fra.getFixingDateOffset().getAdjustment(), BusinessDayAdjustment.NONE);
 assertEquals(fra.getDayCount(), ACT_360);
 assertEquals(fra.getCurrency(), CHF);
 assertEquals(fra.getNotional(), 25000000d);
 assertEquals(fra.getFixedRate(), 0.04d);
 assertEquals(fra.getIndex(), interpolatedParty1 ? CHF_LIBOR_3M : CHF_LIBOR_6M);
 assertEquals(fra.getIndexInterpolated(), interpolatedParty1 ? Optional.of(CHF_LIBOR_6M) : Optional.empty());
 assertEquals(fra.getDiscounting(), FraDiscountingMethod.ISDA);
}
origin: OpenGamma/Strata

@Override
public ResolvedBulletPayment resolve(ReferenceData refData) {
 CurrencyAmount signed = payReceive == PayReceive.PAY ? value.negated() : value;
 Payment payment = Payment.of(signed, date.adjusted(refData));
 return ResolvedBulletPayment.of(payment);
}
origin: OpenGamma/Strata

/**
 * Obtains an instance with no business day adjustment.
 * <p>
 * This creates an adjustable date from the specified date.
 * No business day adjustment applies, thus the result of {@link #adjusted(ReferenceData)}
 * is the specified date.
 * 
 * @param date  the date
 * @return the adjustable date
 */
public static AdjustableDate of(LocalDate date) {
 return new AdjustableDate(date, BusinessDayAdjustment.NONE);
}
origin: OpenGamma/Strata

@Override
public AdjustableDate getStartDate() {
 return AdjustableDate.of(paymentPeriods.get(0).getStartDate());
}
com.opengamma.strata.basics.dateAdjustableDate

Javadoc

An adjustable date.

This class combines an unadjusted date and the business day adjustment necessary to adjust it. Calling the #adjusted(ReferenceData) method will return the adjusted date.

Most used methods

  • of
    Obtains an instance with a business day adjustment. This creates an adjustable date from the unadjus
  • 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

  • Finding current android device location
  • getContentResolver (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Runnable (java.lang)
    Represents a command that can be executed. Often used to run code in a different Thread.
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • JFrame (javax.swing)
  • JTable (javax.swing)
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • From CI to AI: The AI layer in your organization
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