creditCurveBuilder

First introduced in version: 3.00.6

Syntax

creditCurveBuilder(referenceDate, currency, instNames, terms, quotes, dayCountConvention, discountCurve, [curveName])

Details

Builds a credit curve.

Parameters

referenceDate is a DATE scalar indicating the reference date of the curve.

currency is a STRING scalar indicating the currency in which the curve is defined. Currently, only "CNY" is supported.

instNames is a STRING vector indicating the tenors of credit default swap (CDS). Currently, only "CFETS-SHCH-GTJA" is supported.

terms is a vector of DURATION type, indicating the remaining maturity, e.g., 3M. It must be strictly increasing.

quotes is a numeric vector indicating the market quotes of CDS, e.g., 0.0241.

Note:
instNames, terms, and quotes should have the length and contain at least two elements.

dayCountConvention is a STRING scalar indicating the day count convention to use. It can be:

  • "Actual360": actual/360
  • "Actual365": actual/365
  • "ActualActualISMA": actual/actual according to ISMA (International Securities Market Association) convention
  • "ActualActualISDA": actual/actual according to ISDA (International Swaps and Derivatives Association) convention
  • "Thirty360EU": European 30/360
  • "Thirty360US": US (NASD) 30/360

discountCurve is a MKTDATA object of type IrYieldCurve indicating the discount curve.

curveName (optional) is a STRING scalar indicating the yield curve name.

Returns

A MKTDATA object of type CreditCurve indicating the credit curve.

Examples

Builds a credit curve.

// =====================================================
// I. Define the constructor for the discount zero-coupon yield curve
// =====================================================
def createCnyFr007CurveForCreditCurve(asOfDate){
    pillarDates = asOfDate + [2, 8, 93, 185, 276, 367, 732, 1099, 1463, 1828, 2558, 3654]
    pillarValues = [
        0.0145993931630537,
        0.0229075517972275,
        0.0253020667393029,
        0.0257564866303201,
        0.0259751440992468,
        0.0260355181480,
        0.0265336263145,
        0.0272721454114,
        0.0282024453631,
        0.0290231222076,
        0.0304665029489,
        0.0319855013976
    ]
    discountCurveDict = {
        "mktDataType": "Curve",
        "curveType": "IrYieldCurve",
        "referenceDate": asOfDate,
        "currency": "CNY",
        "curveName": "CNY_FR_007",
        "dayCountConvention": "Actual365",
        "compounding": "Continuous",
        "interpMethod": "Linear",
        "extrapMethod": "Flat",
        "frequency": "NoFrequency",
        "dates": pillarDates,
        "values": pillarValues
    }
    return parseMktData(discountCurveDict)
}
// =====================================================
// II. Set the valuation date, credit curve name, and reference entity information
// =====================================================
aod = 2020.09.07
curveName = "CFETS-SHCH-GTJA"
currency = "CNY"
instName = "CFETS-SHCH-GTJA"
instNames = take(instName, 7)
// =====================================================
// III. Set the CDS tenors and market quotes required for credit curve calibration
// =====================================================
terms = [3M, 6M, 1y, 2y, 3y, 4y, 5y]
quotes = [26.94, 29.60, 31.84, 34.22, 36.73, 42.23, 48.68] * 0.0001
// =====================================================
// IV. Generate the discount curve
// =====================================================
discountCurve = createCnyFr007CurveForCreditCurve(aod)
// =====================================================
// V. Call creditCurveBuilder to build the credit curve
// =====================================================
creditCurve = creditCurveBuilder(
    aod,
    currency,
    instNames,
    terms,
    quotes,
    "Actual365",
    discountCurve,
    curveName
)
// =====================================================
// VI. Output the constructed credit curve
// =====================================================
print(creditCurve)

Releated links: creditDefaultSwapPricer, parseInstrument, parseMktData