Market Ticker
curl --request GET \
--url https://api.tickdb.ai/v1/market/ticker \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.tickdb.ai/v1/market/ticker"
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/ticker', 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/ticker",
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/ticker"
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/ticker")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tickdb.ai/v1/market/ticker")
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": "700.HK",
"last_price": "543",
"volume_24h": "11205874",
"high_24h": "557",
"low_24h": "543",
"price_change_24h": "-9",
"price_change_percent_24h": "-1.63",
"timestamp": 1773292807000
},
{
"symbol": "AAPL.US",
"last_price": "260.81",
"volume_24h": "26218927",
"high_24h": "262.13",
"low_24h": "259.55",
"price_change_24h": "-0.02",
"price_change_percent_24h": "-0.01",
"timestamp": 1773259201000
}
]
}通用行情接口
行情快照
獲取一個或多個交易品種的實時市場行情數據。
GET
/
v1
/
market
/
ticker
Market Ticker
curl --request GET \
--url https://api.tickdb.ai/v1/market/ticker \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.tickdb.ai/v1/market/ticker"
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/ticker', 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/ticker",
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/ticker"
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/ticker")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tickdb.ai/v1/market/ticker")
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": "700.HK",
"last_price": "543",
"volume_24h": "11205874",
"high_24h": "557",
"low_24h": "543",
"price_change_24h": "-9",
"price_change_percent_24h": "-1.63",
"timestamp": 1773292807000
},
{
"symbol": "AAPL.US",
"last_price": "260.81",
"volume_24h": "26218927",
"high_24h": "262.13",
"low_24h": "259.55",
"price_change_24h": "-0.02",
"price_change_percent_24h": "-0.01",
"timestamp": 1773259201000
}
]
}注意事項
- 最多可同時查詢 50 個交易品種
- 時間戳單位為毫秒(UTC)
支持的市場
外匯、貴金屬、指數、美股、港股、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 | 是 | 交易產品代碼,多個用逗號分隔,最多50個 |
| type | 否 | 產品類型,可選。代碼無歧義時無需傳遞;若返回 AMBIGUOUS_SYMBOL 錯誤,按提示傳入對應值即可。可選值:stock、indices、crypto、forex、futures |
返回字段說明
| 字段 | 說明 |
|---|---|
| symbol | 交易產品 |
| name | 產品名稱(如有) |
| type | 產品類型 |
| last_price | 最新成交價 |
| bid_price | 最優買價(如有) |
| ask_price | 最優賣價(如有) |
| volume_24h | 24小時成交量 |
| high_24h | 24小時最高價 |
| low_24h | 24小時最低價 |
| price_change_24h | 24小時價格變化 |
| price_change_percent_24h | 24小時價格變化百分比 |
| timestamp | 數據時間戳(毫秒,UTC) |
授權
查詢參數
Comma-separated symbols (max 50)
範例:
"700.HK,AAPL.US"
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"
回應
200 - application/json
Successful response
範例:
0
範例:
"success"
Show child attributes
Show child attributes
範例:
[
{
"symbol": "700.HK",
"last_price": "543",
"volume_24h": "11205874",
"high_24h": "557",
"low_24h": "543",
"price_change_24h": "-9",
"price_change_percent_24h": "-1.63",
"timestamp": 1773292807000
},
{
"symbol": "AAPL.US",
"last_price": "260.81",
"volume_24h": "26218927",
"high_24h": "262.13",
"low_24h": "259.55",
"price_change_24h": "-0.02",
"price_change_percent_24h": "-0.01",
"timestamp": 1773259201000
}
]
⌘I
