Class BlackFxSingleBarrierOptionProductPricer
- java.lang.Object
-
- com.opengamma.strata.pricer.fxopt.BlackFxSingleBarrierOptionProductPricer
-
public class BlackFxSingleBarrierOptionProductPricer extends Object
Pricer for FX barrier option products in Black-Scholes world.This function provides the ability to price an
ResolvedFxSingleBarrierOption
.All of the computation is be based on the counter currency of the underlying FX transaction. For example, price, PV and risk measures of the product will be expressed in USD for an option on EUR/USD.
-
-
Field Summary
Fields Modifier and Type Field Description static BlackFxSingleBarrierOptionProductPricer
DEFAULT
Default implementation.
-
Constructor Summary
Constructors Constructor Description BlackFxSingleBarrierOptionProductPricer()
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiCurrencyAmount
currencyExposure(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the currency exposure of the FX barrier option product.double
delta(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the delta of the FX barrier option product.FxRate
forwardFxRate(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider)
Calculates the forward exchange rate.double
gamma(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the gamma of the FX barrier option product.double
impliedVolatility(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the implied Black volatility of the FX barrier option product.CurrencyAmount
presentValue(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the present value of the FX barrier option product.CurrencyAmount
presentValueDelta(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the present value delta of the FX barrier option product.CurrencyAmount
presentValueGamma(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the present value gamma of the FX barrier option product.PointSensitivityBuilder
presentValueSensitivityModelParamsVolatility(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Computes the present value sensitivity to the black volatility used in the pricing.PointSensitivityBuilder
presentValueSensitivityRatesStickyStrike(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the present value sensitivity of the FX barrier option product.CurrencyAmount
presentValueTheta(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the present value theta of the FX barrier option product.double
price(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the price of the FX barrier option product.double
theta(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the theta of the FX barrier option product.double
vega(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the vega of the FX barrier option product.
-
-
-
Field Detail
-
DEFAULT
public static final BlackFxSingleBarrierOptionProductPricer DEFAULT
Default implementation.
-
-
Method Detail
-
presentValue
public CurrencyAmount presentValue(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the present value of the FX barrier option product.The present value of the product is the value on the valuation date. It is expressed in the counter currency.
The volatility used in this computation is the Black implied volatility at expiry time and strike.
- Parameters:
option
- the option productratesProvider
- the rates providervolatilities
- the Black volatility provider- Returns:
- the present value of the product
-
price
public double price(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the price of the FX barrier option product.The price of the product is the value on the valuation date for one unit of the base currency and is expressed in the counter currency. The price does not take into account the long/short flag. See
presentValue(com.opengamma.strata.product.fxopt.ResolvedFxSingleBarrierOption, com.opengamma.strata.pricer.rate.RatesProvider, com.opengamma.strata.pricer.fxopt.BlackFxOptionVolatilities)
for scaling and currency.The volatility used in this computation is the Black implied volatility at expiry time and strike.
- Parameters:
option
- the option productratesProvider
- the rates providervolatilities
- the Black volatility provider- Returns:
- the price of the product
-
presentValueSensitivityRatesStickyStrike
public PointSensitivityBuilder presentValueSensitivityRatesStickyStrike(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the present value sensitivity of the FX barrier option product.The present value sensitivity of the product is the sensitivity of
presentValue(com.opengamma.strata.product.fxopt.ResolvedFxSingleBarrierOption, com.opengamma.strata.pricer.rate.RatesProvider, com.opengamma.strata.pricer.fxopt.BlackFxOptionVolatilities)
to the underlying curves.The volatility is fixed in this sensitivity computation, i.e., sticky-strike.
- Parameters:
option
- the option productratesProvider
- the rates providervolatilities
- the Black volatility provider- Returns:
- the present value curve sensitivity of the product
-
presentValueDelta
public CurrencyAmount presentValueDelta(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the present value delta of the FX barrier option product.The present value delta is the first derivative of
presentValue(com.opengamma.strata.product.fxopt.ResolvedFxSingleBarrierOption, com.opengamma.strata.pricer.rate.RatesProvider, com.opengamma.strata.pricer.fxopt.BlackFxOptionVolatilities)
with respect to spot.- Parameters:
option
- the option productratesProvider
- the rates providervolatilities
- the Black volatility provider- Returns:
- the present value delta of the product
-
delta
public double delta(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the delta of the FX barrier option product.The delta is the first derivative of
price(com.opengamma.strata.product.fxopt.ResolvedFxSingleBarrierOption, com.opengamma.strata.pricer.rate.RatesProvider, com.opengamma.strata.pricer.fxopt.BlackFxOptionVolatilities)
with respect to spot.- Parameters:
option
- the option productratesProvider
- the rates providervolatilities
- the Black volatility provider- Returns:
- the delta of the product
-
presentValueGamma
public CurrencyAmount presentValueGamma(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the present value gamma of the FX barrier option product.The present value gamma is the second derivative of
presentValue(com.opengamma.strata.product.fxopt.ResolvedFxSingleBarrierOption, com.opengamma.strata.pricer.rate.RatesProvider, com.opengamma.strata.pricer.fxopt.BlackFxOptionVolatilities)
with respect to spot.- Parameters:
option
- the option productratesProvider
- the rates providervolatilities
- the Black volatility provider- Returns:
- the present value gamma of the product
-
gamma
public double gamma(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the gamma of the FX barrier option product.The delta is the second derivative of
price(com.opengamma.strata.product.fxopt.ResolvedFxSingleBarrierOption, com.opengamma.strata.pricer.rate.RatesProvider, com.opengamma.strata.pricer.fxopt.BlackFxOptionVolatilities)
with respect to spot.- Parameters:
option
- the option productratesProvider
- the rates providervolatilities
- the Black volatility provider- Returns:
- the gamma of the product
-
presentValueSensitivityModelParamsVolatility
public PointSensitivityBuilder presentValueSensitivityModelParamsVolatility(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Computes the present value sensitivity to the black volatility used in the pricing.The result is a single sensitivity to the volatility used. This is also called Black vega.
- Parameters:
option
- the option productratesProvider
- the rates providervolatilities
- the Black volatility provider- Returns:
- the present value sensitivity
-
vega
public double vega(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the vega of the FX barrier option product.The delta is the first derivative of
price(com.opengamma.strata.product.fxopt.ResolvedFxSingleBarrierOption, com.opengamma.strata.pricer.rate.RatesProvider, com.opengamma.strata.pricer.fxopt.BlackFxOptionVolatilities)
with respect to Black volatility.- Parameters:
option
- the option productratesProvider
- the rates providervolatilities
- the Black volatility provider- Returns:
- the vega of the product
-
presentValueTheta
public CurrencyAmount presentValueTheta(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the present value theta of the FX barrier option product.The present value theta is the negative of the first derivative of
presentValue(com.opengamma.strata.product.fxopt.ResolvedFxSingleBarrierOption, com.opengamma.strata.pricer.rate.RatesProvider, com.opengamma.strata.pricer.fxopt.BlackFxOptionVolatilities)
with time parameter.- Parameters:
option
- the option productratesProvider
- the rates providervolatilities
- the Black volatility provider- Returns:
- the present value theta of the product
-
theta
public double theta(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the theta of the FX barrier option product.The theta is the negative of the first derivative of
price(com.opengamma.strata.product.fxopt.ResolvedFxSingleBarrierOption, com.opengamma.strata.pricer.rate.RatesProvider, com.opengamma.strata.pricer.fxopt.BlackFxOptionVolatilities)
with respect to time parameter.- Parameters:
option
- the option productratesProvider
- the rates providervolatilities
- the Black volatility provider- Returns:
- the theta of the product
-
forwardFxRate
public FxRate forwardFxRate(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider)
Calculates the forward exchange rate.- Parameters:
option
- the option productratesProvider
- the rates provider- Returns:
- the forward rate
-
impliedVolatility
public double impliedVolatility(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the implied Black volatility of the FX barrier option product.- Parameters:
option
- the option productratesProvider
- the rates providervolatilities
- the Black volatility provider- Returns:
- the implied volatility of the product
- Throws:
IllegalArgumentException
- if the option has expired
-
currencyExposure
public MultiCurrencyAmount currencyExposure(ResolvedFxSingleBarrierOption option, RatesProvider ratesProvider, BlackFxOptionVolatilities volatilities)
Calculates the currency exposure of the FX barrier option product.- Parameters:
option
- the option productratesProvider
- the rates providervolatilities
- the Black volatility provider- Returns:
- the currency exposure
-
-