Ejemplo n.º 1
0
        public virtual void test_pv01()
        {
            ScenarioMarketData md       = TermDepositTradeCalculationFunctionTest.marketData();
            RatesProvider      provider = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider();
            DiscountingTermDepositTradePricer pricer               = DiscountingTermDepositTradePricer.DEFAULT;
            PointSensitivities             pvPointSens             = pricer.presentValueSensitivity(RTRADE, provider);
            CurrencyParameterSensitivities pvParamSens             = provider.parameterSensitivity(pvPointSens);
            MultiCurrencyAmount            expectedPv01Cal         = pvParamSens.total().multipliedBy(1e-4);
            CurrencyParameterSensitivities expectedPv01CalBucketed = pvParamSens.multipliedBy(1e-4);

            assertEquals(TermDepositTradeCalculations.DEFAULT.pv01CalibratedSum(RTRADE, RATES_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedPv01Cal)));
            assertEquals(TermDepositTradeCalculations.DEFAULT.pv01CalibratedBucketed(RTRADE, RATES_LOOKUP, md), ScenarioArray.of(ImmutableList.of(expectedPv01CalBucketed)));
        }
Ejemplo n.º 2
0
        //-------------------------------------------------------------------------
        public virtual void test_presentValue()
        {
            ScenarioMarketData md       = TermDepositTradeCalculationFunctionTest.marketData();
            RatesProvider      provider = RATES_LOOKUP.marketDataView(md.scenario(0)).ratesProvider();
            DiscountingTermDepositTradePricer pricer     = DiscountingTermDepositTradePricer.DEFAULT;
            CurrencyAmount      expectedPv               = pricer.presentValue(RTRADE, provider);
            double              expectedParRate          = pricer.parRate(RTRADE, provider);
            double              expectedParSpread        = pricer.parSpread(RTRADE, provider);
            MultiCurrencyAmount expectedCurrencyExposure = pricer.currencyExposure(RTRADE, provider);
            CurrencyAmount      expectedCurrentCash      = pricer.currentCash(RTRADE, provider);

            assertEquals(TermDepositTradeCalculations.DEFAULT.presentValue(RTRADE, RATES_LOOKUP, md), CurrencyScenarioArray.of(ImmutableList.of(expectedPv)));
            assertEquals(TermDepositTradeCalculations.DEFAULT.parRate(RTRADE, RATES_LOOKUP, md), DoubleScenarioArray.of(ImmutableList.of(expectedParRate)));
            assertEquals(TermDepositTradeCalculations.DEFAULT.parSpread(RTRADE, RATES_LOOKUP, md), DoubleScenarioArray.of(ImmutableList.of(expectedParSpread)));
            assertEquals(TermDepositTradeCalculations.DEFAULT.currencyExposure(RTRADE, RATES_LOOKUP, md), MultiCurrencyScenarioArray.of(ImmutableList.of(expectedCurrencyExposure)));
            assertEquals(TermDepositTradeCalculations.DEFAULT.currentCash(RTRADE, RATES_LOOKUP, md), CurrencyScenarioArray.of(ImmutableList.of(expectedCurrentCash)));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates an instance.
 /// </summary>
 /// <param name="tradePricer">  the pricer for <seealso cref="ResolvedTermDepositTrade"/> </param>
 internal TermDepositMeasureCalculations(DiscountingTermDepositTradePricer tradePricer)
 {
     this.tradePricer = ArgChecker.notNull(tradePricer, "tradePricer");
 }
 /// <summary>
 /// Creates an instance.
 /// <para>
 /// In most cases, applications should use the <seealso cref="#DEFAULT"/> instance.
 ///
 /// </para>
 /// </summary>
 /// <param name="tradePricer">  the pricer for <seealso cref="ResolvedTermDepositTrade"/> </param>
 public TermDepositTradeCalculations(DiscountingTermDepositTradePricer tradePricer)
 {
     this.calc = new TermDepositMeasureCalculations(tradePricer);
 }