public void test_presentValueSensitivity_provider_ended() { PointSensitivities computed = PRICER.presentValueSensitivity(TRADE_PAST, PROVIDER); assertEquals(computed, PointSensitivities.empty()); }
public void test_presentValueSensitivity_afterExpiry() { PointSensitivities point = PRICER.presentValueSensitivityRatesStickyStrike(CALL_ITM, RATES_PROVIDER_AFTER, VOLS_AFTER); assertEquals(point, PointSensitivities.empty()); }
public void presentValueSensitivity_aftermaturity() { PointSensitivities sensiComputed = PRICER.presentValueSensitivity(BILL_PAST, PROVIDER); PointSensitivities sensiExpected = PointSensitivities.empty(); assertTrue(sensiComputed.equalWithTolerance(sensiExpected, TOLERANCE_PV)); }
public void test_presentValueSensitivityWithSpread_df_spread_ended() { PointSensitivities computed = PRICER.presentValueSensitivityWithSpread(PAYMENT_PAST, DISCOUNT_FACTORS, Z_SPREAD, PERIODIC, 3).build(); assertEquals(computed, PointSensitivities.empty()); }
public void presentValueSensitivity_zspread_aftermaturity() { PointSensitivities sensiComputed = PRICER.presentValueSensitivityWithZSpread(BILL_PAST, PROVIDER, Z_SPREAD, CompoundedRateType.CONTINUOUS, 0); PointSensitivities sensiExpected = PointSensitivities.empty(); assertTrue(sensiComputed.equalWithTolerance(sensiExpected, TOLERANCE_PV)); }
public void test_presentValueSensitivity_provider_ended() { PointSensitivities computed = PRICER.presentValueSensitivity(PAYMENT_PAST, PROVIDER).build(); assertEquals(computed, PointSensitivities.empty()); }
public void test_presentValueSensitivity_df_ended() { PointSensitivities computed = PRICER.presentValueSensitivity(PAYMENT_PAST, DISCOUNT_FACTORS).build(); assertEquals(computed, PointSensitivities.empty()); }
public void test_presentValueSensitivitySabrParameter_ended() { PointSensitivities computed = LEG_PRICER.presentValueSensitivityModelParamsSabr(CAP_LEG, RATES_PROVIDER_ENDED, VOLATILITIES_ENDED).build(); assertEquals(computed, PointSensitivities.empty()); }
public void test_presentValueSensitivity_ended() { ResolvedFxSwap product = ResolvedFxSwap.ofForwardPoints( CurrencyAmount.of(USD, NOMINAL_USD), KRW, FX_RATE, FX_FWD_POINTS, PAYMENT_DATE_LONG_PAST, PAYMENT_DATE_PAST); PointSensitivities computed = PRICER.presentValueSensitivity(product, PROVIDER); assertEquals(computed, PointSensitivities.empty()); }
public void test_presentValueSensitivity_inPast() { SimpleRatesProvider prov = createProvider(VAL_DATE); PointSensitivities computed = PRICER.presentValueSensitivity(PERIOD_PAST, prov) .build(); assertEquals(computed, PointSensitivities.empty()); }
public void test_presentValueSensitivity_ended() { ResolvedFxSingle fwd = ResolvedFxSingle.of(CurrencyAmount.of(USD, NOMINAL_USD), FxRate.of(USD, KRW, FX_RATE), PAYMENT_DATE_PAST); PointSensitivities computed = PRICER.presentValueSensitivity(fwd, PROVIDER); assertEquals(computed, PointSensitivities.empty()); }
public void test_forecastValueSensitivity() { SimpleRatesProvider prov = createProvider(NOTIONAL_EXCHANGE_REC_GBP); DiscountingNotionalExchangePricer test = DiscountingNotionalExchangePricer.DEFAULT; PointSensitivities senseComputed = test.forecastValueSensitivity(NOTIONAL_EXCHANGE_REC_GBP, prov).build(); double eps = 1.0e-12; PointSensitivities senseExpected = PointSensitivities.empty(); assertTrue(senseComputed.equalWithTolerance( senseExpected, NOTIONAL_EXCHANGE_REC_GBP.getPaymentAmount().getAmount() * eps)); }
/** * Calculates the present value sensitivity of a bill trade. * <p> * If the settlement details are provided, the sensitivity is the sum of the underlying product's sensitivity * multiplied by the quantity and the sensitivity of the settlement payment if still due at the valuation date. * If not it is the underlying product's sensitivity multiplied by the quantity. * * @param trade the trade * @param provider the discounting provider * @return the present value sensitivity */ public PointSensitivities presentValueSensitivity(ResolvedBillTrade trade, LegalEntityDiscountingProvider provider) { if (provider.getValuationDate().isAfter(trade.getProduct().getNotional().getDate())) { return PointSensitivities.empty(); } PointSensitivities sensiProduct = productPricer.presentValueSensitivity(trade.getProduct(), provider) .multipliedBy(trade.getQuantity()); if (!trade.getSettlement().isPresent()) { return sensiProduct; } Payment settlement = trade.getSettlement().get(); RepoCurveDiscountFactors repoDf = DiscountingBillProductPricer.repoCurveDf(trade.getProduct(), provider); PointSensitivities sensiSettle = presentValueSensitivitySettlement(settlement, repoDf); return sensiProduct.combinedWith(sensiSettle); }
/** * Calculates the present value curve sensitivity of the FX product. * <p> * The present value sensitivity of the product is the sensitivity of the present value to * the underlying curves. * * @param fx the product * @param provider the rates provider * @return the point sensitivity of the present value */ public PointSensitivities presentValueSensitivity(ResolvedFxSingle fx, RatesProvider provider) { if (provider.getValuationDate().isAfter(fx.getPaymentDate())) { return PointSensitivities.empty(); } PointSensitivityBuilder pvcs1 = paymentPricer.presentValueSensitivity(fx.getBaseCurrencyPayment(), provider); PointSensitivityBuilder pvcs2 = paymentPricer.presentValueSensitivity(fx.getCounterCurrencyPayment(), provider); return pvcs1.combinedWith(pvcs2).build(); }
public void test_presentValueSensitivity_ended() { ResolvedFxNdf ndf = ResolvedFxNdf.builder() .settlementCurrencyNotional(CURRENCY_NOTIONAL) .agreedFxRate(FxRate.of(USD, KRW, FX_RATE)) .observation(FxIndexObservation.of(INDEX, FIXING_DATE_PAST, REF_DATA)) .paymentDate(PAYMENT_DATE_PAST) .build(); PointSensitivities computed = PRICER.presentValueSensitivity(ndf, PROVIDER); assertEquals(computed, PointSensitivities.empty()); }
/** * Calculates the present value sensitivity of the bill product. * <p> * The present value sensitivity of the product is the sensitivity of the present value to * the underlying curves. * * @param bill the product * @param provider the discounting provider * @return the present value curve sensitivity of the product */ public PointSensitivities presentValueSensitivity(ResolvedBill bill, LegalEntityDiscountingProvider provider) { if (provider.getValuationDate().isAfter(bill.getNotional().getDate())) { return PointSensitivities.empty(); } IssuerCurveDiscountFactors issuerDf = issuerCurveDf(bill, provider); double dfEndBar = bill.getNotional().getAmount(); PointSensitivityBuilder sensMaturity = issuerDf.zeroRatePointSensitivity(bill.getNotional().getDate()) .multipliedBy(dfEndBar); return sensMaturity.build(); }
return PointSensitivities.empty();
/** * Calculates the present value curve sensitivity of the NDF product. * <p> * The present value sensitivity of the product is the sensitivity of the present value to * the underlying curves. * * @param ndf the product * @param provider the rates provider * @return the point sensitivity of the present value */ public PointSensitivities presentValueSensitivity(ResolvedFxNdf ndf, RatesProvider provider) { if (provider.getValuationDate().isAfter(ndf.getPaymentDate())) { return PointSensitivities.empty(); } Currency ccySettle = ndf.getSettlementCurrency(); Currency ccyOther = ndf.getNonDeliverableCurrency(); double notionalSettle = ndf.getSettlementNotional(); double agreedRate = ndf.getAgreedFxRate().fxRate(ccySettle, ccyOther); double forwardRate = provider.fxIndexRates(ndf.getIndex()).rate(ndf.getObservation(), ccySettle); double dfSettle = provider.discountFactor(ccySettle, ndf.getPaymentDate()); double ratio = agreedRate / forwardRate; double dscBar = (1d - ratio) * notionalSettle; PointSensitivityBuilder sensiDsc = provider.discountFactors(ccySettle).zeroRatePointSensitivity(ndf.getPaymentDate()).multipliedBy(dscBar); double forwardRateBar = dfSettle * notionalSettle * ratio / forwardRate; PointSensitivityBuilder sensiFx = provider.fxIndexRates(ndf.getIndex()) .ratePointSensitivity(ndf.getObservation(), ccySettle).withCurrency(ccySettle).multipliedBy(forwardRateBar); return sensiDsc.combinedWith(sensiFx).build(); }