irForwardRateAgreementPricer

First introduced in version: 3.00.6

Syntax

irForwardRateAgreementPricer(instrument, pricingDate, discountCurve, forwardCurve)

Details

Prices a forward rate agreement (FRA) and returns its net present value (NPV).

This function values an FRA product based on the specified pricing date, discount curve, and forward curve.

Parameters

Note:
Scalar inputs will be automatically expanded to match the length of other vector inputs. All vector inputs must be of equal length.

instrument is an INSTRUMENT scalar or vector of IrForwardRateAgreement type specifying the forward rate agreement(s) to be priced.

pricingDate is a DATE scalar or vector specifying the pricing date(s).

discountCurve is a MKTDATA scalar or vector of IrYieldCurve type specifying the discount curve(s) used for pricing.

forwardCurve is a MKTDATA scalar or vector of IrYieldCurve type specifying the forward curve(s) used for pricing.

Returns

It returns a DOUBLE scalar or vector indicating the pricing result of the forward rate agreement, that is, the NPV.

Examples

Example 1. Discount pricing of a FRA using a yield curve. This example prices a 3×6 forward rate agreement (FRA) using a CNY yield curve as both the discount curve and the forward curve. For simplicity, the notional amount is set to 1 to facilitate verification of the pricing result. In real-world applications, the notional amount is typically set to the actual trade size, and the discount and forward curves are generally constructed separately based on market data.

// Construct the yield curve
pillar_values = [0.01459939316305370000, 0.02290755179722750000, 0.02530206673930290000, 0.02575648663032010000,
    0.02597514409924680000, 0.02603551814799880000, 0.02653362631447860000, 0.02727214541140500000,
    0.02820244536310750000, 0.02902312220757990000, 0.03046650294887320000, 0.03198550139762500188]
aod = 2019.07.08
pillar_dates = [aod + 2, aod + 8, aod + 93, aod + 185, aod + 276, aod + 367, aod + 732, aod + 1099, aod + 1463,
    aod + 1828, aod + 2558, aod + 3654]
curve = {
    "mktDataType": "Curve",
    "curveType": "IrYieldCurve",
    "referenceDate": aod,
    "currency": "CNY",
    "dayCountConvention": "Actual365",
    "compounding": "Continuous",
    "interpMethod": "Linear",
    "extrapMethod": "Flat",
    "dates": pillar_dates,
    "values": pillar_values,
    "settlement": aod
}
// Parse the curve into a market data object
discountCurve = parseMktData(curve)

// Construct the FRA contract
irFRA = {
    "productType": "Forward",
    "forwardType": "IrForwardRateAgreement",
    "notionalAmount": 1.0,
    "instrumentId": "3Mx6M",
    "start": 2019.10.10,
    "maturity": 2020.01.10,
    "fixedRate": 0.03,
    "calendar": "CFET",
    "dayCountConvention": "Actual360",
    "iborIndex": "SHIBOR_3M",
    "payReceive": "Pay"
}
// Parse the contract into an instrument object
instrument = parseInstrument(irFRA)
// Price the FRA using the yield curve
npv = irForwardRateAgreementPricer(
    instrument=instrument,
    pricingDate=aod,
    discountCurve=discountCurve,
    forwardCurve=discountCurve
    )
print(npv)
// output: -0.00102224

Example 2. This example prices a 3×6 forward rate agreement (FRA) using separate forward and discount curves under a multi-curve framework. The forward curve is used to project future floating rates, while the discount curve is used to discount future cash flows. In real-world applications, these curves are typically constructed independently from different sets of market instruments.

// Forward Curve (SHIBOR Curve)
forward_values = [
    0.0220,
    0.0240,
    0.0255,
    0.0260,
    0.0268,
    0.0275,
    0.0285,
    0.0295
]

// Discount Curve (OIS Curve)
discount_values = [
    0.0180,
    0.0190,
    0.0200,
    0.0205,
    0.0210,
    0.0215,
    0.0220,
    0.0225
]

aod = 2019.07.08

curve_dates = [
    aod + 30,
    aod + 90,
    aod + 180,
    aod + 365,
    aod + 730,
    aod + 1095,
    aod + 1825,
    aod + 3650
]

forwardCurve = {
    "mktDataType": "Curve",
    "curveType": "IrYieldCurve",
    "referenceDate": aod,
    "currency": "CNY",
    "dayCountConvention": "Actual365",
    "compounding": "Continuous",
    "interpMethod": "Linear",
    "extrapMethod": "Flat",
    "dates": curve_dates,
    "values": forward_values,
    "settlement": aod
}

discountCurve = {
    "mktDataType": "Curve",
    "curveType": "IrYieldCurve",
    "referenceDate": aod,
    "currency": "CNY",
    "dayCountConvention": "Actual365",
    "compounding": "Continuous",
    "interpMethod": "Linear",
    "extrapMethod": "Flat",
    "dates": curve_dates,
    "values": discount_values,
    "settlement": aod
}

forwardCurveObj = parseMktData(forwardCurve)
discountCurveObj = parseMktData(discountCurve)

irFRA = {
    "productType": "Forward",
    "forwardType": "IrForwardRateAgreement",
    "notionalAmount": 10000000,
    "instrumentId": "3Mx6M",
    "start": 2019.10.10,
    "maturity": 2020.01.10,
    "fixedRate": 0.028,
    "calendar": "CFET",
    "dayCountConvention": "Actual360",
    "iborIndex": "SHIBOR_3M",
    "payReceive": "Receive"
}

instrument = parseInstrument(irFRA)

npv = irForwardRateAgreementPricer(
    instrument=instrument,
    pricingDate=aod,
    discountCurve=discountCurveObj,
    forwardCurve=forwardCurveObj
)

print(npv)
// output: 3242.329429

Related functions: parseInstrument, parseMktData