Class HullWhiteOneFactorPiecewiseConstantInterestRateModel
- java.lang.Object
-
- com.opengamma.strata.pricer.impl.rate.model.HullWhiteOneFactorPiecewiseConstantInterestRateModel
-
- All Implemented Interfaces:
Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class HullWhiteOneFactorPiecewiseConstantInterestRateModel extends Object implements org.joda.beans.ImmutableBean, Serializable
Methods related to the Hull-White one factor (extended Vasicek) model with piecewise constant volatility.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static HullWhiteOneFactorPiecewiseConstantInterestRateModel
DEFAULT
Default instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description double
alpha(HullWhiteOneFactorPiecewiseConstantParameters data, double startExpiry, double endExpiry, double numeraireTime, double bondMaturity)
Calculates the (zero-coupon) bond volatility divided by a bond numeraire, i.e., alpha, for a given period.ValueDerivatives
alphaAdjoint(HullWhiteOneFactorPiecewiseConstantParameters data, double startExpiry, double endExpiry, double numeraireTime, double bondMaturity)
Calculates the (zero-coupon) bond volatility divided by a bond numeraire, i.e., alpha, for a given period and its derivatives.double
beta(HullWhiteOneFactorPiecewiseConstantParameters data, double startExpiry, double endExpiry)
Calculates the beta parameter.boolean
equals(Object obj)
double
futuresConvexityFactor(HullWhiteOneFactorPiecewiseConstantParameters data, double t0, double t1, double t2)
Calculates the future convexity factor used in future pricing.ValueDerivatives
futuresConvexityFactorAdjoint(HullWhiteOneFactorPiecewiseConstantParameters data, double t0, double t1, double t2)
Calculates the future convexity factor and its derivatives with respect to the model volatilities.int
hashCode()
double
kappa(DoubleArray discountedCashFlow, DoubleArray alpha)
Calculates the exercise boundary for swaptions.double
lambda(DoubleArray discountedCashFlow, DoubleArray alpha2, DoubleArray hwH)
Calculates the common part of the exercise boundary of European swaptions forward.static org.joda.beans.TypedMetaBean<HullWhiteOneFactorPiecewiseConstantInterestRateModel>
meta()
The meta-bean forHullWhiteOneFactorPiecewiseConstantInterestRateModel
.org.joda.beans.TypedMetaBean<HullWhiteOneFactorPiecewiseConstantInterestRateModel>
metaBean()
double
paymentDelayConvexityFactor(HullWhiteOneFactorPiecewiseConstantParameters parameters, double startExpiry, double endExpiry, double u, double v, double tp)
Calculates the payment delay convexity factor used in coupons with mismatched dates pricing.double
swapRate(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the swap rate for a given value of the standard normal random variable in theP(*,theta)
numeraire.ValueDerivatives
swapRateDaf1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative of the swap rate with respect to thealphaFixed
in theP(*,theta)
numeraire.ValueDerivatives
swapRateDai1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative of the swap rate with respect to thealphaIbor
in theP(*,theta)
numeraire.ValueDerivatives
swapRateDdcff1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative of the swap rate with respect to thediscountedCashFlowFixed
in theP(*,theta)
numeraire.ValueDerivatives
swapRateDdcfi1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative of the swap rate with respect to thediscountedCashFlowIbor
in theP(*,theta)
numeraire.double
swapRateDx1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative of the swap rate with respect to the value of the standard normal random variable in theP(*,theta)
numeraire.double
swapRateDx2(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the second order derivative of the swap rate with respect to the value of the standard normal random variable in theP(*,theta)
numeraire.Pair<DoubleArray,DoubleArray>
swapRateDx2Da1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative with respect to the alphaFixed and to the alphaIbor of the of swap rate second derivative with respect to the random variable x in theP(*,theta)
numeraire.Pair<DoubleArray,DoubleArray>
swapRateDx2Ddcf1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative with respect to the discountedCashFlowFixed and to the discountedCashFlowIbor of the of swap rate second derivative with respect to the random variable x in theP(*,theta)
numeraire.String
toString()
DoubleMatrix
volatilityMaturityPart(HullWhiteOneFactorPiecewiseConstantParameters hwParameters, double u, DoubleMatrix v)
Calculates the maturity dependent part of the volatility (function called H in the implementation note).
-
-
-
Field Detail
-
DEFAULT
public static final HullWhiteOneFactorPiecewiseConstantInterestRateModel DEFAULT
Default instance.
-
-
Method Detail
-
futuresConvexityFactor
public double futuresConvexityFactor(HullWhiteOneFactorPiecewiseConstantParameters data, double t0, double t1, double t2)
Calculates the future convexity factor used in future pricing.The factor is called gamma in the reference: Henrard, M. "The Irony in the derivatives discounting Part II: the crisis", Wilmott Journal, 2010, 2, 301-316
- Parameters:
data
- the Hull-White model parameterst0
- the first expiry timet1
- the first reference timet2
- the second reference time- Returns:
- the factor
-
futuresConvexityFactorAdjoint
public ValueDerivatives futuresConvexityFactorAdjoint(HullWhiteOneFactorPiecewiseConstantParameters data, double t0, double t1, double t2)
Calculates the future convexity factor and its derivatives with respect to the model volatilities.The factor is called gamma in the reference: Henrard, M. "The Irony in the derivatives discounting Part II: the crisis", Wilmott Journal, 2010, 2, 301-316
- Parameters:
data
- the Hull-White model parameterst0
- the expiry timet1
- the first reference timet2
- the second reference time- Returns:
- the factor and drivatives
-
paymentDelayConvexityFactor
public double paymentDelayConvexityFactor(HullWhiteOneFactorPiecewiseConstantParameters parameters, double startExpiry, double endExpiry, double u, double v, double tp)
Calculates the payment delay convexity factor used in coupons with mismatched dates pricing.- Parameters:
parameters
- the Hull-White model parametersstartExpiry
- the start expiry timeendExpiry
- the end expiry timeu
- the fixing period start timev
- the fixing period end timetp
- the payment time- Returns:
- the factor
-
alpha
public double alpha(HullWhiteOneFactorPiecewiseConstantParameters data, double startExpiry, double endExpiry, double numeraireTime, double bondMaturity)
Calculates the (zero-coupon) bond volatility divided by a bond numeraire, i.e., alpha, for a given period.- Parameters:
data
- the Hull-White model datastartExpiry
- the start time of the expiry periodendExpiry
- the end time of the expiry periodnumeraireTime
- the time to maturity for the bond numerairebondMaturity
- the time to maturity for the bond- Returns:
- the re-based bond volatility
-
alphaAdjoint
public ValueDerivatives alphaAdjoint(HullWhiteOneFactorPiecewiseConstantParameters data, double startExpiry, double endExpiry, double numeraireTime, double bondMaturity)
Calculates the (zero-coupon) bond volatility divided by a bond numeraire, i.e., alpha, for a given period and its derivatives.The derivative values are the derivatives of the function alpha with respect to the piecewise constant volatilities.
- Parameters:
data
- the Hull-White model datastartExpiry
- the start time of the expiry periodendExpiry
- the end time of the expiry periodnumeraireTime
- the time to maturity for the bond numerairebondMaturity
- the time to maturity for the bond- Returns:
- The re-based bond volatility
-
kappa
public double kappa(DoubleArray discountedCashFlow, DoubleArray alpha)
Calculates the exercise boundary for swaptions.Reference: Henrard, M. (2003). "Explicit bond option and swaption formula in Heath-Jarrow-Morton one-factor model". International Journal of Theoretical and Applied Finance, 6(1):57--72.
- Parameters:
discountedCashFlow
- the cash flow equivalent discounted to todayalpha
- the zero-coupon bond volatilities- Returns:
- the exercise boundary
-
beta
public double beta(HullWhiteOneFactorPiecewiseConstantParameters data, double startExpiry, double endExpiry)
Calculates the beta parameter.This is intended to be used in particular for Bermudan swaption first step of the pricing.
Reference: Henrard, "M. Bermudan Swaptions in Gaussian HJM One-Factor Model: Analytical and Numerical Approaches". SSRN, October 2008. Available at SSRN: http://ssrn.com/abstract=1287982
- Parameters:
data
- the Hull-White model datastartExpiry
- the start time of the expiry periodendExpiry
- the end time of the expiry period- Returns:
- the re-based bond volatility
-
lambda
public double lambda(DoubleArray discountedCashFlow, DoubleArray alpha2, DoubleArray hwH)
Calculates the common part of the exercise boundary of European swaptions forward.This is intended to be used in particular for Bermudan swaption first step of the pricing.
Reference: Henrard, "M. Bermudan Swaptions in Gaussian HJM One-Factor Model: Analytical and Numerical Approaches". SSRN, October 2008. Available at SSRN: http://ssrn.com/abstract=1287982
- Parameters:
discountedCashFlow
- the swap discounted cash flowsalpha2
- square of the alpha parameterhwH
- the H factors- Returns:
- the exercise boundary
-
volatilityMaturityPart
public DoubleMatrix volatilityMaturityPart(HullWhiteOneFactorPiecewiseConstantParameters hwParameters, double u, DoubleMatrix v)
Calculates the maturity dependent part of the volatility (function called H in the implementation note).- Parameters:
hwParameters
- the model parametersu
- the start timev
- the end time- Returns:
- the volatility
-
swapRate
public double swapRate(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the swap rate for a given value of the standard normal random variable in theP(*,theta)
numeraire.- Parameters:
x
- the random variable valuediscountedCashFlowFixed
- the discounted cash flows equivalent of the swap fixed legalphaFixed
- the zero-coupon bond volatilities for the swap fixed legdiscountedCashFlowIbor
- the discounted cash flows equivalent of the swap Ibor legalphaIbor
- the zero-coupon bond volatilities for the swap Ibor leg- Returns:
- the swap rate
-
swapRateDx1
public double swapRateDx1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative of the swap rate with respect to the value of the standard normal random variable in theP(*,theta)
numeraire.- Parameters:
x
- the random variable valuediscountedCashFlowFixed
- the discounted cash flows equivalent of the swap fixed legalphaFixed
- the zero-coupon bond volatilities for the swap fixed legdiscountedCashFlowIbor
- the discounted cash flows equivalent of the swap Ibor legalphaIbor
- the zero-coupon bond volatilities for the swap Ibor leg- Returns:
- the first derivative of the swap rate
-
swapRateDx2
public double swapRateDx2(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the second order derivative of the swap rate with respect to the value of the standard normal random variable in theP(*,theta)
numeraire.- Parameters:
x
- the random variable valuediscountedCashFlowFixed
- the discounted cash flows equivalent of the swap fixed legalphaFixed
- the zero-coupon bond volatilities for the swap fixed legdiscountedCashFlowIbor
- the discounted cash flows equivalent of the swap Ibor legalphaIbor
- the zero-coupon bond volatilities for the swap Ibor leg- Returns:
- the second derivative of the swap rate
-
swapRateDdcfi1
public ValueDerivatives swapRateDdcfi1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative of the swap rate with respect to thediscountedCashFlowIbor
in theP(*,theta)
numeraire.- Parameters:
x
- the random variable valuediscountedCashFlowFixed
- the discounted cash flows equivalent of the swap fixed legalphaFixed
- the zero-coupon bond volatilities for the swap fixed legdiscountedCashFlowIbor
- the discounted cash flows equivalent of the swap Ibor legalphaIbor
- the zero-coupon bond volatilities for the swap Ibor leg- Returns:
- the swap rate and derivatives
-
swapRateDdcff1
public ValueDerivatives swapRateDdcff1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative of the swap rate with respect to thediscountedCashFlowFixed
in theP(*,theta)
numeraire.- Parameters:
x
- the random variable valuediscountedCashFlowFixed
- the discounted cash flows equivalent of the swap fixed legalphaFixed
- the zero-coupon bond volatilities for the swap fixed legdiscountedCashFlowIbor
- the discounted cash flows equivalent of the swap Ibor legalphaIbor
- the zero-coupon bond volatilities for the swap Ibor leg- Returns:
- the swap rate and derivatives
-
swapRateDai1
public ValueDerivatives swapRateDai1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative of the swap rate with respect to thealphaIbor
in theP(*,theta)
numeraire.- Parameters:
x
- the random variable valuediscountedCashFlowFixed
- the discounted cash flows equivalent of the swap fixed legalphaFixed
- the zero-coupon bond volatilities for the swap fixed legdiscountedCashFlowIbor
- the discounted cash flows equivalent of the swap Ibor legalphaIbor
- the zero-coupon bond volatilities for the swap Ibor leg- Returns:
- the swap rate and derivatives
-
swapRateDaf1
public ValueDerivatives swapRateDaf1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative of the swap rate with respect to thealphaFixed
in theP(*,theta)
numeraire.- Parameters:
x
- the random variable value.discountedCashFlowFixed
- the discounted cash flows equivalent of the swap fixed legalphaFixed
- the zero-coupon bond volatilities for the swap fixed legdiscountedCashFlowIbor
- the discounted cash flows equivalent of the swap Ibor legalphaIbor
- the zero-coupon bond volatilities for the swap Ibor leg- Returns:
- the swap rate and derivatives
-
swapRateDx2Ddcf1
public Pair<DoubleArray,DoubleArray> swapRateDx2Ddcf1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative with respect to the discountedCashFlowFixed and to the discountedCashFlowIbor of the of swap rate second derivative with respect to the random variable x in theP(*,theta)
numeraire.The result is made of a pair of arrays. The first one is the derivative with respect to
discountedCashFlowFixed
and the second one with respect todiscountedCashFlowIbor
.- Parameters:
x
- the random variable valuediscountedCashFlowFixed
- the discounted cash flows equivalent of the swap fixed legalphaFixed
- the zero-coupon bond volatilities for the swap fixed legdiscountedCashFlowIbor
- the discounted cash flows equivalent of the swap Ibor legalphaIbor
- the zero-coupon bond volatilities for the swap Ibor leg- Returns:
- the swap rate derivatives
-
swapRateDx2Da1
public Pair<DoubleArray,DoubleArray> swapRateDx2Da1(double x, DoubleArray discountedCashFlowFixed, DoubleArray alphaFixed, DoubleArray discountedCashFlowIbor, DoubleArray alphaIbor)
Calculates the first order derivative with respect to the alphaFixed and to the alphaIbor of the of swap rate second derivative with respect to the random variable x in theP(*,theta)
numeraire.The result is made of a pair of arrays. The first one is the derivative with respect to
alphaFixed
and the second one with respect toalphaIbor
.- Parameters:
x
- the random variable valuediscountedCashFlowFixed
- the discounted cash flows equivalent of the swap fixed legalphaFixed
- the zero-coupon bond volatilities for the swap fixed legdiscountedCashFlowIbor
- the discounted cash flows equivalent of the swap Ibor legalphaIbor
- the zero-coupon bond volatilities for the swap Ibor leg- Returns:
- the swap rate derivatives
-
meta
public static org.joda.beans.TypedMetaBean<HullWhiteOneFactorPiecewiseConstantInterestRateModel> meta()
The meta-bean forHullWhiteOneFactorPiecewiseConstantInterestRateModel
.- Returns:
- the meta-bean, not null
-
metaBean
public org.joda.beans.TypedMetaBean<HullWhiteOneFactorPiecewiseConstantInterestRateModel> metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
-