K 線閉合時間
POST/api/v1.0/quote/kline-close-time批量查詢日、周、月、季、年 K 線在常規交易時段的理論閉合時間。請求和響應時間均使用 Unix 微秒,輸入時間不足 1 秒的部分向下取整到整秒。
請求參數
| 參數 | 類型 | 位置 | 必填 | 說明 |
|---|---|---|---|---|
req_item | object[] | 請求體 | 是 | 查詢項列表,每次 1 到 400 項 |
req_item[].market_code | integer | 請求體 | 否 | 市場代碼;同時提供多種標識時優先級高於 security_id 和 src_code_item |
req_item[].security_id | integer | 請求體 | 否 | 證券內部 ID |
req_item[].src_code_item | object | 請求體 | 否 | 交易代碼及交易所對象 |
req_item[].src_code_item.src_code | string | 請求體 | 否 | 交易所交易代碼,如 AAPL |
req_item[].src_code_item.exchange | string | 請求體 | 否 | 交易所標識,如 US |
req_item[].broker_id | integer | 請求體 | 否 | 券商 ID,僅數字貨幣使用 |
req_item[].kline_type_v2 | object | 請求體 | 是 | K 線週期對象 |
req_item[].kline_type_v2.base_type | integer | 請求體 | 是 | 基礎週期:支持 3(日)、4(周)、5(月)、6(季)、7(年);其他取值會觸發單項失敗(success=false) |
req_item[].kline_type_v2.custom_number | integer | 請求體 | 是 | 週期倍數,常規週期傳 1 |
req_item[].time_list | object[] | 請求體 | 是 | 待查詢的 K 線時間列表(非空) |
req_item[].time_list[].time_key | integer | 請求體 | 是 | K 線時間,正整數,Unix 微秒時間戳;使用歷史 K 線返回的毫秒 time_key 時需乘以 1000 |
請求示例
bash
curl -s -X POST "https://webapi.futunn.com/api/v1.0/quote/kline-close-time" \
-H "Authorization: Bearer <AccessToken>" \
-H "Content-Type: application/json" \
-d '{"req_item":[{"market_code":1,"kline_type_v2":{"base_type":3,"custom_number":1},"time_list":[{"time_key":1793548800000000}]}]}'響應字段
以下為 data 內字段。
| 字段 | 類型 | 說明 |
|---|---|---|
items | object[] | 按請求順序返回的各查詢項結果 |
items[].market_code | integer | 回顯請求中的市場代碼,未傳時省略 |
items[].security_id | string | 回顯請求中的證券 ID(數字字符串形式),未傳時省略 |
items[].src_code_item | object | 回顯請求中的交易代碼及交易所對象,未傳時省略 |
items[].src_code_item.src_code | string | 交易所交易代碼 |
items[].src_code_item.exchange | string | 交易所標識 |
items[].broker_id | integer | 回顯請求中的數字貨幣券商 ID,未傳時省略 |
items[].kline_type_v2 | object | 回顯請求的 K 線週期對象 |
items[].kline_type_v2.base_type | integer | 基礎週期(失敗項可能回顯不支持的取值) |
items[].kline_type_v2.custom_number | integer | 週期倍數 |
items[].success | boolean | 該項是否計算成功;即使頂層 code=0 也需逐項檢查 |
items[].time_list | object[] | K 點和對應的理論閉合時間列表 |
items[].time_list[].time_key | integer | K 點時間,Unix 微秒時間戳 |
items[].time_list[].close_time | integer | 理論閉合時間,Unix 微秒時間戳;無法計算或單項失敗時省略 |
響應示例
示例中的港股日 K 理論閉合時間對應香港時間 2026 年 11 月 2 日 16:00。
json
{
"code": 0,
"message": "success",
"data": {
"items": [
{
"kline_type_v2": {
"base_type": 3,
"custom_number": 1
},
"market_code": 1,
"success": true,
"time_list": [
{
"close_time": 1793606400000000,
"time_key": 1793548800000000
}
]
}
]
}
}將請求示例的 base_type 改為 2(分鐘)時,批次仍返回 code=0,該項返回 success=false 並省略 close_time:
json
{
"code": 0,
"message": "success",
"data": {
"items": [
{
"kline_type_v2": {
"base_type": 2,
"custom_number": 1
},
"market_code": 1,
"success": false,
"time_list": [
{
"time_key": 1793548800000000
}
]
}
]
}
}錯誤碼
失敗響應(code != 0)會在頂層附加 trace_id(code=0 時省略)。
| code | 說明 |
|---|---|
| -3 | 請求體或參數不合法,例如 req_item 為空或超過 400 項、缺少 kline_type_v2 / time_list 或 time_key 小於 1 |
| -5 | 內部計算處理失敗 |
| -9 | 當前訪問策略拒絕 |
| -11 | 請求過於頻繁,按 Retry-After 秒數退避 |
| -13 | 限頻服務暫不可用 |
說明
- 每項需提供
market_code、security_id、src_code_item之一;同時提供多個時按market_code→security_id→src_code_item順序選取。 code=0僅表示批量請求已受理,需逐項檢查items[].success;缺失close_time表示未計算出閉合時間,不應按 0 處理。