量化 Python API 文檔詳情
GET/api/v1.0/quote/quant-python-docs/details按目錄中的精確 symbol 查詢量化 Python API 文檔正文,locale 須與目錄一致。需登錄用戶;docs 按請求順序返回命中項,未找到的 symbol 列入 not_found,全部未命中時接口仍返回成功。
請求參數
| 參數 | 類型 | 位置 | 必填 | 說明 |
|---|---|---|---|---|
locale | string | 查詢 | 否 | 語言,默認 zh-CN,支持 zh-CN、zh-HK、en、ja-JP |
symbols | string[] | 查詢 | 是 | 精確 symbol 列表,需傳 1 到 20 個;查詢多個值時重複傳入同名查詢參數 |
請求示例
bash
curl -s "https://webapi.futunn.com/api/v1.0/quote/quant-python-docs/details?locale=en&symbols=abs&symbols=int" \
-H "Authorization: Bearer <AccessToken>"響應字段
以下為 data 內字段。
| 字段 | 類型 | 說明 |
|---|---|---|
locale | string | 實際使用的語言 |
docs | object[] | 找到的文檔列表,按請求順序排列 |
docs[].symbol | string | 精確 symbol |
docs[].category | string | 分類:function、builtin、enum |
docs[].kind | string | 種類:function、method、attribute、constant、class |
docs[].package | string | 分組名 |
docs[].module | string | 可 import 的模塊名 |
docs[].import_stmt | string | 導入語句,內置函數可能為空串 |
docs[].signature | string | 句法 |
docs[].return_type | string | 返回類型 |
docs[].title | string | 標題 |
docs[].summary | string | 一行簡介,來源缺失時為空串 |
docs[].returns | string | 返回值說明 |
docs[].params | string | 參數 JSON 字符串 |
docs[].example_src | string | 示例代碼,來源缺失時為空串 |
docs[].body_md | string | 正文 Markdown,來源缺失時為空串 |
not_found | string[] | 該語言下沒有已發佈文檔的原始 symbol 列表,全部命中時為空數組 |
響應示例
json
{
"code": 0,
"message": "success",
"data": {
"locale": "en",
"docs": [
{
"symbol": "abs",
"category": "builtin",
"kind": "function",
"package": "builtins",
"module": "builtins",
"import_stmt": "",
"signature": "abs(x)",
"return_type": "number",
"title": "abs",
"summary": "Return the absolute value.",
"returns": "Absolute value of x.",
"params": "[{\"name\":\"x\"}]",
"example_src": "abs(-3)",
"body_md": "Returns the absolute value of a number."
}
],
"not_found": [
"int"
]
}
}錯誤碼
失敗響應(code != 0)會在頂層附加 trace_id(code=0 時省略)。
| code | 說明 |
|---|---|
| -3 | 請求參數不合法,例如缺失 symbols、symbols 超過 20 項或 locale 不在允許範圍內 |
| -5 | 未登錄、用戶歸屬地不在支持範圍(支持 CN/HKG/US/SG/AU/JP)或內部查詢失敗 |
| -9 | 當前訪問策略拒絕 |
| -11 | 請求過於頻繁,按 Retry-After 秒數退避 |
| -13 | 限頻服務暫不可用 |