Class CashFlowEquivalentCalculator
- java.lang.Object
-
- com.opengamma.strata.pricer.impl.rate.swap.CashFlowEquivalentCalculator
-
public final class CashFlowEquivalentCalculator extends Object
Computes cash flow equivalent of products.Reference: Henrard, M. The Irony in the derivatives discounting Part II: the crisis. Wilmott Journal, 2010, 2, 301-316.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ImmutableMap<Payment,PointSensitivityBuilder>
cashFlowEquivalentAndSensitivityFixedLeg(ResolvedSwapLeg fixedLeg, RatesProvider ratesProvider)
Computes cash flow equivalent and sensitivity of fixed leg.static ImmutableMap<Payment,PointSensitivityBuilder>
cashFlowEquivalentAndSensitivityIborLeg(ResolvedSwapLeg iborLeg, RatesProvider ratesProvider)
Computes cash flow equivalent and sensitivity of Ibor leg.static ImmutableMap<Payment,PointSensitivityBuilder>
cashFlowEquivalentAndSensitivityOnLeg(ResolvedSwapLeg onLeg, RatesProvider multicurve)
Computes cash flow equivalent of and sensitivity overnight leg.static ImmutableMap<Payment,PointSensitivityBuilder>
cashFlowEquivalentAndSensitivitySwap(ResolvedSwap swap, RatesProvider ratesProvider)
Computes cash flow equivalent and sensitivity of swap.static ResolvedSwapLeg
cashFlowEquivalentFixedLeg(ResolvedSwapLeg fixedLeg, RatesProvider ratesProvider)
Computes cash flow equivalent of fixed leg.static ResolvedSwapLeg
cashFlowEquivalentIborLeg(ResolvedSwapLeg iborLeg, RatesProvider ratesProvider)
Computes cash flow equivalent of Ibor leg.static ResolvedSwapLeg
cashFlowEquivalentOnLeg(ResolvedSwapLeg onLeg, RatesProvider multicurve)
Computes cash flow equivalent of overnight leg.static ResolvedSwapLeg
cashFlowEquivalentSwap(ResolvedSwap swap, RatesProvider ratesProvider)
Computes cash flow equivalent of swap.static List<Payment>
normalize(ResolvedSwapLeg input)
Extract the payments from theNotionalExchange
in the SwapLeg.static List<Payment>
normalize(List<Payment> input)
Generate a new payment list with the dates sorted and the amounts of elements with same payment date compressed.static Map<Payment,PointSensitivityBuilder>
normalize(Map<Payment,PointSensitivityBuilder> input)
Generate a new map with each payment date unique and the amounts and sensitivities of elements with same payment date compressed.
-
-
-
Method Detail
-
cashFlowEquivalentSwap
public static ResolvedSwapLeg cashFlowEquivalentSwap(ResolvedSwap swap, RatesProvider ratesProvider)
Computes cash flow equivalent of swap.The swap should be a fix-for-Ibor swap without compounding, and its swap legs should not involve
PaymentEvent
.The return type is
ResolvedSwapLeg
in which individual payments are represented in terms ofNotionalExchange
.- Parameters:
swap
- the swap productratesProvider
- the rates provider- Returns:
- the cash flow equivalent
-
cashFlowEquivalentIborLeg
public static ResolvedSwapLeg cashFlowEquivalentIborLeg(ResolvedSwapLeg iborLeg, RatesProvider ratesProvider)
Computes cash flow equivalent of Ibor leg.The return type is
ResolvedSwapLeg
in which individual payments are represented in terms ofNotionalExchange
.- Parameters:
iborLeg
- the Ibor legratesProvider
- the rates provider- Returns:
- the cash flow equivalent
-
cashFlowEquivalentFixedLeg
public static ResolvedSwapLeg cashFlowEquivalentFixedLeg(ResolvedSwapLeg fixedLeg, RatesProvider ratesProvider)
Computes cash flow equivalent of fixed leg.The return type is
ResolvedSwapLeg
in which individual payments are represented in terms ofNotionalExchange
.- Parameters:
fixedLeg
- the fixed legratesProvider
- the rates provider- Returns:
- the cash flow equivalent
-
cashFlowEquivalentOnLeg
public static ResolvedSwapLeg cashFlowEquivalentOnLeg(ResolvedSwapLeg onLeg, RatesProvider multicurve)
Computes cash flow equivalent of overnight leg.Each payment period should contain one accrual period of type
OvernightCompoundedRateComputation
. When the payment date is not equal to the end composition date, the start and end cashflow equivalent are adjusted by the ratio of discount factors between the payment date and the end date.The return type is
ResolvedSwapLeg
in which individual payments are represented in terms ofNotionalExchange
.- Parameters:
onLeg
- the overnight legmulticurve
- the multi-curve rates provider- Returns:
- the cash flow equivalent
-
cashFlowEquivalentAndSensitivitySwap
public static ImmutableMap<Payment,PointSensitivityBuilder> cashFlowEquivalentAndSensitivitySwap(ResolvedSwap swap, RatesProvider ratesProvider)
Computes cash flow equivalent and sensitivity of swap.The swap should be a fix-for-Ibor swap without compounding, and its swap legs should not involve
PaymentEvent
.The return type is a map of
NotionalExchange
andPointSensitivityBuilder
.- Parameters:
swap
- the swap productratesProvider
- the rates provider- Returns:
- the cash flow equivalent and sensitivity
-
cashFlowEquivalentAndSensitivityIborLeg
public static ImmutableMap<Payment,PointSensitivityBuilder> cashFlowEquivalentAndSensitivityIborLeg(ResolvedSwapLeg iborLeg, RatesProvider ratesProvider)
Computes cash flow equivalent and sensitivity of Ibor leg.The return type is a map of
NotionalExchange
andPointSensitivityBuilder
.- Parameters:
iborLeg
- the Ibor legratesProvider
- the rates provider- Returns:
- the cash flow equivalent and sensitivity
-
cashFlowEquivalentAndSensitivityFixedLeg
public static ImmutableMap<Payment,PointSensitivityBuilder> cashFlowEquivalentAndSensitivityFixedLeg(ResolvedSwapLeg fixedLeg, RatesProvider ratesProvider)
Computes cash flow equivalent and sensitivity of fixed leg.The return type is a map of
NotionalExchange
andPointSensitivityBuilder
.- Parameters:
fixedLeg
- the fixed legratesProvider
- the rates provider- Returns:
- the cash flow equivalent and sensitivity
-
cashFlowEquivalentAndSensitivityOnLeg
public static ImmutableMap<Payment,PointSensitivityBuilder> cashFlowEquivalentAndSensitivityOnLeg(ResolvedSwapLeg onLeg, RatesProvider multicurve)
Computes cash flow equivalent of and sensitivity overnight leg.Each payment period should contain one accrual period of type
OvernightCompoundedRateComputation
. When the payment date is not equal to the end composition date, the start and end cashflow equivalent are adjusted by the ratio of discount factors between the payment date and the end date.The return type is a map of
NotionalExchange
andPointSensitivityBuilder
.- Parameters:
onLeg
- the overnight legmulticurve
- the multi-curve rates provider- Returns:
- the cash flow equivalent
-
normalize
public static List<Payment> normalize(ResolvedSwapLeg input)
Extract the payments from theNotionalExchange
in the SwapLeg. Generate a list with the dates sorted and the amounts of elements with same payment date compressed.The original SwapLeg is unchanged.
- Parameters:
input
- the starting swap leg- Returns:
- the normalized list
-
normalize
public static List<Payment> normalize(List<Payment> input)
Generate a new payment list with the dates sorted and the amounts of elements with same payment date compressed.The original list is unchanged.
- Parameters:
input
- the starting list- Returns:
- the normalized list
-
normalize
public static Map<Payment,PointSensitivityBuilder> normalize(Map<Payment,PointSensitivityBuilder> input)
Generate a new map with each payment date unique and the amounts and sensitivities of elements with same payment date compressed.The original map is unchanged.
- Parameters:
input
- the starting map- Returns:
- the normalized map
-
-