基金搜索
/v1/fund-search免费按代码、名称或拼音首字母模糊搜索,返回代码与全名。免费端点,不填 key 也能调。
回答的问题:用户只给了一个基金名或拼音缩写,怎么换成代码?
请求参数
| 参数 | 必填 | 类型 | 默认 | 说明 |
|---|---|---|---|---|
q | ✅ | string | — | 关键词:代码 / 名称 / 拼音首字母,1–50 字符 |
limit | — | int | 20 | 返回条数,1–50 |
key | — | string | — | API Key(免费端点可不填,匿名限流更严) |
响应字段
| 字段 | 类型 | 说明 |
|---|---|---|
keyword | string | 回显搜索词 |
count | int | 本次返回条数 |
list[].code | string | 6 位基金代码 |
list[].name | string | 基金全名 |
list[].type | string | 类型描述 |
list[].pinyin | string | 拼音首字母(大写) |
list[].category_code | int | 分类编码,可与筛选项字典对照 |
真实响应样例
用 110022 实抓的真实响应。列表类字段已截短以便阅读(原始响应更完整); 其中的 elapsed_ms 是某一次的耗时,首次请求通常 1–3 秒。
{
"ok": true,
"endpoint": "fund-search",
"tier": "institutional",
"elapsed_ms": 1057,
"data": {
"keyword": "易方达",
"count": 3,
"list": [
{
"code": "110006",
"name": "易方达货币A",
"type": "基金",
"pinyin": "YFDHBA",
"category_code": 700
},
{
"code": "110016",
"name": "易方达货币B",
"type": "基金",
"pinyin": "YFDHBB",
"category_code": 700
},
{
"code": "002602",
"name": "易方达丰惠混合",
"type": "基金",
"pinyin": "YFDFHHH",
"category_code": 700
}
]
}
}调用示例
curl "https://api.fundapi.cn/v1/fund-search?code=110022" \ -H "Authorization: Bearer 你的API Key" \ -H "User-Agent: your-app"
注意
`limit` 是上限,不是保证
关键词太宽(如只输「易」)会命中大量结果,此时按 `limit` 截断。建议先用完整名称或代码缩小范围。
`category_code` 不是分类 id
它是一个数字编码,用于和 `/v1/fund-screener-options` 对照,⛔ 不要直接拿它当筛选项参数传回。