/** * Gets the valuation date. * <p> * The raw data in this provider is calibrated for this date. * * @return the valuation date */ public LocalDate getValuationDate() { return discountFactors.getValuationDate(); }
/** * Gets the valuation date. * <p> * The raw data in this provider is calibrated for this date. * * @return the valuation date */ public LocalDate getValuationDate() { return discountFactors.getValuationDate(); }
@Override public LocalDate getValuationDate() { return discountFactors.getValuationDate(); }
@Override public LocalDate getValuationDate() { return discountFactors.getValuationDate(); }
@ImmutablePreBuild private static void preBuild(Builder builder) { if (builder.valuationDate == null && !builder.issuerCurves.isEmpty()) { builder.valuationDate = builder.issuerCurves.values().iterator().next().getValuationDate(); } }
private DiscountFactors createDiscountFactors(DiscountFactors originalDsc, Curve bumpedCurve) { if (originalDsc instanceof ZeroRateDiscountFactors) { return ZeroRateDiscountFactors.of(originalDsc.getCurrency(), originalDsc.getValuationDate(), bumpedCurve); } else if (originalDsc instanceof SimpleDiscountFactors) { return SimpleDiscountFactors.of(originalDsc.getCurrency(), originalDsc.getValuationDate(), bumpedCurve); } throw new IllegalArgumentException("Not supported"); }
@ImmutableValidator private void validate() { for (Entry<Pair<RepoGroup, Currency>, DiscountFactors> entry : repoCurves.entrySet()) { if (!entry.getValue().getValuationDate().isEqual(valuationDate)) { throw new IllegalArgumentException("Invalid valuation date for the repo curve: " + entry.getValue()); } RepoGroup group = entry.getKey().getFirst(); if (!repoCurveGroups.containsValue(group) && !repoCurveSecurityGroups.containsValue(group)) { throw new IllegalArgumentException("No map to the repo group from ID: " + group); } } for (Entry<Pair<LegalEntityGroup, Currency>, DiscountFactors> entry : issuerCurves.entrySet()) { if (!entry.getValue().getValuationDate().isEqual(valuationDate)) { throw new IllegalArgumentException("Invalid valuation date for the issuer curve: " + entry.getValue()); } if (!issuerCurveGroups.containsValue(entry.getKey().getFirst())) { throw new IllegalArgumentException("No map to the legal entity group from ID: " + entry.getKey().getFirst()); } } }
public void test_of_discountFactors() { DiscountFactors test = DiscountFactors.of(GBP, DATE_VAL, CURVE_DF); assertEquals(test instanceof SimpleDiscountFactors, true); assertEquals(test.getCurrency(), GBP); assertEquals(test.getValuationDate(), DATE_VAL); }
public void test_of_zeroRatePeriodic() { DiscountFactors test = DiscountFactors.of(GBP, DATE_VAL, CURVE_ZERO_PERIODIC); assertEquals(test instanceof ZeroRatePeriodicDiscountFactors, true); assertEquals(test.getCurrency(), GBP); assertEquals(test.getValuationDate(), DATE_VAL); }
public void test_of_zeroRate() { DiscountFactors test = DiscountFactors.of(GBP, DATE_VAL, CURVE_ZERO); assertEquals(test instanceof ZeroRateDiscountFactors, true); assertEquals(test.getCurrency(), GBP); assertEquals(test.getValuationDate(), DATE_VAL); }
counterCurrencyDiscountFactors.getCurrency())); if (!baseCurrencyDiscountFactors.getValuationDate().equals(counterCurrencyDiscountFactors.getValuationDate())) { throw new IllegalArgumentException("Curves must have the same valuation date"); this.baseCurrencyDiscountFactors = baseCurrencyDiscountFactors; this.counterCurrencyDiscountFactors = counterCurrencyDiscountFactors; this.valuationDate = baseCurrencyDiscountFactors.getValuationDate(); this.paramCombiner = ParameterizedDataCombiner.of(baseCurrencyDiscountFactors, counterCurrencyDiscountFactors);
/** * Compute the present value curve sensitivity of the payment. * <p> * The present value sensitivity of the payment is the sensitivity of the * present value to the discount factor curve. * There is no sensitivity if the payment date is before the valuation date. * <p> * The specified discount factors should be for the payment currency, however this is not validated. * * @param payment the payment * @param discountFactors the discount factors to price against * @return the point sensitivity of the present value */ public PointSensitivityBuilder presentValueSensitivity(Payment payment, DiscountFactors discountFactors) { if (discountFactors.getValuationDate().isAfter(payment.getDate())) { return PointSensitivityBuilder.none(); } return discountFactors.zeroRatePointSensitivity(payment.getDate()).multipliedBy(payment.getAmount()); }
/** * Computes the present value of the payment by discounting. * <p> * The present value is zero if the payment date is before the valuation date. * <p> * The specified discount factors should be for the payment currency, however this is not validated. * * @param payment the payment * @param discountFactors the discount factors to price against * @return the present value */ public CurrencyAmount presentValue(Payment payment, DiscountFactors discountFactors) { if (discountFactors.getValuationDate().isAfter(payment.getDate())) { return CurrencyAmount.zero(payment.getCurrency()); } return payment.getValue().multipliedBy(discountFactors.discountFactor(payment.getDate())); }
int periodsPerYear) { if (discountFactors.getValuationDate().isAfter(payment.getDate())) { return PointSensitivityBuilder.none();
/** * Computes the present value of the payment with z-spread by discounting. * <p> * The present value is zero if the payment date is before the valuation date. * <p> * The specified discount factors should be for the payment currency, however this is not validated. * <p> * The z-spread is a parallel shift applied to continuously compounded rates or periodic * compounded rates of the discounting curve. * * @param payment the payment * @param discountFactors the discount factors to price against * @param zSpread the z-spread * @param compoundedRateType the compounded rate type * @param periodsPerYear the number of periods per year * @return the present value */ public CurrencyAmount presentValueWithSpread( Payment payment, DiscountFactors discountFactors, double zSpread, CompoundedRateType compoundedRateType, int periodsPerYear) { if (discountFactors.getValuationDate().isAfter(payment.getDate())) { return CurrencyAmount.zero(payment.getCurrency()); } double df = discountFactors.discountFactorWithSpread(payment.getDate(), zSpread, compoundedRateType, periodsPerYear); return payment.getValue().multipliedBy(df); }