歷史估值
curl --request GET \
--url https://api.tickdb.ai/v1/fundamentals/valuation/ts \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.tickdb.ai/v1/fundamentals/valuation/ts"
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/fundamentals/valuation/ts', 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/fundamentals/valuation/ts",
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/fundamentals/valuation/ts"
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/fundamentals/valuation/ts")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tickdb.ai/v1/fundamentals/valuation/ts")
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,
"data": {
"symbol": "<string>",
"metric": "PE",
"granularity": "daily",
"from": "2023-12-25",
"to": "2023-12-25",
"points": [
[
"2023-11-07T05:31:56Z",
"<string>"
]
]
}
}估值與行業
歷史估值
查詢市盈率(PE)按日或按月的歷史數值。
GET
/
v1
/
fundamentals
/
valuation
/
ts
歷史估值
curl --request GET \
--url https://api.tickdb.ai/v1/fundamentals/valuation/ts \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.tickdb.ai/v1/fundamentals/valuation/ts"
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/fundamentals/valuation/ts', 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/fundamentals/valuation/ts",
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/fundamentals/valuation/ts"
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/fundamentals/valuation/ts")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.tickdb.ai/v1/fundamentals/valuation/ts")
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,
"data": {
"symbol": "<string>",
"metric": "PE",
"granularity": "daily",
"from": "2023-12-25",
"to": "2023-12-25",
"points": [
[
"2023-11-07T05:31:56Z",
"<string>"
]
]
}
}套餐權限
| 套餐 | 可用 |
|---|---|
| 免費版 | ❌ |
| 基礎版 | ❌ |
| 專業版 | ✅ |
| 全量套餐(A 股、港股、美股) | ✅ |
| 企業版 | ✅ |
注意事項
points中每個元素為[時間, 指標值],不是帶字段名的對象;時間是帶時區信息的 RFC 3339 字符串。- 未指定日期範圍時,
daily默認查詢最近一年,monthly默認查詢最近五年。查詢範圍內沒有記錄時返回 HTTP 404、錯誤碼40405,不是成功的空數組。
支持的市場
| 市場 | 示例 |
|---|---|
| 美股 | AAPL.US |
| 港股 | 700.HK |
| A股 | 600519.SH |
請求參數
| 參數 | 是否必須 | 說明 |
|---|---|---|
symbol | 是 | 股票代碼 |
type | 否 | 產品類型,當前支持 stock |
granularity | 否 | daily 或 monthly,默認 daily |
from | 否 | 起始日期,格式 YYYY-MM-DD |
to | 否 | 結束日期,格式 YYYY-MM-DD |
請求示例
curl -H "X-API-Key: YOUR_API_KEY" \
"https://api.tickdb.ai/v1/fundamentals/valuation/ts?symbol=AAPL&type=stock&granularity=monthly"
返回字段說明
以下列出data 中的字段;外層 code=0 表示成功。
| 字段 | 說明 |
|---|---|
| symbol | 股票代碼。 |
| metric | 估值指標,當前為 PE(市盈率)。 |
| granularity | 時間粒度:日度或月度。 |
| from | 查詢範圍起始日期,格式 YYYY-MM-DD。 |
| to | 查詢範圍結束日期,格式 YYYY-MM-DD。 |
| points | 歷史估值記錄;每個元素是 [時間, 指標值]。 |
| └─ [0] | RFC 3339 日期時間字符串,包含時區信息。 |
| └─ [1] | 對應指標值,可以是字符串、數值或 null。 |
授權
查詢參數
股票代碼
範例:
"AAPL"
"700"
"600519"
"AAPL.US"
"700.HK"
"600519.SH"
產品類型,當前支援 stock
可用選項:
stock daily 或 monthly,默認 daily
可用選項:
daily, monthly 開始日期,格式 YYYY-MM-DD
結束日期,格式 YYYY-MM-DD
