bondYieldCurveBuilder
Syntax
bondYieldCurveBuilder(referenceDate, currency, bonds, terms, quotes,
dayCountConvention, [compounding='Compounded'], [frequency='Annual'],
[curveName], [method='Bootstrap'], [interpMethod='Linear'],
[extrapMethod='Flat'])
Details
Builds a bond yield curve to be used as a discount curve (i.e., a spot yield curve) in pricing applications.
Return value: A MKTDATA object.
Arguments
referenceDate A DATE scalar, representing the reference date of the yield curve.
currency A STRING scalar specifying the currency code of the curve. Supported values: "CNY", "USD", "EUR", "GBP", "JPY", "HKD".
bonds An INSTRUMENT vector, specifying the sample bonds used for curve construction with bond metadata. See Bond Product Field Specifications for details.
terms A DURATION vector of the same length as bonds, indicating the remaining term to maturity of each bond.
quotes A numeric vector of the same length as bonds, indicating the yield to maturity (YTM) of each bond on the referenceDate.
dayCountConvention A STRING scalar indicating the day count convention to use. It can be:
-
"Actual360": actual/360
-
"Actual365": actual/365
-
"ActualActualISDA" —actual/actual according to ISDA (International Swaps and Derivatives Association) convention
-
"ActualActualISMA" — actual/actual according to ISMA (International Securities Market Association) convention
compounding (optional) A STRING scalar defining the compounding method. Options:
-
"Compounded" (default): Discrete compounding
-
"Simple": Simple interest
-
"Continuous": Continuous compounding
frequency (optional) A STRING scalar specifying the interest payment frequency. It does not affect curve construction and is only recorded in the returned curve. Supported values:
-
"Annual" (default): Annually
-
"NoFrequency": No payment frequency
-
"Once": Single payment at maturity (for discount bonds and zero coupon bonds only)
-
"Semiannual": Semiannually
-
"EveryFourthMonth": Every four months
-
"Quarterly": Quarterly
-
"BiMonthly": Every two months
-
"Monthly": Monthly
-
"EveryFourthWeek": Every four weeks
-
"BiWeekly": Every two weeks
-
"Weekly": Weekly
-
"Daily": Daily
-
"Other": Other frequencies
curveName (optional) A STRING scalar indicating the yield curve name. The default value is NULL.
method (optional) A STRING scalar specifying the curve construction method. Options:
-
"Bootstrap" (default): Bootstrap method
-
"NS": Nelson-Siegel model
-
"NSS": Nelson-Siegel-Svensson model
interpMethod (optional) A STRING scalar specifying the interpolation method. Options:
-
"Linear" (default): Linear interpolation
-
"CubicSpline": Cubic spline
-
"CubicHermiteSpline": Cubic Hermite spline
extrapMethod (optional) A STRING scalar for the extrapolation method. Options:
-
"Flat" (default): Flat extrapolation
-
"Linear": Linear extrapolation
Examples
Build a yield curve based on the Chinese government bond market data as of August 18, 2025.
bond1 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "DiscountBond",
"version": 0,
"instrumentId": "259916.IB",
"start": 2025.03.13,
"maturity": 2025.09.11,
"issuePrice": 99.2070,
"dayCountConvention": "ActualActualISDA"
}
bond2 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "FixedRateBond",
"version": 0,
"instrumentId": "240021.IB",
"start": 2024.10.25,
"maturity": 2025.10.25,
"issuePrice": 100,
"coupon": 0.0133,
"frequency": "Annual",
"dayCountConvention": "ActualActualISDA"
}
bond3 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "FixedRateBond",
"version": 0,
"instrumentId": "250001.IB",
"start": 2025.01.15,
"maturity": 2026.01.15,
"issuePrice": 100,
"coupon": 0.0116,
"frequency": "Annual",
"dayCountConvention": "ActualActualISDA"
}
bond4 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "FixedRateBond",
"version": 0,
"instrumentId": "250013.IB",
"start": 2025.07.25,
"maturity": 2026.07.25,
"issuePrice": 100,
"coupon": 0.0133,
"frequency": "Annual",
"dayCountConvention": "ActualActualISDA"
}
bond5 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "FixedRateBond",
"version": 0,
"instrumentId": "250012.IB",
"start": 2025.06.15,
"maturity": 2027.06.15,
"issuePrice": 100,
"coupon": 0.0138,
"frequency": "Annual",
"dayCountConvention": "ActualActualISDA"
}
bond6 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "FixedRateBond",
"version": 0,
"instrumentId": "250010.IB",
"start": 2025.05.25,
"maturity": 2028.05.25,
"issuePrice": 100,
"coupon": 0.0146,
"frequency": "Annual",
"dayCountConvention": "ActualActualISDA"
}
bond7 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "FixedRateBond",
"version": 0,
"instrumentId": "250014.IB",
"start": 2025.07.25,
"maturity": 2030.07.25,
"issuePrice": 100,
"coupon": 0.0155,
"frequency": "Annual",
"dayCountConvention": "ActualActualISDA"
}
bond8 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "FixedRateBond",
"version": 0,
"instrumentId": "2500802.IB",
"start": 2025.05.25,
"maturity": 2032.05.25,
"issuePrice": 100,
"coupon": 0.0157,
"frequency": "Annual",
"dayCountConvention": "ActualActualISDA"
}
bond9 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "FixedRateBond",
"version": 0,
"instrumentId": "250011.IB",
"start": 2025.05.25,
"maturity": 2035.05.25,
"issuePrice": 100,
"coupon": 0.0167,
"frequency": "Semiannual",
"dayCountConvention": "ActualActualISDA"
}
bond10 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "FixedRateBond",
"version": 0,
"instrumentId": "2400102.IB",
"start": 2024.08.29,
"maturity": 2039.08.29,
"issuePrice": 100,
"coupon": 0.0225,
"frequency": "Semiannual",
"dayCountConvention": "ActualActualISDA"
}
bond11 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "FixedRateBond",
"version": 0,
"instrumentId": "2500004.IB",
"start": 2025.07.15,
"maturity": 2045.07.15,
"issuePrice": 100,
"coupon": 0.0192,
"frequency": "Semiannual",
"dayCountConvention": "ActualActualISDA"
}
bond12 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "FixedRateBond",
"version": 0,
"instrumentId": "2500005.IB",
"start": 2025.07.15,
"maturity": 2055.07.15,
"issuePrice": 100,
"coupon": 0.019,
"frequency": "Semiannual",
"dayCountConvention": "ActualActualISDA"
}
bond13 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "FixedRateBond",
"version": 0,
"instrumentId": "200007.IB",
"start": 2020.05.25,
"maturity": 2070.05.25,
"issuePrice": 100,
"coupon": 0.0373,
"frequency": "Semiannual",
"dayCountConvention": "ActualActualISDA"
}
bond14 = {
"productType": "Cash",
"assetType": "Bond",
"bondType": "FixedRateBond",
"version": 0,
"instrumentId": "2400003.IB",
"start": 2024.06.15,
"maturity": 2074.06.15,
"issuePrice": 100,
"coupon": 0.0253,
"frequency": "Semiannual",
"dayCountConvention": "ActualActualISDA"
}
referenceDate = 2025.08.18
bondsTmp = [bond1, bond2, bond3, bond4, bond5, bond6, bond7, bond8, bond9,
bond10, bond11, bond12, bond13, bond14]
bonds = parseInstrument(bondsTmp)
This example uses the standard tenors from the China Foreign Exchange Trade System (CFETS, CFETS Closing Yield Curves- Historical Data - CFETS), with sample bonds’ remaining terms and quotes being simulated.
terms = [1M, 3M, 6M, 1y, 2y, 3y, 5y, 7y, 10y, 15y, 20y, 30y, 40y, 50y]
quotes=[1.3000, 1.3700, 1.3898, 1.3865, 1.4296, 1.4466, 1.6348,
1.7557, 1.7875, 1.9660, 2.1300, 2.1100, 2.1556, 2.1750]/100
// method = "BoostStarp"
bootstrapCurve = bondYieldCurveBuilder(referenceDate, `CNY, bonds, terms, quotes, "ActualActualISDA", method='Bootstrap')
bootstrapCurveDict = extractMktData(bootstrapCurve)
print(bootstrapCurveDict)
// method = "NS"
nsCurve = bondYieldCurveBuilder(referenceDate, `CNY, bonds, terms, quotes, "ActualActualISDA", method='NS')
nsCurveDict = extractMktData(nsCurve)
print(nsCurveDict)
// method = "NSS"
nssCurve = bondYieldCurveBuilder(referenceDate, `CNY, bonds, terms, quotes, "ActualActualISDA", method='NSS')
nssCurveDict=extractMktData(nssCurve)
print(nssCurveDict)
In practice, the remaining term should be calculated as the difference between the bond’s maturity date and the curve reference date, and the actual YTM quotes should be used to construct the curve, in accordance with CFETS bond closing valuation(Bond Valuation Dynamic and Closing - CFETS ).
terms2 = array(DURATION)
for(bond in bondsTmp){
term = duration(string(bond["maturity"] - referenceDate)+"d")
terms2.append!(term)
}
quotes2 = [1.2799, 1.3440, 1.3450, 1.3849, 1.4200, 1.4450, 1.6295,
1.7350, 1.7860, 2.0493, 2.1304, 2.1140, 2.1558, 2.1728] / 100
// method = "BoostStarp"
bootstrapCurve2 = bondYieldCurveBuilder(referenceDate, `CNY, bonds, terms2, quotes2, "ActualActualISDA", method='Bootstrap')
bootstrapCurveDict2 = extractMktData(bootstrapCurve2)
print(bootstrapCurveDict2)
// method = "NS"
nsCurve2 = bondYieldCurveBuilder(referenceDate, `CNY, bonds, terms2, quotes2, "ActualActualISDA", method='NS')
nsCurveDict2 = extractMktData(nsCurve2)
print(nsCurveDict2)
// method = "NSS"
nssCurve2 = bondYieldCurveBuilder(referenceDate, `CNY, bonds, terms2, quotes2, "ActualActualISDA",method='NSS')
nssCurveDict2 =extractMktData(nssCurve2)
print(nssCurveDict2)
Related functions: extractMktData, parseInstrument
Bond Product Field Specifications
Discount Bond
| Field Name | Data Type | Description | Required |
|---|---|---|---|
| productType | STRING | Must be "Cash" | √ |
| assetType | STRING | Must be "Bond" | √ |
| bondType | STRING | Must be "DiscountBond" | √ |
| version | INT | Version, default 0 | × |
| nominal | DOUBLE | Nominal amount, defalut 100 | × |
| instrumentId | STRING | Bond code, e.g., "259926.IB" | × |
| start | DATE | Value date | √ |
| maturity | DATE | Maturity date | √ |
| dayCountConvention | STRING | The day count convention. It can be: "ActualActualISDA", "ActualActualISMA"," Actual365", "Actual360" | √ |
| issuePrice | DOUBLE | Issue price | √ |
| currency | STRING | Currency, defaults to "CNY" | × |
| cashFlow | TABLE | Cash flow table | × |
| discountCurve | STRING | The discount curve, e.g., "CNY_TRASURY_BOND" | × |
| spreadCurve | STRING | The credit spread curve | × |
| subType | STRING |
Subtypes. China's bonds include:
|
× |
| creditRating | STRING | Credit rating. It can be: "B", "BB", "BBB", "BBB+", "A-", "A", "A+", "AA-", "AA", "AA+", "AAA-", "AAA", "AAA+" | × |
Zero Coupon Bond
| Field Name | Data Type | Description | Required |
|---|---|---|---|
| productType | STRING | Must be "Cash" | √ |
| assetType | STRING | Must be "Bond" | √ |
| bondType | STRING | Must be "ZeroCouponBond" | √ |
| version | INT | Version, default 0 | × |
| nominal | DOUBLE | Nominal amount, defalut 100 | × |
| instrumentId | STRING | Bond code, e.g., "259926.IB" | × |
| start | DATE | Value date | √ |
| maturity | DATE | Maturity date | √ |
| coupon | DOUBLE | Coupon rate, e.g., 0.03 means 3% | √ |
| frequency | STRING | Frequency of interest payment | × |
| dayCountConvention | STRING | The day count convention. It can be: "ActualActualISDA", "ActualActualISMA"," Actual365", "Actual360" | √ |
| currency | STRING | Currency, defaults to "CNY" | × |
| cashFlow | TABLE | Cash flow table | × |
| discountCurve | STRING | The discount curve, e.g., "CNY_TRASURY_BOND" | × |
| spreadCurve | STRING | The credit spread curve | × |
| subType | STRING |
Subtypes. China's bonds include:
|
× |
| creditRating | STRING | Credit rating. It can be: "B", "BB", "BBB", "BBB+", "A-", "A", "A+", "AA-", "AA", "AA+", "AAA-", "AAA", "AAA+" | × |
Fixed Rate Bond
| Field Name | Data Type | Description | Required |
|---|---|---|---|
| productType | STRING | Must be "Cash" | √ |
| assetType | STRING | Must be "Bond" | √ |
| bondType | STRING | Must be "FixedRateBond" | √ |
| version | INT | Version, default 0 | × |
| nominal | DOUBLE | Nominal amount, defalut 100 | × |
| instrumentId | STRING | Bond code, e.g., "259926.IB" | × |
| start | DATE | Value date | √ |
| maturity | DATE | Maturity date | √ |
| coupon | DOUBLE | Coupon rate, e.g., 0.03 means 3% | √ |
| frequency | STRING | Frequency of interest payment | √ |
| dayCountConvention | STRING | The day count convention. It can be: "ActualActualISDA", "ActualActualISMA"," Actual365", "Actual360" | √ |
| currency | STRING | Currency, defaults to "CNY" | × |
| cashFlow | TABLE | Cash flow table | × |
| discountCurve | STRING | The discount curve, e.g., "CNY_TRASURY_BOND" | × |
| spreadCurve | STRING | The credit spread curve | × |
| subType | STRING |
Subtypes. China's bonds include:
|
× |
| creditRating | STRING | Credit rating. It can be: "B", "BB", "BBB", "BBB+", "A-", "A", "A+", "AA-", "AA", "AA+", "AAA-", "AAA", "AAA+" | × |
