irVanillaSwapRateCalculator
First introduced in version: 3.00.6.4
Syntax
irVanillaSwapRateCalculator(instrument, date, discountCurve, forwardCurve, assetPriceCurve)
Details
Calculates the fixed-leg rate that makes the net present value of a fixed-floating interest rate swap equal to zero.
Arguments
Note: All input vectors must have the same length. Scalar inputs are automatically expanded to match the vector length.
instrument is an INSTRUMENT scalar/vector of type IrFixedFloatingSwap representing the fixed-floating interest rate swaps for which to calculate the fixed-leg rate. Currently, only swaps with FR_007 or SHIBOR_3M as the floating-leg reference rate are supported.
date is a DATE scalar/vector specifying the calculation date(s).
discountCurve is an MKTDATA scalar/vector of type IrYieldCurve representing the spot curve(s) used to calculate discount factors. Each curve's referenceDate must match the corresponding date.
forwardCurve is an MKTDATA scalar/vector of type IrYieldCurve representing the spot curve(s) used to calculate forward rates. Each curve's referenceDate must match the corresponding date.
assetPriceCurve is an MKTDATA scalar/vector of type AssetPriceCurve containing historical fixings for the floating-leg reference rate.
Returns
-
If all arguments are scalars, returns a DOUBLE scalar.
-
If any argument is a vector, returns a DOUBLE vector with the same length as the input vectors.
During batch calculation, if an individual calculation fails, its result is NULL; the other results are returned normally.
Examples
Example 1. Calculate the fixed-leg rate for a fixed-floating interest rate swap whose floating leg references FR_007.
swapSpec = {
"productType": "Swap",
"swapType": "IrSwap",
"irSwapType": "IrFixedFloatingSwap",
"start": 2025.06.16,
"maturity": 2028.06.16,
"frequency": "Quarterly",
"fixedRate": 0.018,
"calendar": "CFET",
"fixedDayCountConvention": "Actual365",
"floatingDayCountConvention": "Actual365",
"payReceive": "Pay",
"iborIndex": "FR_007",
"spread": 0.0001,
"notionalCurrency": "CNY",
"notionalAmount": 1E8
}
pricingDate = 2025.08.18
yieldCurveSpec = {
"mktDataType": "Curve",
"curveType": "IrYieldCurve",
"referenceDate": pricingDate,
"currency": "CNY",
"curveName": "CNY_FR_007",
"dayCountConvention": "Actual365",
"compounding": "Continuous",
"interpMethod": "Linear",
"extrapMethod": "Flat",
"frequency": "Annual",
"dates": [2025.08.21, 2025.08.27],
"values": [1.5, 1.5] / 100
}
fixingCurveSpec = {
"mktDataType": "Curve",
"curveType": "AssetPriceCurve",
"referenceDate": pricingDate,
"curveName": "PRICE_FR_007",
"dates": [2025.05.09, 2025.05.12],
"values": [2, 2] / 100
}
instrument = parseInstrument(obj=swapSpec)
yieldCurve = parseMktData(dict=yieldCurveSpec)
fixingCurve = parseMktData(dict=fixingCurveSpec)
fixedRate = irVanillaSwapRateCalculator(
instrument=instrument,
date=pricingDate,
discountCurve=yieldCurve,
forwardCurve=yieldCurve,
assetPriceCurve=fixingCurve
)
fixedRate
// output: 0.014147990440065
Example 2. Calculate the fixed-leg rate of the same interest rate swap using two different forward curves.
swapSpec = {
"productType": "Swap",
"swapType": "IrSwap",
"irSwapType": "IrFixedFloatingSwap",
"start": 2025.06.16,
"maturity": 2028.06.16,
"frequency": "Quarterly",
"fixedRate": 0.018,
"calendar": "CFET",
"fixedDayCountConvention": "Actual365",
"floatingDayCountConvention": "Actual365",
"payReceive": "Pay",
"iborIndex": "FR_007",
"spread": 0.0001,
"notionalCurrency": "CNY",
"notionalAmount": 1E8
}
pricingDate = 2025.08.18
yieldCurveSpec = {
"mktDataType": "Curve",
"curveType": "IrYieldCurve",
"referenceDate": pricingDate,
"currency": "CNY",
"curveName": "CNY_FR_007",
"dayCountConvention": "Actual365",
"compounding": "Continuous",
"interpMethod": "Linear",
"extrapMethod": "Flat",
"frequency": "Annual",
"dates": [2025.08.21, 2025.08.27],
"values": [1.5, 1.5] / 100
}
fixingCurveSpec = {
"mktDataType": "Curve",
"curveType": "AssetPriceCurve",
"referenceDate": pricingDate,
"curveName": "PRICE_FR_007",
"dates": [2025.05.09, 2025.05.12],
"values": [2, 2] / 100
}
instrument = parseInstrument(obj=swapSpec)
yieldCurve = parseMktData(dict=yieldCurveSpec)
fixingCurve = parseMktData(dict=fixingCurveSpec)
higherForwardCurveSpec = yieldCurveSpec
higherForwardCurveSpec["values"] = [3.0, 3.0] / 100
higherForwardCurve = parseMktData(dict=higherForwardCurveSpec)
fixedRates = irVanillaSwapRateCalculator(
instrument=instrument,
date=pricingDate,
discountCurve=yieldCurve,
forwardCurve=[yieldCurve, higherForwardCurve],
assetPriceCurve=fixingCurve
)
fixedRates
// output: [0.014147990440065, 0.028247897683873]
Related functions: irFixedFloatingSwapPricer, parseInstrument, parseMktData
