public class DiscountingSwapLegPricer extends Object
This function provides the ability to price a ResolvedSwapLeg
.
The product is priced by pricing each period and event.
Modifier and Type | Field and Description |
---|---|
static DiscountingSwapLegPricer |
DEFAULT
Default implementation.
|
Constructor and Description |
---|
DiscountingSwapLegPricer(SwapPaymentPeriodPricer<SwapPaymentPeriod> paymentPeriodPricer,
SwapPaymentEventPricer<SwapPaymentEvent> paymentEventPricer)
Creates an instance.
|
Modifier and Type | Method and Description |
---|---|
CurrencyAmount |
accruedInterest(ResolvedSwapLeg leg,
RatesProvider provider)
Calculates the accrued interest since the last payment.
|
double |
annuityCash(int nbPaymentsPerYear,
int nbPeriods,
double yield)
Computes the conventional cash annuity for a given yield.
|
double |
annuityCash(ResolvedSwapLeg fixedLeg,
double yield)
Computes the conventional cash annuity from a swap leg.
|
ValueDerivatives |
annuityCash1(int nbPaymentsPerYear,
int nbPeriods,
double yield)
Computes the conventional cash annuity for a given yield and its first derivative with respect to the yield.
|
ValueDerivatives |
annuityCash2(int nbPaymentsPerYear,
int nbPeriods,
double yield)
Computes the conventional cash annuity for a given yield and its first two derivatives with respect to the yield.
|
ValueDerivatives |
annuityCash3(int nbPaymentsPerYear,
int nbPeriods,
double yield)
Computes the conventional cash annuity for a given yield and its first three derivatives with respect to the yield.
|
ValueDerivatives |
annuityCashDerivative(ResolvedSwapLeg fixedLeg,
double yield)
Computes the derivative of the conventional cash annuity with respect to the yield from a swap leg.
|
CashFlows |
cashFlows(ResolvedSwapLeg leg,
RatesProvider provider)
Calculates the future cash flows of the swap leg.
|
double |
couponEquivalent(ResolvedSwapLeg leg,
RatesProvider provider,
double pvbp)
Calculates the coupon equivalent of a swap leg.
|
MultiCurrencyAmount |
currencyExposure(ResolvedSwapLeg leg,
RatesProvider provider)
Calculates the currency exposure of the swap leg.
|
CurrencyAmount |
currentCash(ResolvedSwapLeg leg,
RatesProvider provider)
Calculates the current cash of the swap leg.
|
ExplainMap |
explainPresentValue(ResolvedSwapLeg leg,
RatesProvider provider)
Explain present value for a swap leg.
|
CurrencyAmount |
forecastValue(ResolvedSwapLeg leg,
RatesProvider provider)
Calculates the forecast value of the swap leg.
|
PointSensitivityBuilder |
forecastValueSensitivity(ResolvedSwapLeg leg,
RatesProvider provider)
Calculates the forecast value sensitivity of the swap leg.
|
SwapPaymentEventPricer<SwapPaymentEvent> |
getEventPricer()
Gets the underlying leg pricer.
|
SwapPaymentPeriodPricer<SwapPaymentPeriod> |
getPeriodPricer()
Gets the underlying leg pricer.
|
CurrencyAmount |
presentValue(ResolvedSwapLeg leg,
Currency currency,
RatesProvider provider)
Calculates the present value of the swap leg, converted to the specified currency.
|
CurrencyAmount |
presentValue(ResolvedSwapLeg leg,
RatesProvider provider)
Calculates the present value of the swap leg.
|
PointSensitivityBuilder |
presentValueSensitivity(ResolvedSwapLeg leg,
RatesProvider provider)
Calculates the present value sensitivity of the swap leg.
|
double |
pvbp(ResolvedSwapLeg leg,
RatesProvider provider)
Computes the Present Value of a Basis Point for a swap leg.
|
PointSensitivityBuilder |
pvbpSensitivity(ResolvedSwapLeg fixedLeg,
RatesProvider provider)
Calculates the Present Value of a Basis Point curve sensitivity for a fixed swap leg.
|
public static final DiscountingSwapLegPricer DEFAULT
public DiscountingSwapLegPricer(SwapPaymentPeriodPricer<SwapPaymentPeriod> paymentPeriodPricer, SwapPaymentEventPricer<SwapPaymentEvent> paymentEventPricer)
paymentPeriodPricer
- the pricer for SwapPaymentPeriod
paymentEventPricer
- the pricer for SwapPaymentEvent
public SwapPaymentPeriodPricer<SwapPaymentPeriod> getPeriodPricer()
public SwapPaymentEventPricer<SwapPaymentEvent> getEventPricer()
public CurrencyAmount presentValue(ResolvedSwapLeg leg, Currency currency, RatesProvider provider)
The present value of the leg is the value on the valuation date. This is the discounted forecast value. The result is converted to the specified currency.
leg
- the legcurrency
- the currency to convert toprovider
- the rates providerpublic CurrencyAmount presentValue(ResolvedSwapLeg leg, RatesProvider provider)
The present value of the leg is the value on the valuation date. This is the discounted forecast value. The result is returned using the payment currency of the leg.
leg
- the legprovider
- the rates providerpublic CurrencyAmount forecastValue(ResolvedSwapLeg leg, RatesProvider provider)
The forecast value of the leg is the value on the valuation date without present value discounting. The result is returned using the payment currency of the leg.
leg
- the legprovider
- the rates providerpublic CurrencyAmount accruedInterest(ResolvedSwapLeg leg, RatesProvider provider)
This determines the payment period applicable at the valuation date and calculates the accrued interest since the last payment. The result is returned using the payment currency of the leg.
leg
- the legprovider
- the rates providerpublic double pvbp(ResolvedSwapLeg leg, RatesProvider provider)
The Present Value of a Basis Point is the value of the leg when the rate is equal to 1. A better name would be "Present Value of 1". The quantity is also known as "physical annuity" or "level".
Each period must not have FX reset or compounding.
They must not be of type KnownAmountSwapPaymentPeriod
.
leg
- the swap legprovider
- the rates providerpublic double couponEquivalent(ResolvedSwapLeg leg, RatesProvider provider, double pvbp)
The coupon equivalent is the common fixed coupon for all the periods which would result in the same present value of the leg.
This is used in particular for swaption pricing with a model on the swap rate.
leg
- the swap legprovider
- the rates providerpvbp
- the present value of a basis pointpublic PointSensitivityBuilder presentValueSensitivity(ResolvedSwapLeg leg, RatesProvider provider)
The present value sensitivity of the leg is the sensitivity of the present value to the underlying curves.
leg
- the legprovider
- the rates providerpublic PointSensitivityBuilder forecastValueSensitivity(ResolvedSwapLeg leg, RatesProvider provider)
The forecast value sensitivity of the leg is the sensitivity of the forecast value to the underlying curves.
leg
- the legprovider
- the rates providerpublic PointSensitivityBuilder pvbpSensitivity(ResolvedSwapLeg fixedLeg, RatesProvider provider)
The Present Value of a Basis Point is the value of the leg when the rate is equal to 1. A better name would be "Present Value of 1". The quantity is also known as "physical annuity" or "level".
Each period must not have FX reset or compounding.
They must not be of type KnownAmountSwapPaymentPeriod
.
fixedLeg
- the swap fixed legprovider
- the rates providerpublic double annuityCash(ResolvedSwapLeg fixedLeg, double yield)
The computation is relevant only for standard swaps with constant notional and regular payments. The swap leg must be a fixed leg. However, this is not checked internally.
fixedLeg
- the fixed leg of the swapyield
- the yieldpublic double annuityCash(int nbPaymentsPerYear, int nbPeriods, double yield)
nbPaymentsPerYear
- the number of payment per yearnbPeriods
- the total number of periodsyield
- the yieldpublic ValueDerivatives annuityCash1(int nbPaymentsPerYear, int nbPeriods, double yield)
nbPaymentsPerYear
- the number of payment per yearnbPeriods
- the total number of periodsyield
- the yieldpublic ValueDerivatives annuityCash2(int nbPaymentsPerYear, int nbPeriods, double yield)
nbPaymentsPerYear
- the number of payment per yearnbPeriods
- the total number of periodsyield
- the yieldpublic ValueDerivatives annuityCash3(int nbPaymentsPerYear, int nbPeriods, double yield)
nbPaymentsPerYear
- the number of payment per yearnbPeriods
- the total number of periodsyield
- the yieldpublic ValueDerivatives annuityCashDerivative(ResolvedSwapLeg fixedLeg, double yield)
The computation is relevant only for standard swaps with constant notional and regular payments. The swap leg must be a fixed leg. However, this is not checked internally.
fixedLeg
- the fixed leg of the swapyield
- the yieldpublic CashFlows cashFlows(ResolvedSwapLeg leg, RatesProvider provider)
Each expected cash flow is added to the result.
This is based on forecastValue(ResolvedSwapLeg, RatesProvider)
.
leg
- the swap leg for which the cash flows should be computedprovider
- the rates providerpublic ExplainMap explainPresentValue(ResolvedSwapLeg leg, RatesProvider provider)
leg
- the swap logprovider
- the rates providerpublic MultiCurrencyAmount currencyExposure(ResolvedSwapLeg leg, RatesProvider provider)
leg
- the legprovider
- the rates providerpublic CurrencyAmount currentCash(ResolvedSwapLeg leg, RatesProvider provider)
leg
- the legprovider
- the rates providerCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.