irCapFloorVolatilitySurfaceBuilder
First introduced in version 3.00.6
Syntax
irCapFloorVolatilitySurfaceBuilder(referenceDate, currency, iborIndex, quoteTerms, quoteStrikes, quotes, discountCurve, forwardCurve, [volType='Normal'], [model='SABR'], [surfaceName])
Details
Builds an interest rate cap/floor option volatility surface.
Parameters
referenceDate is a DATE scalar that specifies the reference date of the surface.
currency is a STRING scalar that specifies the currency of the surface. Currently, only "CNY" is supported.
iborIndex is a STRING scalar that specifies the reference rate of the surface. Valid values are:
- "LPR_1Y": 1-year Loan Prime Rate.
- "LPR_5Y": 5-year Loan Prime Rate.
quoteTerms is a STRING or DURATION vector that specifies the tenors corresponding to the market quotes.
quoteStrikes is a numeric vector that specifies the strikes for the option quotes.
quotes is a numeric matrix that specifies the market quote matrix. Its shape
is (size(quoteTerms), size(quoteStrikes)). The value in row i and
column j represents the quote for strike quoteStrikes[j] at tenor
quoteTerms[i].
discountCurve is an MKTDATA object that specifies the discount curve (IrYieldCurve).
forwardCurve is an MKTDATA object that specifies the forward curve (IrYieldCurve).
volType (optional) is a STRING scalar that specifies the volatility type. Valid values are:
- "Normal" (default): normal volatility.
- "Lognormal": lognormal volatility.
model (optional) is a STRING scalar that specifies the model used to build the surface. Valid values are:
- "SABR" (default): Stochastic Alpha Beta Rho model (Beta=0).
- "Linear": linear model.
- "CubicSpline": cubic spline model.
surfaceName (optional) is a STRING scalar that specifies the surface name. The default is "IRCAPFLOORVOLSURF/{iborIndex}".
Returns
An object of type MKTDATA that indicates the interest rate cap/floor option volatility surface (IrCapFloorVolatilitySurface). The surface fields are described below:
| Field | Type | Description |
|---|---|---|
| surfaceName | STRING | The name of the surface. |
| mktDataType | STRING | Market data type. Always returns 'Surface'. |
| version | INT | The format version used to parse the data. No action is required. By default, the latest format version of the current Server is returned. |
| referenceDate | STRING | The reference date of the surface. |
| surfaceType | STRING | The type of the surface. Always returns 'IrCapFloorVolatilitySurface'. |
| smileMethod | STRING | The volatility smile method, corresponding to the model specified by the model input parameter. |
| termDates | DATE vector | The tenor dates corresponding to the volatility smiles in the surface. |
| volSmiles | ANY vector | Each element in the vector is a volatility smile of type
DICT(STRING, ANY) and contains the following members:
|
| currency | STRING | The currency of the surface. |
| iborIndex | STRING | The reference rate of the surface. |
| volType | STRING | Volatility type. |
Examples
This example shows how to build an interest rate cap/floor option volatility surface based on CNY LPR 1Y.
/*Defines a curve creation function for building the discount curve (discountCurve) and forward curve (forwardCurve).
Parameters:
asOfDate: The curve valuation date.
zeroRate: The fixed zero-coupon rate.
Returns:
A market data object of type IrYieldCurve.*/
def createLpr1yFlatCurve(asOfDate, zeroRate){
// Set the curve node dates.
// The dates correspond to 1 day, 3 months, 6 months, 1 year, 2 years, and 3 years after the base date.
pillarDates = asOfDate + [1, 92, 183, 365, 730, 1095]
pillarValues = take(zeroRate, size(pillarDates))
curveDict = {
"mktDataType": "Curve",
"curveType": "IrYieldCurve",
"referenceDate": asOfDate,
"currency": "CNY", // Curve currency
"curveName": "CNY_LPR_1Y", // Curve name
"dayCountConvention": "Actual365", // Day count convention
"compounding": "Continuous", // Compounding type: continuous compounding
"interpMethod": "Linear", // Interpolation method: linear interpolation
"extrapMethod": "Flat", // Extrapolation method: flat
"frequency": "NoFrequency", // Interest accrual frequency
// Curve node dates and corresponding zero rates
"dates": pillarDates,
"values": pillarValues
}
return parseMktData(curveDict)
}
// Base date
aod = 2021.03.18
cnyCurve = createLpr1yFlatCurve(aod, 0.0340)
// Tenors for the interest rate cap/floor option volatility quotes. Each row corresponds to the volatility quotes for one tenor.
quoteTerms = [3M, 6M, 9M, 1y, 2y]
// Strike rates corresponding to the interest rate cap/floor option volatility quotes. Each column corresponds to one strike.
quoteStrikes = [0.0, 0.025, 0.0365, 0.05, 0.07]
/*Constructs the volatility quote matrix.
Rows represent option tenors (`quoteTerms`).
Columns represent execution rates (`quoteStrikes`).*/
quotes = matrix(
0.0072 0.0070 0.0068 0.0067 0.0065,
0.0064 0.0062 0.0061 0.0060 0.0059,
0.0060 0.0058 0.0057 0.0056 0.0055,
0.0063 0.0061 0.0060 0.0059 0.0058,
0.0071 0.0069 0.0068 0.0067 0.0065
)
capfloorVolSurf = irCapFloorVolatilitySurfaceBuilder(
aod, // Base date
"CNY", // Currency
"LPR_1Y", // Reference rate
quoteTerms, // Quote tenor
quoteStrikes, // Execution price
quotes, // Volatility quote matrix
cnyCurve, // Discount curve
cnyCurve, // Forward curve
model="Linear", // Surface interpolation model
surfaceName="CNY_LPR_1Y" // Volatility surface name
)
Related functions: parseMktData
