// market quote bucketed PV01 for one scenario internal CurrencyParameterSensitivities pv01RatesMarketQuoteBucketed(ResolvedIborCapFloorTrade trade, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) { PointSensitivities pointSensitivity = this.pointSensitivity(trade, ratesProvider, volatilities); CurrencyParameterSensitivities parameterSensitivity = ratesProvider.parameterSensitivity(pointSensitivity); return(MARKET_QUOTE_SENS.sensitivity(parameterSensitivity, ratesProvider).multipliedBy(ONE_BASIS_POINT)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the present value of the Ibor cap/floor trade. /// <para> /// The present value of the trade is the value on the valuation date. /// </para> /// <para> /// The cap/floor leg and pay leg are typically in the same currency, thus the /// present value gamma is expressed as a single currency amount in most cases. /// /// </para> /// </summary> /// <param name="trade"> the Ibor cap/floor trade </param> /// <param name="ratesProvider"> the rates provider </param> /// <param name="volatilities"> the volatilities </param> /// <returns> the present value </returns> public virtual MultiCurrencyAmount presentValue(ResolvedIborCapFloorTrade trade, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) { MultiCurrencyAmount pvProduct = productPricer.presentValue(trade.Product, ratesProvider, volatilities); if (!trade.Premium.Present) { return(pvProduct); } CurrencyAmount pvPremium = paymentPricer.presentValue(trade.Premium.get(), ratesProvider); return(pvProduct.plus(pvPremium)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the present value rates sensitivity of the Ibor cap/floor trade. /// <para> /// The present value rates sensitivity of the trade is the sensitivity /// of the present value to the underlying curves. /// /// </para> /// </summary> /// <param name="trade"> the Ibor cap/floor trade </param> /// <param name="ratesProvider"> the rates provider </param> /// <param name="volatilities"> the volatilities </param> /// <returns> the present value sensitivity </returns> public virtual PointSensitivities presentValueSensitivityRates(ResolvedIborCapFloorTrade trade, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) { PointSensitivityBuilder pvSensiProduct = productPricer.presentValueSensitivityRates(trade.Product, ratesProvider, volatilities); if (!trade.Premium.Present) { return(pvSensiProduct.build()); } PointSensitivityBuilder pvSensiPremium = paymentPricer.presentValueSensitivity(trade.Premium.get(), ratesProvider); return(pvSensiProduct.combinedWith(pvSensiPremium).build()); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the current cash of the Ibor cap/floor trade. /// </summary> /// <param name="trade"> the Ibor cap/floor trade </param> /// <param name="ratesProvider"> the rates provider </param> /// <param name="volatilities"> the volatilities </param> /// <returns> the current cash </returns> public virtual MultiCurrencyAmount currentCash(ResolvedIborCapFloorTrade trade, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) { MultiCurrencyAmount ccProduct = productPricer.currentCash(trade.Product, ratesProvider, volatilities); if (!trade.Premium.Present) { return(ccProduct); } Payment premium = trade.Premium.get(); if (premium.Date.Equals(ratesProvider.ValuationDate)) { ccProduct = ccProduct.plus(premium.Currency, premium.Amount); } return(ccProduct); }
// calibrated bucketed PV01 for one scenario internal CurrencyParameterSensitivities pv01RatesCalibratedBucketed(ResolvedIborCapFloorTrade trade, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) { PointSensitivities pointSensitivity = this.pointSensitivity(trade, ratesProvider, volatilities); return(ratesProvider.parameterSensitivity(pointSensitivity).multipliedBy(ONE_BASIS_POINT)); }
//------------------------------------------------------------------------- // calculates calibrated bucketed PV01 for all scenarios internal ScenarioArray <CurrencyParameterSensitivities> pv01RatesCalibratedBucketed(ResolvedIborCapFloorTrade trade, RatesScenarioMarketData ratesMarketData, IborCapFloorScenarioMarketData capFloorMarketData) { IborIndex index = trade.Product.CapFloorLeg.Index; return(ScenarioArray.of(ratesMarketData.ScenarioCount, i => pv01RatesCalibratedBucketed(trade, ratesMarketData.scenario(i).ratesProvider(), capFloorMarketData.scenario(i).volatilities(index)))); }
//------------------------------------------------------------------------- // calculates calibrated sum PV01 for all scenarios internal MultiCurrencyScenarioArray pv01RatesCalibratedSum(ResolvedIborCapFloorTrade trade, RatesScenarioMarketData ratesMarketData, IborCapFloorScenarioMarketData capFloorMarketData) { IborIndex index = trade.Product.CapFloorLeg.Index; return(MultiCurrencyScenarioArray.of(ratesMarketData.ScenarioCount, i => pv01RatesCalibratedSum(trade, ratesMarketData.scenario(i).ratesProvider(), capFloorMarketData.scenario(i).volatilities(index)))); }
// present value for one scenario internal MultiCurrencyAmount presentValue(ResolvedIborCapFloorTrade trade, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) { return(tradePricer.presentValue(trade, ratesProvider, volatilities)); }
// point sensitivity private PointSensitivities pointSensitivity(ResolvedIborCapFloorTrade trade, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) { return(tradePricer.presentValueSensitivityRates(trade, ratesProvider, volatilities)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the present value volatility sensitivity of the Ibor cap/floor product. /// <para> /// The present value volatility sensitivity of the product is the sensitivity /// of the present value to the volatility values. /// /// </para> /// </summary> /// <param name="trade"> the Ibor cap/floor trade </param> /// <param name="ratesProvider"> the rates provider </param> /// <param name="volatilities"> the volatilities </param> /// <returns> the present value sensitivity </returns> public virtual PointSensitivityBuilder presentValueSensitivityModelParamsVolatility(ResolvedIborCapFloorTrade trade, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) { return(productPricer.presentValueSensitivityModelParamsVolatility(trade.Product, ratesProvider, volatilities)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates present value sensitivity across one or more scenarios. /// <para> /// This is the sensitivity of present value to a one basis point shift in the calibrated curves. /// The result is the sum of the sensitivities of all affected curves. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="ratesLookup"> the lookup used to query the market data </param> /// <param name="capFloorLookup"> the lookup used to query the cap/floor market data </param> /// <param name="marketData"> the market data </param> /// <returns> the present value sensitivity, one entry per scenario </returns> public virtual MultiCurrencyScenarioArray pv01RatesCalibratedSum(ResolvedIborCapFloorTrade trade, RatesMarketDataLookup ratesLookup, IborCapFloorMarketDataLookup capFloorLookup, ScenarioMarketData marketData) { return(calc.pv01RatesCalibratedSum(trade, ratesLookup.marketDataView(marketData), capFloorLookup.marketDataView(marketData))); }
/// <summary> /// Calculates present value for a single set of market data. /// </summary> /// <param name="trade"> the trade </param> /// <param name="ratesProvider"> the market data </param> /// <param name="volatilities"> the cap/floor volatilities </param> /// <returns> the present value </returns> public virtual MultiCurrencyAmount presentValue(ResolvedIborCapFloorTrade trade, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) { return(calc.presentValue(trade, ratesProvider, volatilities)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates currency exposure across one or more scenarios. /// <para> /// The currency risk, expressed as the equivalent amount in each currency. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="ratesLookup"> the lookup used to query the market data </param> /// <param name="capFloorLookup"> the lookup used to query the cap/floor market data </param> /// <param name="marketData"> the market data </param> /// <returns> the currency exposure, one entry per scenario </returns> public virtual MultiCurrencyScenarioArray currencyExposure(ResolvedIborCapFloorTrade trade, RatesMarketDataLookup ratesLookup, IborCapFloorMarketDataLookup capFloorLookup, ScenarioMarketData marketData) { return(calc.currencyExposure(trade, ratesLookup.marketDataView(marketData), capFloorLookup.marketDataView(marketData))); }
/// <summary> /// Calculates present value sensitivity for a single set of market data. /// <para> /// This is the sensitivity of present value to a one basis point shift in /// the market quotes used to calibrate the curves. /// The result is provided for each affected curve and currency, bucketed by curve node. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="ratesProvider"> the market data </param> /// <param name="volatilities"> the cap/floor volatilities </param> /// <returns> the present value sensitivity </returns> public virtual CurrencyParameterSensitivities pv01RatesMarketQuoteBucketed(ResolvedIborCapFloorTrade trade, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) { return(calc.pv01RatesMarketQuoteBucketed(trade, ratesProvider, volatilities)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates present value sensitivity across one or more scenarios. /// <para> /// This is the sensitivity of present value to a one basis point shift in /// the market quotes used to calibrate the curves. /// The result is provided for each affected curve and currency, bucketed by curve node. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="ratesLookup"> the lookup used to query the market data </param> /// <param name="marketData"> the market data </param> /// <param name="capFloorLookup"> the lookup used to query the cap/floor market data </param> /// <returns> the present value sensitivity, one entry per scenario </returns> public virtual ScenarioArray <CurrencyParameterSensitivities> pv01RatesMarketQuoteBucketed(ResolvedIborCapFloorTrade trade, RatesMarketDataLookup ratesLookup, IborCapFloorMarketDataLookup capFloorLookup, ScenarioMarketData marketData) { return(calc.pv01RatesMarketQuoteBucketed(trade, ratesLookup.marketDataView(marketData), capFloorLookup.marketDataView(marketData))); }
/// <summary> /// Calculates present value sensitivity for a single set of market data. /// <para> /// This is the sensitivity of present value to a one basis point shift in /// the market quotes used to calibrate the curves. /// The result is the sum of the sensitivities of all affected curves. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="ratesProvider"> the market data </param> /// <param name="volatilities"> the cap/floor volatilities </param> /// <returns> the present value sensitivity </returns> public virtual MultiCurrencyAmount pv01RatesMarketQuoteSum(ResolvedIborCapFloorTrade trade, RatesProvider ratesProvider, IborCapletFloorletVolatilities volatilities) { return(calc.pv01RatesMarketQuoteSum(trade, ratesProvider, volatilities)); }