---
source_url: https://docs.dolphindb.cn/zh/funcs/b/bondYieldCurveBuilder.html
fetched_at: 2026-05-19T09:14:05Z
category: funcs
title: bondYieldCurveBuilder
sha1: 954f1dd98b28981da346a47a6df87810ac1b84aa
---

# bondYieldCurveBuilder

首发版本：3.00.4

## 语法

`bondYieldCurveBuilder(referenceDate, currency, bonds,
terms, quotes, dayCountConvention, [compounding='Compounded'],
[frequency='Annual'], [curveName], [method='Bootstrap'],
[interpMethod='Linear'], [extrapMethod='Flat'])`

## 详情

构建债券收益率曲线，可作为定价时使用的贴现曲线（即期收益率曲线）。

## 参数

**referenceDate** DATE 类型标量，收益率曲线的参考日期。

**currency** STRING 类型标量，表示曲线所定义的货币，可选值为：

- "CNY"：人民币
- "USD"：美元
- "EUR"：欧元
- "GBP"：英镑
- "JPY"：日元
- "HKD"：港币

**bonds** INSTRUMENT 类型向量，表示用于曲线构建的样本债券，包含各债券的基本信息。不同类型的债券产品所需的关键字段各不相同，详见[债券产品字段要求](#topic_e5t_sl2_ngc)。

**terms** DURATION 类型的严格递增向量，与 *bonds* 等长，表示样本券的剩余期限。

**quotes** 数值类型的向量，与 *bonds* 等长，表示每只债券在 *referenceDate*
当日的到期收益率（YTM）报价。

**dayCountConvention** STRING 类型标量，表示计息日数规则，可选值为：

- "Actual360": 实际/360
- "Actual365": 实际/365
- "ActualActualISDA"：实际/实际，遵循 ISDA（International Swaps and Derivatives
  Association，国际掉期及衍生工具协会）规则
- "ActualActualISMA": 实际/实际，遵循 ISMA（International Securities Market
  Association，国际证券市场协会）规则

**compounding** 可选参数，STRING 类型标量，表示利率复利方式。可选值为：

- "Compounded"：默认值，离散复利。
- "Simple"：简单复利。
- "Continuous"：连续复利。

**frequency** 可选参数，STRING
类型标量，表示曲线的频率，用于指定曲线的频率，不影响曲线构建，仅会记录在返回的曲线中，默认值为“Annual”。可选值为：

- "Annual"：默认值，每年付息一次
- "NoFrequency"：无计息频率
- "Once"：到期一次还本付息，仅用于贴现债和零息债
- "Semiannual"：每半年付息一次
- "EveryFourthMonth"：每四个月付息一次
- "Quarterly"：每季度付息一次
- "BiMonthly"：每两月付息一次
- "Monthly"：每月付息一次
- "EveryFourthWeek"：每四周付息一次
- "BiWeekly"：每两周付息一次
- "Weekly"：每周付息一次
- "Daily"：每日付息一次
- "Other"：其他计息频率

**curveName** 可选参数，STRING 类型标量，表示生成的曲线名称，默认为空。

**method** 可选参数，STRING 类型标量，表示曲线构建方法。 可选值为：

- "Bootstrap"：默认值，拨靴法。
- "NS"：Nelson-Siegel 模型，至少需要 4 个样本点输入用于曲线构建。
- "NSS"：Nelson-Siegel-Svensson 模型，至少需要 6 个样本点输入用于曲线构建。

**interpMethod** 可选参数，STRING 类型标量，表示内插方法。可选值为：

- "Linear"：默认值，线性插值。
- "CubicSpline"：三次样条插值。
- "CubicHermiteSpline"：三次埃尔米特样条插值。

**extrapMethod** 可选参数，STRING 类型标量，表示外插方法。可选值为：

- "Flat"：默认值，平插。
- "Linear"：线性插值。

## 返回值

MKTDATA 类型对象。

## 例子

基于2025年8月18日的国债市场数据构建收益率曲线。

```dolphindb
bond1 = {
    "productType": "Cash",
    "assetType": "Bond",
    "bondType": "DiscountBond",
    "instrumentId": "259916.IB",
    "start": 2025.03.13,
    "maturity": 2025.09.11,
    "issuePrice":  99.2070,
    "dayCountConvention": "ActualActualISDA"
}
bond2 = {
    "productType": "Cash",
    "assetType": "Bond",
    "bondType": "FixedRateBond",
    "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",
    "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",
    "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",
    "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",
    "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",
    "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",
    "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",
    "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",
    "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",
    "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",
    "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",
    "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",
    "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)
```

本案例参考外汇交易中心标准期限[收盘收益率曲线历史数据下载\_中国货币网](https://www.chinamoney.com.cn/chinese/bkcurvclosedyhis/index.html)，样本券的剩余期限（term）和报价（quote）均为模拟数据。

```dolphindb
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)
```

实际应用中，应根据样本券到期日减去曲线参考日期计算剩余期限，并使用实际到期收益率（YTM）报价参与曲线构建，以符合 CFETS 债券收盘估值标准，[债券估值\_债券收盘估值\_债券动态估值\_中国货币网](https://www.chinamoney.com.cn/chinese/bkval/)。

```dolphindb
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)
```

**相关函数：**[extractMktData](../e/extractMktData.html),
[parseInstrument](../p/parseInstrument.html)

## 债券产品字段要求

**贴现债**

| 字段名 | 类型 | 描述 | 是否必填 |
| --- | --- | --- | --- |
| productType | STRING | 固定填 "Cash" | 是 |
| assetType | STRING | 固定填 "Bond" | 是 |
| bondType | STRING | 固定填 "DiscountBond" | 是 |
| nominal | DOUBLE | 名义金额，默认值 100 | 否 |
| instrumentId | STRING | 债券代码，如 "259926.IB" | 否 |
| start | DATE | 起息日 | 是 |
| maturity | DATE | 到期日 | 是 |
| dayCountConvention | STRING | 日期计数惯例，可选 "ActualActualISDA", "ActualActualISMA", "Actual365", "Actual360" | 是 |
| issuePrice | DOUBLE | 发行价格 | 是 |
| currency | STRING | 货币，默认为 "CNY" | 否 |
| cashFlow | TABLE | 债券现金流表 | 否 |
| discountCurve | STRING | 定价时参考的贴现曲线名称，如 "CNY\_TRASURY\_BOND" | 否 |
| spreadCurve | STRING | 定价时参考的利差曲线名称 | 否 |
| subType | STRING | 债券子类型，中国债券可选值为：   - "TREASURY\_BOND"：国债 - "CENTRAL\_BANK\_BILL"：央行票据 - "CDB\_BOND"：政策性金融债（国开） - "EIBC\_BOND"：政策性金融债（进出口行） - "ADBC\_BOND"：政策性金融债（农发行）。 - "MTN"：中期票据 - "CORP\_BOND"：企业债。 - "UNSECURED\_CORP\_BOND"：无担保企业债 - "SHORT\_FIN\_BOND"：短期融资券 - "NCD"：同业存单 - "LOC\_GOV\_BOND"：地方政府债 - "COMM\_BANK\_FIN\_BOND"：商业银行普通金融债 - "BANK\_SUB\_CAP\_BOND"：商业银行二级资本债 - "ABS"：资产支持证券 - "PPN"：非公开发行债 | 否 |
| creditRating | STRING | 信用等级类型，可选值为："B", "BB", "BBB", "BBB+", "A-", "A", "A+", "AA-", "AA", "AA+", "AAA-", "AAA", "AAA+" | 否 |

**零息债**

| 字段名 | 类型 | 描述 | 是否必填 |
| --- | --- | --- | --- |
| productType | STRING | 固定填 "Cash" | 是 |
| assetType | STRING | 固定填 "Bond" | 是 |
| bondType | STRING | 固定填 "ZeroCouponBond" | 是 |
| nominal | DOUBLE | 名义金额，默认值 100 | 否 |
| instrumentId | STRING | 债券代码，如 "250401.IB" | 否 |
| start | DATE | 起息日 | 是 |
| maturity | DATE | 到期日 | 是 |
| coupon | DOUBLE | 票面利率，如 0.03 表示 3% | 是 |
| frequency | STRING | 付息频率 | 否 |
| dayCountConvention | STRING | 日期计数惯例，可选 "ActualActualISDA", "ActualActualISMA", "Actual365", "Actual360" | 是 |
| currency | STRING | 货币，默认为 "CNY" | 否 |
| cashFlow | TABLE | 债券现金流表 | 否 |
| discountCurve | STRING | 定价时参考的贴现曲线名称，如 "CNY\_TRASURY\_BOND" | 否 |
| spreadCurve | STRING | 定价时参考的利差曲线名称 | 否 |
| subType | STRING | 债券子类型，中国债券可选值为：   - "TREASURY\_BOND"：国债 - "CENTRAL\_BANK\_BILL"：央行票据 - "CDB\_BOND"：政策性金融债（国开） - "EIBC\_BOND"：政策性金融债（进出口行） - "ADBC\_BOND"：政策性金融债（农发行）。 - "MTN"：中期票据 - "CORP\_BOND"：企业债。 - "UNSECURED\_CORP\_BOND"：无担保企业债 - "SHORT\_FIN\_BOND"：短期融资券 - "NCD"：同业存单 - "LOC\_GOV\_BOND"：地方政府债 - "COMM\_BANK\_FIN\_BOND"：商业银行普通金融债 - "BANK\_SUB\_CAP\_BOND"：商业银行二级资本债 - "ABS"：资产支持证券 - "PPN"：非公开发行债 | 否 |
| creditRating | STRING | 信用等级类型，可选值为："B", "BB", "BBB", "BBB+", "A-", "A", "A+", "AA-", "AA", "AA+", "AAA-", "AAA", "AAA+" | 否 |

**固定利率债**

| 字段名 | 类型 | 描述 | 是否必填 |
| --- | --- | --- | --- |
| productType | STRING | 固定填 "Cash" | 是 |
| assetType | STRING | 固定填 "Bond" | 是 |
| bondType | STRING | 固定填 "FixedRateBond" | 是 |
| nominal | DOUBLE | 名义金额，默认值 100 | 否 |
| instrumentId | STRING | 债券代码，如 "250401.IB" | 否 |
| start | DATE | 起息日 | 是 |
| maturity | DATE | 到期日 | 是 |
| coupon | DOUBLE | 票面利率，如0.03表示3% | 是 |
| frequency | STRING | 付息频率 | 是 |
| dayCountConvention | STRING | 日期计数惯例，可选 "ActualActualISDA", "ActualActualISMA", "Actual365", "Actual360" | 是 |
| currency | STRING | 货币，默认为 "CNY" | 否 |
| cashFlow | TABLE | 债券现金流表 | 否 |
| discountCurve | STRING | 定价时参考的贴现曲线名称，如 "CNY\_TRASURY\_BOND" | 否 |
| spreadCurve | STRING | 定价时参考的利差曲线名称 | 否 |
| subType | STRING | 债券子类型，中国债券可选值为：   - "TREASURY\_BOND"：国债 - "CENTRAL\_BANK\_BILL"：央行票据 - "CDB\_BOND"：政策性金融债（国开） - "EIBC\_BOND"：政策性金融债（进出口行） - "ADBC\_BOND"：政策性金融债（农发行）。 - "MTN"：中期票据 - "CORP\_BOND"：企业债。 - "UNSECURED\_CORP\_BOND"：无担保企业债 - "SHORT\_FIN\_BOND"：短期融资券 - "NCD"：同业存单 - "LOC\_GOV\_BOND"：地方政府债 - "COMM\_BANK\_FIN\_BOND"：商业银行普通金融债 - "BANK\_SUB\_CAP\_BOND"：商业银行二级资本债 - "ABS"：资产支持证券 - "PPN"：非公开发行债 | 否 |
| creditRating | STRING | 信用等级类型，可选值为："B", "BB", "BBB", "BBB+", "A-", "A", "A+", "AA-", "AA", "AA+", "AAA-", "AAA", "AAA+" | 否 |
