public class DiscountingSwapProductPricer extends Object
This function provides the ability to price a ResolvedSwap
.
The product is priced by pricing each leg.
Modifier and Type | Field and Description |
---|---|
static DiscountingSwapProductPricer |
DEFAULT
Default implementation.
|
Constructor and Description |
---|
DiscountingSwapProductPricer(DiscountingSwapLegPricer legPricer)
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
MultiCurrencyAmount |
accruedInterest(ResolvedSwap swap,
RatesProvider provider)
Calculates the accrued interest since the last payment.
|
CashFlows |
cashFlows(ResolvedSwap swap,
RatesProvider provider)
Calculates the future cash flows of the swap product.
|
MultiCurrencyAmount |
currencyExposure(ResolvedSwap swap,
RatesProvider provider)
Calculates the currency exposure of the swap product.
|
MultiCurrencyAmount |
currentCash(ResolvedSwap swap,
RatesProvider provider)
Calculates the current cash of the swap product.
|
ExplainMap |
explainPresentValue(ResolvedSwap swap,
RatesProvider provider)
Explains the present value of the swap product.
|
MultiCurrencyAmount |
forecastValue(ResolvedSwap swap,
RatesProvider provider)
Calculates the forecast value of the swap product.
|
PointSensitivityBuilder |
forecastValueSensitivity(ResolvedSwap swap,
RatesProvider provider)
Calculates the forecast value sensitivity of the swap product.
|
DiscountingSwapLegPricer |
getLegPricer()
Gets the underlying leg pricer.
|
double |
marketQuote(ResolvedSwap swap,
RatesProvider provider)
Computes the market quote of swaps.
|
PointSensitivityBuilder |
marketQuoteSensitivity(ResolvedSwap swap,
RatesProvider provider)
Computes the market quote curve sensitivity for swaps.
|
double |
parRate(ResolvedSwap swap,
RatesProvider provider)
Computes the par rate for swaps with a fixed leg.
|
PointSensitivityBuilder |
parRateSensitivity(ResolvedSwap swap,
RatesProvider provider)
Calculates the par rate curve sensitivity for a swap with a fixed leg.
|
double |
parSpread(ResolvedSwap swap,
RatesProvider provider)
Computes the par spread for swaps.
|
PointSensitivityBuilder |
parSpreadSensitivity(ResolvedSwap swap,
RatesProvider provider)
Calculates the par spread curve sensitivity for a swap.
|
CurrencyAmount |
presentValue(ResolvedSwap swap,
Currency currency,
RatesProvider provider)
Calculates the present value of the swap product, converted to the specified currency.
|
MultiCurrencyAmount |
presentValue(ResolvedSwap swap,
RatesProvider provider)
Calculates the present value of the swap product.
|
PointSensitivityBuilder |
presentValueSensitivity(ResolvedSwap swap,
Currency currency,
RatesProvider provider)
Calculates the present value sensitivity of the swap product converted in a given currency.
|
PointSensitivityBuilder |
presentValueSensitivity(ResolvedSwap swap,
RatesProvider provider)
Calculates the present value sensitivity of the swap product.
|
public static final DiscountingSwapProductPricer DEFAULT
public DiscountingSwapProductPricer(DiscountingSwapLegPricer legPricer)
legPricer
- the pricer for ResolvedSwapLeg
public DiscountingSwapLegPricer getLegPricer()
public CurrencyAmount presentValue(ResolvedSwap swap, Currency currency, RatesProvider provider)
The present value of the product is the value on the valuation date. This is the discounted forecast value. The result is converted to the specified currency.
swap
- the productcurrency
- the currency to convert toprovider
- the rates providerpublic MultiCurrencyAmount presentValue(ResolvedSwap swap, RatesProvider provider)
The present value of the product is the value on the valuation date. This is the discounted forecast value. The result is expressed using the payment currency of each leg.
swap
- the productprovider
- the rates providerpublic MultiCurrencyAmount forecastValue(ResolvedSwap swap, RatesProvider provider)
The forecast value of the product is the value on the valuation date without present value discounting. The result is expressed using the payment currency of each leg.
swap
- the productprovider
- the rates providerpublic MultiCurrencyAmount accruedInterest(ResolvedSwap swap, RatesProvider provider)
This determines the payment period applicable at the valuation date and calculates the accrued interest since the last payment.
swap
- the productprovider
- the rates providerpublic double parRate(ResolvedSwap swap, RatesProvider provider)
The par rate is the common rate on all payments of the fixed leg for which the total swap present value is 0.
At least one leg must be a fixed leg. The par rate will be computed with respect to the first fixed leg in which all the payments are fixed payments with a unique accrual period (no compounding) and no FX reset. If the fixed leg is compounding, the par rate is computed only when the number of fixed coupon payments is 1 and accrual factor of each sub-period is 1
swap
- the productprovider
- the rates providerIllegalArgumentException
- if there is no fixed legpublic double marketQuote(ResolvedSwap swap, RatesProvider provider)
For swaps with a fixed leg, this is equal to the par rate. For swaps without a fixed leg, this is the constant spread on the first leg required to have a PV of 0.
All the payment periods of the first leg must be of the type RatePaymentPeriod
.
swap
- the productprovider
- the rates providerIllegalArgumentException
- if there is no fixed leg and not all the payment periods of the first leg
are of the type RatePaymentPeriodpublic double parSpread(ResolvedSwap swap, RatesProvider provider)
The par spread is the common spread on all payments of the first leg for which the total swap present value is 0.
The par spread will be computed with respect to the first leg. For that leg, all the payments have a unique accrual period or multiple accrual periods with Flat compounding and no FX reset.
swap
- the productprovider
- the rates providerpublic PointSensitivityBuilder presentValueSensitivity(ResolvedSwap swap, RatesProvider provider)
The present value sensitivity of the product is the sensitivity of the present value to the underlying curves.
swap
- the productprovider
- the rates providerpublic PointSensitivityBuilder presentValueSensitivity(ResolvedSwap swap, Currency currency, RatesProvider provider)
The present value sensitivity of the product is the sensitivity of the present value to the underlying curves.
swap
- the productcurrency
- the currency to convert toprovider
- the rates providerpublic PointSensitivityBuilder forecastValueSensitivity(ResolvedSwap swap, RatesProvider provider)
The forecast value sensitivity of the product is the sensitivity of the forecast value to the underlying curves.
swap
- the productprovider
- the rates providerpublic PointSensitivityBuilder parRateSensitivity(ResolvedSwap swap, RatesProvider provider)
The par rate is the common rate on all payments of the fixed leg for which the total swap present value is 0.
At least one leg must be a fixed leg. The par rate will be computed with respect to the first fixed leg. All the payments in that leg should be fixed payments with a unique accrual period (no compounding) and no FX reset.
swap
- the productprovider
- the rates providerIllegalArgumentException
- if there is no fixed legpublic PointSensitivityBuilder marketQuoteSensitivity(ResolvedSwap swap, RatesProvider provider)
For swaps with a fixed leg, this is equal to the par rate. For swaps without a fixed leg, this is the constant spread on the first leg required to have a PV of 0.
All the payment periods of the first leg must be of the type RatePaymentPeriod
.
The figures are reported in the currency of the first leg, even if in theory they should be dimensionless.
swap
- the productprovider
- the rates providerIllegalArgumentException
- if there is no fixed leg and not all the payment periods of the first leg
are of the type RatePaymentPeriodpublic PointSensitivityBuilder parSpreadSensitivity(ResolvedSwap swap, RatesProvider provider)
The par spread is the common spread on all payments of the first leg for which the total swap present value is 0.
The par spread is computed with respect to the first leg. For that leg, all the payments have a unique accrual period (no compounding) and no FX reset.
swap
- the productprovider
- the rates providerpublic CashFlows cashFlows(ResolvedSwap swap, RatesProvider provider)
Each expected cash flow is added to the result.
This is based on forecastValue(ResolvedSwap, RatesProvider)
.
swap
- the productprovider
- the rates providerpublic ExplainMap explainPresentValue(ResolvedSwap swap, RatesProvider provider)
This returns explanatory information about the calculation.
swap
- the productprovider
- the rates providerpublic MultiCurrencyAmount currencyExposure(ResolvedSwap swap, RatesProvider provider)
swap
- the productprovider
- the rates providerpublic MultiCurrencyAmount currentCash(ResolvedSwap swap, RatesProvider provider)
swap
- the productprovider
- the rates providerCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.