接入文档
接口简介
本接口提供单只基金的详细业绩表现数据。通过传入基金代码,返回该基金在不同时间维度(近一周、近一月、近一季、今年以来、近两年、近三年、近五年)的涨跌幅、同类平均涨跌幅、同类排名以及相对于沪深300指数的超额收益情况。
适用场景
- 金融资讯应用:在基金详情页展示多维度的历史业绩走势与排名。
- 投研分析工具:量化分析基金长期稳定性,对比同类平均水平与基准指数。
- 智能投顾系统:基于历史排名和收益率筛选优质基金标的。
请求与返回说明
- 请求方式:POST
- 核心参数:
fundCode(字符串,必填),即需要查询的基金六位代码。 - 返回数据:
data.lastWeek/lastMonth/lastQuarter等:对应周期的实际涨跌幅。data.lastWeekRank/lastMonthRank等:对应周期在同类基金中的排名。data.lastWeekAvg/lastMonthAvg等:对应周期同类基金的平均涨跌幅。data.lastWeekHS300等:对应周期相对于沪深300指数的表现。data.foundDate:基金成立日期。
接入建议
- 缓存策略:基金净值与排名数据通常每日更新一次,建议对同一基金代码的查询结果进行至少24小时的本地缓存,以减少API调用成本。
- 异常处理:请检查返回的
code字段,若为非200状态码,需根据msg提示进行错误处理(如基金代码不存在)。 - 数据展示:前端展示排名时,建议结合
lastWeekCount等总数量字段,计算百分比排名(如“前10%”),提升用户阅读体验。
接入示例代码
提供 Shell、Python、Go、Java、PHP 等常见接入示例,便于直接接到现有项目里。
请求示例
{
"fundCode": "基金代码"
}响应示例
{
"code": 200,
"msg": "成功",
"taskNo": "492823910191448773171202",
"data": {
"twoYear": -38.46,
"fiveYearCount": 757,
"allYearHS300": 0,
"nowYearRank": 2499,
"lastWeekCount": 4350,
"lastMonthAvg": -2.15,
"lastMonth": 2.17,
"lastQuarterAvg": -6.32,
"thirdYearAvg": -36.24,
"lastHalfYearAvg": 7.82,
"lastHalfYearRank": 4019,
"nowYearHS300": 0.32,
"lastYearRank": 3688,
"twoYearCount": 3133,
"lastQuarter": -6.31,
"allYearCount": 0,
"fiveYearHS300": -10.25,
"lastWeekAvg": 1.56,
"lastWeekHS300": 0.7,
"foundDate": "2017-12-14",
"lastQuarterHS300": -4.5,
"lastQuarterRank": 2095,
"lastWeek": 6.51,
"lastWeekRank": 34,
"lastMonthHS300": -0.57,
"fiveYear": -27.58,
"lastYearCount": 3822,
"nowYear": -9.91,
"twoYearAvg": -27.66,
"thirdYearCount": 2063,
"lastMonthRank": 227,
"thirdYearRank": 1447,
"nowYearAvg": -7.31,
"fiveYearAvg": 22.95,
"allYearAvg": "",
"twoYearHS300": -17.46,
"lastHalfYearCount": 4171,
"allYearRank": 0,
"lastYearAvg": -17.7,
"thirdYear": -44.54,
"fiveYearRank": 737,
"allYear": -24.08,
"dataDate": "2024-07-31",
"thirdYearHS300": -28.46,
"lastHalfYearHS300": 7.05,
"lastYearHS300": -14.26,
"nowYearCount": 4123,
"twoYearRank": 2547,
"lastYear": -34.4,
"lastQuarterCount": 4295,
"lastHalfYear": -6.16,
"lastMonthCount": 4357
}
}请求字段
以下字段根据示例 JSON 自动提取,仅作接入参考。
| 字段路径 | 类型 | 示例值 |
|---|---|---|
| type | string | object |
| properties | object | {...} |
| properties.fundCode | object | {...} |
| properties.fundCode.type | string | string |
| properties.fundCode.description | string | 基金代码 |
| required | array | "fundCode" |
| required[] | string | fundCode |
响应字段
以下字段根据示例 JSON 自动提取,仅作接入参考。
| 字段路径 | 类型 | 示例值 |
|---|---|---|
| type | string | object |
| properties | object | {...} |
| properties.code | object | {...} |
| properties.code.type | string | number |
| properties.code.example | number | 200 |
| properties.code.description | string | 返回码,详见返回码说明 |
| properties.msg | object | {...} |