批量获取K线数据
curl --request GET \
--url https://api.quantdash.net/v1/klines/batch \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.quantdash.net/v1/klines/batch"
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.quantdash.net/v1/klines/batch', 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.quantdash.net/v1/klines/batch",
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.quantdash.net/v1/klines/batch"
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.quantdash.net/v1/klines/batch")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quantdash.net/v1/klines/batch")
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{
"data": {}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 429,
"message": "<string>",
"retry_after_ms": 123
}接口文档
批量获取K线数据
一次请求获取多个标的的K线数据,响应以标的代码为 key。
GET
/
v1
/
klines
/
batch
批量获取K线数据
curl --request GET \
--url https://api.quantdash.net/v1/klines/batch \
--header 'X-API-Key: <api-key>'import requests
url = "https://api.quantdash.net/v1/klines/batch"
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.quantdash.net/v1/klines/batch', 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.quantdash.net/v1/klines/batch",
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.quantdash.net/v1/klines/batch"
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.quantdash.net/v1/klines/batch")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.quantdash.net/v1/klines/batch")
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{
"data": {}
}{
"code": 123,
"message": "<string>"
}{
"code": 123,
"message": "<string>"
}{
"code": 429,
"message": "<string>",
"retry_after_ms": 123
}授权
ApiKeyHeaderApiKeyQuery
在请求头 X-API-Key 中传递 API Key
查询参数
标的代码,逗号分隔(如 600000.SH,000001.SZ,AAPL.US)
K线周期
可用选项:
1m, 5m, 15m, 30m, 60m, 1d, 1w, 1M, 1Q, 1Y 最大返回条数
必填范围:
x <= 10000起始时间戳(毫秒,含)
结束时间戳(毫秒,含)
复权类型
可用选项:
none, forward, backward, forward_additive, backward_additive 响应
批量K线数据
以标的代码为 key 的K线数据字典
Show child attributes
Show child attributes
⌘I