历史估值
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
