//------------------------------------------------------------------------- public virtual void test_marketDataView() { SwaptionMarketDataLookup test = SwaptionMarketDataLookup.of(USD_LIBOR_3M, VOL_ID1); LocalDate valDate = date(2015, 6, 30); ScenarioMarketData md = new TestMarketDataMap(valDate, ImmutableMap.of(), ImmutableMap.of()); SwaptionScenarioMarketData multiScenario = test.marketDataView(md); assertEquals(multiScenario.Lookup, test); assertEquals(multiScenario.MarketData, md); assertEquals(multiScenario.ScenarioCount, 1); SwaptionMarketData scenario = multiScenario.scenario(0); assertEquals(scenario.Lookup, test); assertEquals(scenario.MarketData, md.scenario(0)); assertEquals(scenario.ValuationDate, valDate); }
//------------------------------------------------------------------------- // calculates calibrated sum PV01 for all scenarios internal MultiCurrencyScenarioArray pv01RatesCalibratedSum(ResolvedSwaptionTrade trade, RatesScenarioMarketData ratesMarketData, SwaptionScenarioMarketData swaptionMarketData) { IborIndex index = trade.Product.Index; return(MultiCurrencyScenarioArray.of(ratesMarketData.ScenarioCount, i => pv01RatesCalibratedSum(trade, ratesMarketData.scenario(i).ratesProvider(), swaptionMarketData.scenario(i).volatilities(index)))); }
//------------------------------------------------------------------------- // calculates present value for all scenarios internal CurrencyScenarioArray presentValue(ResolvedSwaptionTrade trade, RatesScenarioMarketData ratesMarketData, SwaptionScenarioMarketData swaptionMarketData) { IborIndex index = trade.Product.Index; return(CurrencyScenarioArray.of(ratesMarketData.ScenarioCount, i => presentValue(trade, ratesMarketData.scenario(i).ratesProvider(), swaptionMarketData.scenario(i).volatilities(index)))); }
//------------------------------------------------------------------------- // calculates market quote bucketed PV01 for all scenarios internal ScenarioArray <CurrencyParameterSensitivities> pv01RatesMarketQuoteBucketed(ResolvedSwaptionTrade trade, RatesScenarioMarketData ratesMarketData, SwaptionScenarioMarketData swaptionMarketData) { IborIndex index = trade.Product.Index; return(ScenarioArray.of(ratesMarketData.ScenarioCount, i => pv01RatesMarketQuoteBucketed(trade, ratesMarketData.scenario(i).ratesProvider(), swaptionMarketData.scenario(i).volatilities(index)))); }