congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
AdjustableDate.getUnadjusted
Code IndexAdd Tabnine to your IDE (free)

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

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

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

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

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

/**
 * Gets the accrual start date of the swap.
 * <p>
 * This is the earliest accrual date of the legs, often known as the effective date.
 * The latest date is chosen by examining the unadjusted end date.
 * 
 * @return the start date of the swap
 */
@DerivedProperty
public AdjustableDate getStartDate() {
 return legs.stream()
   .map(SwapLeg::getStartDate)
   .min(Comparator.comparing(adjDate -> adjDate.getUnadjusted()))
   .get();  // always at least one leg, so get() is safe
}
origin: OpenGamma/Strata

/**
 * Gets the accrual end date of the swap.
 * <p>
 * This is the latest accrual date of the legs, often known as the termination date.
 * The latest date is chosen by examining the unadjusted end date.
 * 
 * @return the end date of the swap
 */
@DerivedProperty
public AdjustableDate getEndDate() {
 return legs.stream()
   .map(SwapLeg::getEndDate)
   .max(Comparator.comparing(adjDate -> adjDate.getUnadjusted()))
   .get();  // always at least one leg, so get() is safe
}
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

@Override
public PortfolioItemSummary summarize() {
 // Long 5Y USD 2mm Rec USD-LIBOR-6M / Pay 1% : 21Jan18
 String swapDesc = product.getUnderlying().summaryDescription();
 swapDesc = swapDesc.contains(":") ? swapDesc.substring(0, swapDesc.lastIndexOf(':')).trim() : swapDesc;
 StringBuilder buf = new StringBuilder(96);
 buf.append(product.getLongShort());
 buf.append(' ');
 buf.append(swapDesc);
 buf.append(" : ");
 buf.append(SummarizerUtils.date(product.getExpiryDate().getUnadjusted()));
 return SummarizerUtils.summary(this, ProductType.SWAPTION, buf.toString(), product.getCurrency());
}
origin: OpenGamma/Strata

@Override
public PortfolioItemSummary summarize() {
 // Pay USD 2mm : 21Jan18
 StringBuilder buf = new StringBuilder(64);
 buf.append(product.getPayReceive());
 buf.append(' ');
 buf.append(SummarizerUtils.amount(product.getValue()));
 buf.append(" : ");
 buf.append(SummarizerUtils.date(product.getDate().getUnadjusted()));
 return SummarizerUtils.summary(this, ProductType.BULLET_PAYMENT, buf.toString(), product.getCurrency());
}
origin: OpenGamma/Strata

/**
 * Computes the price from the yield at a given settlement date.
 * 
 * @param yield  the yield
 * @param settlementDate  the settlement date
 * @return the price
 */
public double priceFromYield(double yield, LocalDate settlementDate) {
 double accrualFactor = dayCount.relativeYearFraction(settlementDate, notional.getDate().getUnadjusted());
 return yieldConvention.priceFromYield(yield, accrualFactor);
}
origin: OpenGamma/Strata

/**
 * Computes the yield from the price at a given settlement date.
 * 
 * @param price  the price
 * @param settlementDate  the settlement date
 * @return the yield
 */
public double yieldFromPrice(double price, LocalDate settlementDate) {
 double accrualFactor = dayCount.relativeYearFraction(settlementDate, notional.getDate().getUnadjusted());
 return yieldConvention.yieldFromPrice(price, accrualFactor);
}
origin: OpenGamma/Strata

@Override
public Dsf createProduct(ReferenceData refData) {
 LocalDate deliveryDate = underlyingSwap.getStartDate().getUnadjusted();
 return new Dsf(getSecurityId(), notional, lastTradeDate, deliveryDate, underlyingSwap);
}
origin: OpenGamma/Strata

@Override
public PortfolioItemSummary summarize() {
 // 5Y USD 2mm Rec USD-LIBOR-1100-1Y Cap 1% / Pay Premium : 21Jan17-21Jan22
 StringBuilder buf = new StringBuilder(96);
 CmsLeg mainLeg = product.getCmsLeg();
 buf.append(SummarizerUtils.datePeriod(mainLeg.getStartDate().getUnadjusted(), mainLeg.getEndDate().getUnadjusted()));
 buf.append(' ');
 buf.append(SummarizerUtils.amount(mainLeg.getCurrency(), mainLeg.getNotional().getInitialValue()));
 buf.append(' ');
 if (mainLeg.getPayReceive().isReceive()) {
  buf.append("Rec ");
  summarizeMainLeg(mainLeg, buf);
  buf.append(getPremium().isPresent() ? " / Pay Premium" : (product.getPayLeg().isPresent() ? " /  Pay Periodic" : ""));
 } else {
  buf.append(
    getPremium().isPresent() ? "Rec Premium / Pay " : (product.getPayLeg().isPresent() ? "Rec Periodic / Pay " : ""));
  summarizeMainLeg(mainLeg, buf);
 }
 buf.append(" : ");
 buf.append(SummarizerUtils.dateRange(mainLeg.getStartDate().getUnadjusted(), mainLeg.getEndDate().getUnadjusted()));
 return SummarizerUtils.summary(this, ProductType.CMS, buf.toString(), mainLeg.getCurrency());
}
origin: OpenGamma/Strata

private SwaptionSettlement parseSettlement(XmlElement swaptionEl, FpmlDocument document) {
 Optional<String> optionalCashSettlement = swaptionEl.findAttribute("cashSettlement");
 if (optionalCashSettlement.isPresent()) {
  XmlElement cashSettlementEl = swaptionEl.getChild("cashSettlement");
  CashSwaptionSettlementMethod method = parseCashSettlementMethod(cashSettlementEl);
  LocalDate settlementDate = document.parseAdjustedRelativeDateOffset(cashSettlementEl).getUnadjusted();
  return CashSwaptionSettlement.of(settlementDate, method);
 } else {
  // treat physical as the default to match FpML examples
  return PhysicalSwaptionSettlement.DEFAULT;
 }
}
origin: OpenGamma/Strata

@ImmutableValidator
private void validate() {
 ArgChecker.inOrderOrEqual(
   expiryDate.getUnadjusted(), underlying.getStartDate().getUnadjusted(), "expiryDate", "underlying.startDate.unadjusted");
 ArgChecker.isTrue(!underlying.isCrossCurrency(), "Underlying swap must not be cross-currency");
 ArgChecker.isTrue(underlying.getLegs(SwapLegType.FIXED).size() == 1, "Underlying swap must have one fixed leg");
 ArgChecker.isTrue(underlying.getLegs(SwapLegType.IBOR).size() == 1, "Underlying swap must have one Ibor leg");
 ArgChecker.isTrue(underlying.allIndices().size() == 1, "Underlying swap must have one index");
 ArgChecker.isTrue(underlying.allIndices().iterator().next() instanceof IborIndex, "Underlying swap must have one Ibor index");
}
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 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_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

@ImmutableValidator
private void validate() {
 ArgChecker.inOrderNotEqual(
   startDate, endDate, "startDate", "endDate");
 if (firstRegularStartDate != null) {
  if (lastRegularEndDate != null) {
   ArgChecker.inOrderOrEqual(
     firstRegularStartDate, lastRegularEndDate, "firstRegularStartDate", "lastRegularEndDate");
  }
  // Check override start date if present, otherwise use regular start date
  if (overrideStartDate != null) {
   ArgChecker.inOrderNotEqual(
     overrideStartDate.getUnadjusted(), firstRegularStartDate, "overrideStartDate", "firstRegularStartDate");
  } else {
   ArgChecker.inOrderOrEqual(
     startDate, firstRegularStartDate, "unadjusted", "firstRegularStartDate");
  }
 }
 if (lastRegularEndDate != null) {
  ArgChecker.inOrderOrEqual(
    lastRegularEndDate, endDate, "lastRegularEndDate", "endDate");
 }
}
origin: OpenGamma/Strata

public void test_ofYield() {
 BillTrade test = sut_yield();
 assertEquals(test.getProduct(), PRODUCT);
 assertEquals(test.getInfo(), TRADE_INFO);
 assertEquals(test.getQuantity(), QUANTITY);
 double price = 1.0d -
   YIELD * PRODUCT.getDayCount().relativeYearFraction(SETTLEMENT_DATE, PRODUCT.getNotional().getDate().getUnadjusted());
 assertEquals(test.getPrice(), price, TOLERANCE_PRICE);
 assertEquals(test.withInfo(TRADE_INFO).getInfo(), TRADE_INFO);
 assertEquals(test.withQuantity(129).getQuantity(), 129d, 0d);
 assertEquals(test.withPrice(129).getPrice(), 129d, 0d);
}
origin: OpenGamma/Strata

@ImmutableValidator
private void validate() {
 ArgChecker.inOrderOrEqual(
   deliveryDate, underlyingSwap.getStartDate().getUnadjusted(), "deliveryDate", "underlyingSwap.startDate.unadjusted");
 ArgChecker.isFalse(underlyingSwap.isCrossCurrency(), "Underlying swap must not be cross currency");
 for (SwapLeg swapLeg : underlyingSwap.getLegs()) {
  if (swapLeg.getType().equals(SwapLegType.FIXED)) {
   ArgChecker.isTrue(swapLeg.getPayReceive().isReceive(), "Underlying swap must receive the fixed leg");
  }
  if (swapLeg instanceof RateCalculationSwapLeg) {
   RateCalculationSwapLeg leg = (RateCalculationSwapLeg) swapLeg;
   ArgChecker.isTrue(Math.abs(leg.getNotionalSchedule().getAmount().getInitialValue()) == 1d,
     "Underlying swap must have a notional of 1");
  }
 }
 ArgChecker.inOrderOrEqual(lastTradeDate, deliveryDate, "lastTradeDate", "deliveryDate");
}
com.opengamma.strata.basics.dateAdjustableDategetUnadjusted

Javadoc

Gets the unadjusted date.

This date may be a non-business day. The business day adjustment is used to ensure it is a valid business day.

Popular methods of AdjustableDate

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

  • Parsing JSON documents to java classes using gson
  • startActivity (Activity)
  • compareTo (BigDecimal)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • JFrame (javax.swing)
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Sublime Text for Python
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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