/// <summary> /// Calculates the forecast value sensitivity of the swap trade. /// <para> /// The forecast value sensitivity of the trade is the sensitivity of the forecast value to /// the underlying curves. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="provider"> the rates provider </param> /// <returns> the forecast value curve sensitivity of the swap trade </returns> public virtual PointSensitivities forecastValueSensitivity(ResolvedSwapTrade trade, RatesProvider provider) { return(productPricer.forecastValueSensitivity(trade.Product, provider).build()); }
//------------------------------------------------------------------------- /// <summary> /// Calculates par spread across one or more scenarios. /// </summary> /// <param name="trade"> the trade </param> /// <param name="lookup"> the lookup used to query the market data </param> /// <param name="marketData"> the market data </param> /// <returns> the par spread, one entry per scenario </returns> public virtual DoubleScenarioArray parSpread(ResolvedSwapTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData) { return(calc.parSpread(trade, lookup.marketDataView(marketData))); }
/// <summary> /// Calculates current cash for a single set of market data. /// <para> /// The sum of all cash flows paid on the valuation date. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="ratesProvider"> the market data </param> /// <returns> the current cash </returns> public virtual MultiCurrencyAmount currentCash(ResolvedSwapTrade trade, RatesProvider ratesProvider) { return(calc.currentCash(trade, ratesProvider)); }
/// <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> /// <returns> the present value </returns> public virtual MultiCurrencyAmount presentValue(ResolvedSwapTrade trade, RatesProvider ratesProvider) { return(calc.presentValue(trade, ratesProvider)); }
/// <summary> /// Calculates accrued interest for a single set of market data. /// <para> /// The accrued interest since the last payment. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="ratesProvider"> the market data </param> /// <returns> the accrued interest </returns> public virtual MultiCurrencyAmount accruedInterest(ResolvedSwapTrade trade, RatesProvider ratesProvider) { return(calc.accruedInterest(trade, ratesProvider)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the present value of each leg across one or more scenarios. /// </summary> /// <param name="trade"> the trade </param> /// <param name="lookup"> the lookup used to query the market data </param> /// <param name="marketData"> the market data </param> /// <returns> the present value of each leg, one entry per scenario </returns> public virtual ScenarioArray <LegAmounts> legPresentValue(ResolvedSwapTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData) { return(calc.legPresentValue(trade, lookup.marketDataView(marketData))); }
/// <summary> /// Calculates the present value of the swap trade. /// <para> /// The present value of the trade is the value on the valuation date. /// This is the discounted forecast value. /// The result is expressed using the payment currency of each leg. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="provider"> the rates provider </param> /// <returns> the present value of the swap trade </returns> public virtual MultiCurrencyAmount presentValue(ResolvedSwapTrade trade, RatesProvider provider) { return(productPricer.presentValue(trade.Product, provider)); }
/// <summary> /// Calculates cash flows for a single set of market data. /// <para> /// The cash flows provide details about the payments of the trade. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="ratesProvider"> the market data </param> /// <returns> the cash flows </returns> public virtual CashFlows cashFlows(ResolvedSwapTrade trade, RatesProvider ratesProvider) { return(calc.cashFlows(trade, ratesProvider)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the accrued interest since the last payment. /// <para> /// This determines the payment period applicable at the valuation date and calculates /// the accrued interest since the last payment. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="provider"> the rates provider </param> /// <returns> the accrued interest </returns> public virtual MultiCurrencyAmount accruedInterest(ResolvedSwapTrade trade, RatesProvider provider) { return(productPricer.accruedInterest(trade.Product, provider)); }
/// <summary> /// Calculates the current cash of the swap trade. /// </summary> /// <param name="trade"> the trade </param> /// <param name="provider"> the rates provider </param> /// <returns> the current cash of the swap trade </returns> public virtual MultiCurrencyAmount currentCash(ResolvedSwapTrade trade, RatesProvider provider) { return(productPricer.currentCash(trade.Product, provider)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the future cash flows of the swap trade. /// <para> /// Each expected cash flow is added to the result. /// This is based on <seealso cref="#forecastValue(ResolvedSwapTrade, RatesProvider)"/>. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="provider"> the rates provider </param> /// <returns> the cash flows </returns> public virtual CashFlows cashFlows(ResolvedSwapTrade trade, RatesProvider provider) { return(productPricer.cashFlows(trade.Product, provider)); }
/// <summary> /// Calculates the par spread curve sensitivity of the swap trade. /// <para> /// The par spread curve sensitivity of the product is the sensitivity of the par spread to /// the underlying curves. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="provider"> the rates provider </param> /// <returns> the par spread sensitivity </returns> public virtual PointSensitivities parSpreadSensitivity(ResolvedSwapTrade trade, RatesProvider provider) { return(productPricer.parSpreadSensitivity(trade.Product, provider).build()); }
/// <summary> /// Calculates the par spread of the swap trade. /// <para> /// This is spread to be added to the fixed rate to have a present value of 0. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="provider"> the rates provider </param> /// <returns> the par spread </returns> public virtual double parSpread(ResolvedSwapTrade trade, RatesProvider provider) { return(productPricer.parSpread(trade.Product, provider)); }
/// <summary> /// Calculates par spread for a single set of market data. /// </summary> /// <param name="trade"> the trade </param> /// <param name="ratesProvider"> the market data </param> /// <returns> the par spread </returns> public virtual double parSpread(ResolvedSwapTrade trade, RatesProvider ratesProvider) { return(calc.parSpread(trade, ratesProvider)); }
public virtual void test_legInitialNotionalWithoutNotional() { ResolvedSwapTrade trade = ResolvedSwapTrade.builder().product(ResolvedSwap.of(KNOWN_AMOUNT_SWAP_LEG, KNOWN_AMOUNT_SWAP_LEG)).build(); assertThrowsIllegalArg(() => SwapMeasureCalculations.DEFAULT.legInitialNotional(trade)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates cash flows across one or more scenarios. /// <para> /// The cash flows provide details about the payments of the trade. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="lookup"> the lookup used to query the market data </param> /// <param name="marketData"> the market data </param> /// <returns> the cash flows, one entry per scenario </returns> public virtual ScenarioArray <CashFlows> cashFlows(ResolvedSwapTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData) { return(calc.cashFlows(trade, lookup.marketDataView(marketData))); }
/// <summary> /// Explains the present value calculation for a single set of market data. /// <para> /// This provides a breakdown of how /// <seealso cref="#presentValue(ResolvedSwapTrade, RatesMarketDataLookup, ScenarioMarketData) present value"/> /// was calculated, typically used for debugging and validation. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="ratesProvider"> the market data </param> /// <returns> the present value explanation </returns> public virtual ExplainMap explainPresentValue(ResolvedSwapTrade trade, RatesProvider ratesProvider) { return(calc.explainPresentValue(trade, ratesProvider)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates accrued interest across one or more scenarios. /// <para> /// The accrued interest since the last payment. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="lookup"> the lookup used to query the market data </param> /// <param name="marketData"> the market data </param> /// <returns> the accrued interest, one entry per scenario </returns> public virtual MultiCurrencyScenarioArray accruedInterest(ResolvedSwapTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData) { return(calc.accruedInterest(trade, lookup.marketDataView(marketData))); }
//------------------------------------------------------------------------- /// <summary> /// Calculates present value sensitivity across one or more scenarios. /// <para> /// This is the sensitivity of /// <seealso cref="#presentValue(ResolvedSwapTrade, RatesMarketDataLookup, ScenarioMarketData) 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="lookup"> the lookup used to query the market data </param> /// <param name="marketData"> the market data </param> /// <returns> the present value sensitivity, one entry per scenario </returns> public virtual MultiCurrencyScenarioArray pv01MarketQuoteSum(ResolvedSwapTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData) { return(calc.pv01MarketQuoteSum(trade, lookup.marketDataView(marketData))); }
//------------------------------------------------------------------------- /// <summary> /// Calculates the initial notional of each leg. /// <para> /// This does not require market data. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <returns> the initial notional of each leg </returns> public virtual LegAmounts legInitialNotional(ResolvedSwapTrade trade) { return(calc.legInitialNotional(trade)); }
/// <summary> /// Calculates present value sensitivity for a single set of market data. /// <para> /// This is the sensitivity of /// <seealso cref="#presentValue(ResolvedSwapTrade, RatesMarketDataLookup, ScenarioMarketData) 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> /// <returns> the present value sensitivity </returns> public virtual MultiCurrencyAmount pv01MarketQuoteSum(ResolvedSwapTrade trade, RatesProvider ratesProvider) { return(calc.pv01MarketQuoteSum(trade, ratesProvider)); }
/// <summary> /// Calculates the present value of each leg for a single set of market data. /// </summary> /// <param name="trade"> the trade </param> /// <param name="ratesProvider"> the market data </param> /// <returns> the present value of each leg </returns> public virtual LegAmounts legPresentValue(ResolvedSwapTrade trade, RatesProvider ratesProvider) { return(calc.legPresentValue(trade, ratesProvider)); }
//------------------------------------------------------------------------- /// <summary> /// Calculates present value sensitivity across one or more scenarios. /// <para> /// This is the sensitivity of /// <seealso cref="#presentValue(ResolvedSwapTrade, RatesMarketDataLookup, ScenarioMarketData) 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="lookup"> the lookup used to query the market data </param> /// <param name="marketData"> the market data </param> /// <returns> the present value sensitivity, one entry per scenario </returns> public virtual ScenarioArray <CurrencyParameterSensitivities> pv01MarketQuoteBucketed(ResolvedSwapTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData) { return(calc.pv01MarketQuoteBucketed(trade, lookup.marketDataView(marketData))); }
//------------------------------------------------------------------------- /// <summary> /// Calculates present value across one or more scenarios. /// </summary> /// <param name="trade"> the trade </param> /// <param name="lookup"> the lookup used to query the market data </param> /// <param name="marketData"> the market data </param> /// <returns> the present value, one entry per scenario </returns> public virtual MultiCurrencyScenarioArray presentValue(ResolvedSwapTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData) { return(calc.presentValue(trade, lookup.marketDataView(marketData))); }
/// <summary> /// Calculates present value sensitivity for a single set of market data. /// <para> /// This is the sensitivity of /// <seealso cref="#presentValue(ResolvedSwapTrade, RatesMarketDataLookup, ScenarioMarketData) 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> /// <returns> the present value sensitivity </returns> public virtual CurrencyParameterSensitivities pv01MarketQuoteBucketed(ResolvedSwapTrade trade, RatesProvider ratesProvider) { return(calc.pv01MarketQuoteBucketed(trade, ratesProvider)); }
//------------------------------------------------------------------------- /// <summary> /// Explains the present value calculation across one or more scenarios. /// <para> /// This provides a breakdown of how /// <seealso cref="#presentValue(ResolvedSwapTrade, RatesMarketDataLookup, ScenarioMarketData) present value"/> /// was calculated, typically used for debugging and validation. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="lookup"> the lookup used to query the market data </param> /// <param name="marketData"> the market data </param> /// <returns> the present value explanation, one entry per scenario </returns> public virtual ScenarioArray <ExplainMap> explainPresentValue(ResolvedSwapTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData) { return(calc.explainPresentValue(trade, lookup.marketDataView(marketData))); }
/// <summary> /// Explains the present value of the swap trade. /// <para> /// This returns explanatory information about the calculation. /// /// </para> /// </summary> /// <param name="trade"> the trade </param> /// <param name="provider"> the rates provider </param> /// <returns> the explanatory information </returns> public virtual ExplainMap explainPresentValue(ResolvedSwapTrade trade, RatesProvider provider) { return(productPricer.explainPresentValue(trade.Product, provider)); }