Latest K-line Data
curl --request GET \
--url https://api.tickdb.ai/v1/market/kline/latest \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.tickdb.ai/v1/market/kline/latest"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.tickdb.ai/v1/market/kline/latest', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tickdb.ai/v1/market/kline/latest",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tickdb.ai/v1/market/kline/latest"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.tickdb.ai/v1/market/kline/latest")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tickdb.ai/v1/market/kline/latest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "success",
"data": [
{
"symbol": "AAPL.US",
"interval": "3m",
"klines": [
{
"time": 1773259020000,
"open": "260.86",
"high": "261.05",
"low": "260.7",
"close": "260.81",
"volume": "963419",
"quote_volume": "251311057.55"
}
]
},
{
"symbol": "00700.HK",
"interval": "3m",
"klines": [
{
"time": 1773293400000,
"open": "542.5",
"high": "544.5",
"low": "542",
"close": "544.5",
"volume": "80300",
"quote_volume": "43656433.33"
}
]
}
]
}{
"code": 400,
"message": "Invalid parameters"
}{
"code": 401,
"message": "Unauthorized"
}通用行情接口
實時 K 線
獲取當前時間週期內正在形成並實時更新的 K 線數據。
GET
/
v1
/
market
/
kline
/
latest
Latest K-line Data
curl --request GET \
--url https://api.tickdb.ai/v1/market/kline/latest \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.tickdb.ai/v1/market/kline/latest"
headers = {"X-API-Key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-Key': '<api-key>'}};
fetch('https://api.tickdb.ai/v1/market/kline/latest', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.tickdb.ai/v1/market/kline/latest",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.tickdb.ai/v1/market/kline/latest"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.tickdb.ai/v1/market/kline/latest")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tickdb.ai/v1/market/kline/latest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"code": 0,
"message": "success",
"data": [
{
"symbol": "AAPL.US",
"interval": "3m",
"klines": [
{
"time": 1773259020000,
"open": "260.86",
"high": "261.05",
"low": "260.7",
"close": "260.81",
"volume": "963419",
"quote_volume": "251311057.55"
}
]
},
{
"symbol": "00700.HK",
"interval": "3m",
"klines": [
{
"time": 1773293400000,
"open": "542.5",
"high": "544.5",
"low": "542",
"close": "544.5",
"volume": "80300",
"quote_volume": "43656433.33"
}
]
}
]
}{
"code": 400,
"message": "Invalid parameters"
}{
"code": 401,
"message": "Unauthorized"
}注意事項
- 本接口返回當前週期內正在形成的K線數據,數據會隨著成交持續更新
- 適用於實時行情圖表展示、當前價格監控、分時動態更新
- 不建議用於歷史回測、技術指標統計、固定數據存儲
- 若需查詢已結束週期的數據,請使用歷史K線:
/v1/market/kline
支持的市場
外匯、貴金屬、指數、美股、港股、A股、中國期貨、加密貨幣 示例:- 外匯:EURUSD、GBPUSD、USDJPY
- 貴金屬:XAUUSD、XAGUSD
- 指數:SPX、NDX、DJI
- 美股:AAPL.US、TSLA.US、MSFT.US
- 港股:700.HK、9988.HK、3690.HK
- A股:600519.SH、000001.SZ、920186.BJ
- 中國期貨:BU2609、IC2606、AP8888
- 加密貨幣:BTCUSDT、ETHUSDT、ADAUSDT
請求參數
| 參數名 | 是否必須 | 描述 |
|---|---|---|
| symbols | 是 | 交易產品代碼,多個用逗號分隔,例如:AAPL.US,00700.HK |
| interval | 是 | K線週期,可選值:1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 1d, 1w, 1M |
| type | 否 | 產品類型,可選。代碼無歧義時無需傳遞;若返回 AMBIGUOUS_SYMBOL 錯誤,按提示傳入對應值即可。可選值:stock、indices、crypto、forex、futures |
返回字段說明
| 字段 | 說明 |
|---|---|
| symbol | 交易產品 |
| type | 產品類型 |
| interval | K線週期 |
| klines | K線數據數組 |
| └─ time | K線時間戳(毫秒) |
| └─ open | 開盤價 |
| └─ high | 最高價 |
| └─ low | 最低價 |
| └─ close | 收盤價 |
| └─ volume | 成交量 |
| └─ quote_volume | 成交額,期貨通常不返回 |
| └─ open_interest | 持倉量,僅期貨返回 |
授權
查詢參數
Comma-separated symbols (e.g., AAPL.US,00700.HK)
範例:
"AAPL.US,00700.HK"
K-line interval
可用選項:
1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 1d, 1w, 1M 範例:
"3m"
Symbol type, optional. Not required when the symbol is unambiguous; if the API returns an AMBIGUOUS_SYMBOL error, pass the value as indicated
可用選項:
stock, indices, crypto, forex, futures 範例:
"stock"
回應
Successful response
範例:
0
範例:
"success"
Show child attributes
Show child attributes
範例:
[
{
"symbol": "AAPL.US",
"interval": "3m",
"klines": [
{
"time": 1773259020000,
"open": "260.86",
"high": "261.05",
"low": "260.7",
"close": "260.81",
"volume": "963419",
"quote_volume": "251311057.55"
}
]
},
{
"symbol": "00700.HK",
"interval": "3m",
"klines": [
{
"time": 1773293400000,
"open": "542.5",
"high": "544.5",
"low": "542",
"close": "544.5",
"volume": "80300",
"quote_volume": "43656433.33"
}
]
}
]
⌘I
