Exemple #1
0
        private ImmutableRatesProvider createProvider(double rateStart, double rateStartInterp, double rateEnd, double rateEndInterp)
        {
            LocalDateDoubleTimeSeries timeSeries = LocalDateDoubleTimeSeries.of(VAL_DATE.with(lastDayOfMonth()), 300);
            InterpolatedNodalCurve    curve      = InterpolatedNodalCurve.of(Curves.prices("GB-RPIX"), DoubleArray.of(4, 5, 16, 17), DoubleArray.of(rateStart, rateStartInterp, rateEnd, rateEndInterp), INTERPOLATOR);

            return(ImmutableRatesProvider.builder(VAL_DATE).priceIndexCurve(GB_RPIX, curve).timeSeries(GB_RPIX, timeSeries).build());
        }
Exemple #2
0
        public virtual void test_currentCash_onPayment()
        {
            ImmutableRatesProvider prov = ImmutableRatesProvider.builder(PERIOD.PaymentDate).discountCurve(GBP, DISCOUNT_CURVE_GBP).build();
            double computed             = PRICER.currentCash(PERIOD, prov);

            assertEquals(computed, AMOUNT_1000);
        }
Exemple #3
0
        public virtual void test_currentCash_zero()
        {
            ImmutableRatesProvider prov = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(GBP, DISCOUNT_CURVE_GBP).build();
            double computed             = PRICER.currentCash(PERIOD, prov);

            assertEquals(computed, 0d);
        }
Exemple #4
0
        //-------------------------------------------------------------------------
        public virtual void test_currencyExposure()
        {
            ImmutableRatesProvider prov     = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(GBP, DISCOUNT_CURVE_GBP).build();
            MultiCurrencyAmount    computed = PRICER.currencyExposure(PERIOD, prov);
            PointSensitivities     point    = PRICER.presentValueSensitivity(PERIOD, prov).build();
            MultiCurrencyAmount    expected = prov.currencyExposure(point).plus(CurrencyAmount.of(GBP, PRICER.presentValue(PERIOD, prov)));

            assertEquals(computed, expected);
        }
Exemple #5
0
        static DiscountingTermDepositProductPricerTest()
        {
            CurveInterpolator      interp   = CurveInterpolators.DOUBLE_QUADRATIC;
            DoubleArray            time_eur = DoubleArray.of(0.0, 0.5, 1.0, 2.0, 3.0, 4.0, 5.0, 10.0);
            DoubleArray            rate_eur = DoubleArray.of(0.0160, 0.0135, 0.0160, 0.0185, 0.0185, 0.0195, 0.0200, 0.0210);
            InterpolatedNodalCurve dscCurve = InterpolatedNodalCurve.of(Curves.zeroRates("EUR-Discount", ACT_360), time_eur, rate_eur, interp);

            IMM_PROV = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(EUR, dscCurve).build();
        }
        static DiscountingIborFixingDepositTradePricerTest()
        {
            CurveInterpolator      interp     = CurveInterpolators.DOUBLE_QUADRATIC;
            DoubleArray            time_eur   = DoubleArray.of(0.0, 0.1, 0.25, 0.5, 0.75, 1.0, 2.0);
            DoubleArray            rate_eur   = DoubleArray.of(0.0160, 0.0165, 0.0155, 0.0155, 0.0155, 0.0150, 0.014);
            InterpolatedNodalCurve dscCurve   = InterpolatedNodalCurve.of(Curves.zeroRates("EUR-Discount", ACT_ACT_ISDA), time_eur, rate_eur, interp);
            DoubleArray            time_index = DoubleArray.of(0.0, 0.25, 0.5, 1.0);
            DoubleArray            rate_index = DoubleArray.of(0.0180, 0.0180, 0.0175, 0.0165);
            InterpolatedNodalCurve indexCurve = InterpolatedNodalCurve.of(Curves.zeroRates("EUR-EURIBOR6M", ACT_ACT_ISDA), time_index, rate_index, interp);

            IMM_PROV = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(EUR, dscCurve).iborIndexCurve(EUR_EURIBOR_6M, indexCurve).build();
        }
Exemple #7
0
        static ImmutableRatesProviderSimpleData()
        {
            CurveInterpolator      interp     = CurveInterpolators.DOUBLE_QUADRATIC;
            DoubleArray            time_eur   = DoubleArray.of(0.0, 0.1, 0.25, 0.5, 0.75, 1.0, 2.0);
            DoubleArray            rate_eur   = DoubleArray.of(0.0160, 0.0165, 0.0155, 0.0155, 0.0155, 0.0150, 0.0140);
            InterpolatedNodalCurve dscCurve   = InterpolatedNodalCurve.of(Curves.zeroRates("EUR-Discount", ACT_365F), time_eur, rate_eur, interp);
            DoubleArray            time_index = DoubleArray.of(0.0, 0.25, 0.5, 1.0);
            DoubleArray            rate_index = DoubleArray.of(0.0180, 0.0180, 0.0175, 0.0165);
            InterpolatedNodalCurve indexCurve = InterpolatedNodalCurve.of(Curves.zeroRates("EUR-EURIBOR6M", ACT_365F), time_index, rate_index, interp);

            IMM_PROV_EUR_NOFIX = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(EUR, dscCurve).iborIndexCurve(EUR_EURIBOR_6M, indexCurve).build();
            LocalDateDoubleTimeSeries tsE6 = LocalDateDoubleTimeSeries.builder().put(VAL_DATE, 0.012345).build();

            IMM_PROV_EUR_FIX = ImmutableRatesProvider.builder(VAL_DATE).discountCurve(EUR, dscCurve).iborIndexCurve(EUR_EURIBOR_6M, indexCurve, tsE6).build();
        }
 /// <summary>
 /// Creates rates provider with specified  valuation date.
 /// </summary>
 /// <param name="valuationDate">  the valuation date </param>
 /// <returns>  the rates provider </returns>
 public static ImmutableRatesProvider createRatesProvider(LocalDate valuationDate)
 {
     return(ImmutableRatesProvider.builder(valuationDate).discountCurves(ImmutableMap.of(EUR, DSC_CURVE)).indexCurves(ImmutableMap.of(EUR_EURIBOR_3M, FWD3_CURVE, EUR_EURIBOR_6M, FWD6_CURVE)).fxRateProvider(FxMatrix.empty()).build());
 }
        /// <summary>
        /// Creates rates provider for EUR, USD with FX matrix.
        /// <para>
        /// The discount curves are flat.
        ///
        /// </para>
        /// </summary>
        /// <param name="valuationDate">  the valuation date </param>
        /// <returns> the rates provider </returns>
        public static ImmutableRatesProvider createProviderEurUsdFlat(LocalDate valuationDate)
        {
            FxMatrix fxMatrix = FxMatrix.builder().addRate(USD, EUR, 1.0d / EUR_USD).build();

            return(ImmutableRatesProvider.builder(valuationDate).discountCurve(EUR, EUR_DSC_FLAT).discountCurve(USD, USD_DSC_FLAT).fxRateProvider(fxMatrix).build());
        }
 /// <summary>
 /// Create a yield curve bundle with three curves.
 /// One called "Discounting EUR" with a constant rate of 2.50%, one called "Discounting USD"
 /// with a constant rate of 1.00% and one called "Discounting GBP" with a constant rate of 2.00%;
 /// "Discounting KRW" with a constant rate of 3.21%;
 /// </summary>
 /// <returns> the provider </returns>
 public static RatesProvider createProvider()
 {
     return(ImmutableRatesProvider.builder(VAL_DATE_2014_01_22).discountCurve(EUR, EUR_DSC).discountCurve(USD, USD_DSC).discountCurve(GBP, GBP_DSC).discountCurve(KRW, KRW_DSC).fxRateProvider(FX_MATRIX).build());
 }
 /// <summary>
 /// Obtains an immutable rates providers with valuation date and time series.
 /// <para>
 /// The time series must contain historical data for the price index.
 ///
 /// </para>
 /// </summary>
 /// <param name="valuationDate">  the valuation date </param>
 /// <param name="timeSeries">  the time series </param>
 /// <returns> the rates provider </returns>
 public static ImmutableRatesProvider getRatesProvider(LocalDate valuationDate, LocalDateDoubleTimeSeries timeSeries)
 {
     return(ImmutableRatesProvider.builder(valuationDate).fxRateProvider(FxMatrix.empty()).priceIndexCurve(US_CPI_U, CPI_CURVE).timeSeries(US_CPI_U, timeSeries).build());
 }
 /// <summary>
 /// Create a yield curve bundle with three curves.
 /// One called "Discounting EUR" with a constant rate of 2.50%, one called "Discounting USD"
 /// with a constant rate of 1.00% and one called "Discounting GBP" with a constant rate of 2.00%;
 /// "Discounting KRW" with a constant rate of 3.21%;
 /// </summary>
 /// <param name="valuationDate">  the valuation date </param>
 /// <param name="fxIndex">  the FX index </param>
 /// <param name="spotRate">  the spot rate for the index </param>
 /// <returns> the provider </returns>
 public static RatesProvider createProvider(LocalDate valuationDate, FxIndex fxIndex, double spotRate)
 {
     return(ImmutableRatesProvider.builder(valuationDate).discountCurve(EUR, EUR_DSC).discountCurve(USD, USD_DSC).discountCurve(GBP, GBP_DSC).discountCurve(KRW, KRW_DSC).fxRateProvider(FX_MATRIX).timeSeries(fxIndex, LocalDateDoubleTimeSeries.of(fxIndex.calculateFixingFromMaturity(valuationDate, REF_DATA), spotRate)).build());
 }
Exemple #13
0
        public virtual void test_currentCash_onEndDate()
        {
            RatesProvider prov = ImmutableRatesProvider.builder(RDEPOSIT_TRADE.Product.EndDate).discountCurve(EUR, CURVE).build();

            assertEquals(PRICER_TRADE.currentCash(RDEPOSIT_TRADE, prov), CurrencyAmount.of(EUR, NOTIONAL + INTEREST));
        }
 private static ImmutableRatesProvider getRatesProvider(LocalDate valuationDate)
 {
     return(ImmutableRatesProvider.builder(valuationDate).indexCurve(USD_FED_FUND, CURVE).timeSeries(USD_FED_FUND, TIME_SERIES).build());
 }
	  private static RatesProvider getRatesProvider(LocalDate valuationDate)
	  {
		return ImmutableRatesProvider.builder(valuationDate).indexCurve(USD_FED_FUND, CURVE).build();
	  }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Provides rates for USD Discounting, Overnight FedFund and Libor 1/3/6 month.
 /// </summary>
 /// <returns> the rates provider </returns>
 public static ImmutableRatesProvider providerUsdDscOnL1L3L6()
 {
     // data from group 1
     return(ImmutableRatesProvider.builder(VAL_DATE_2014_01_22).fxRateProvider(FX_MATRIX).discountCurve(USD, GROUP1_USD_DSC).overnightIndexCurve(USD_FED_FUND, GROUP1_USD_ON).iborIndexCurve(USD_LIBOR_1M, GROUP1_USD_L1M).iborIndexCurve(USD_LIBOR_3M, GROUP1_USD_L3M).iborIndexCurve(USD_LIBOR_6M, GROUP1_USD_L6M).build());
 }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Provides rates for USD and EUR Discounting, Libor 3 month and Euribor 3M.
 /// </summary>
 /// <returns> the rates provider </returns>
 public static ImmutableRatesProvider providerUsdEurDscL3()
 {
     // data from group 2
     return(ImmutableRatesProvider.builder(VAL_DATE_2014_01_22).fxRateProvider(FX_MATRIX_EUR_USD).discountCurve(EUR, GROUP2_EUR_DSC).discountCurve(USD, GROUP2_USD_DSC).overnightIndexCurve(EUR_EONIA, GROUP2_EUR_ON).iborIndexCurve(EUR_EURIBOR_3M, GROUP2_EUR_L3M).overnightIndexCurve(USD_FED_FUND, GROUP2_USD_ON).iborIndexCurve(USD_LIBOR_3M, GROUP2_USD_L3M).build());
 }