獲取歷史 K 線
curl --request GET \
--url https://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick \
--header 'x-api-key: <api-key>'import requests
url = "https://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick"
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://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick', 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://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick",
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://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick"
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://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick")
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{
"quote": [
{
"close": "<string>",
"open": "<string>",
"low": "<string>",
"high": "<string>",
"volume": "<string>",
"turnover": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
]
}{
"error": "<string>"
}{
"error": "Unauthorized: missing API key"
}行情
獲取歷史 K 線
按 start 和 end 日期範圍查詢,或按 count 加可選的 forward 和 datetime 偏移查詢。
GET
/
api
/
market-data
/
quote
/
{symbol}
/
history_candlestick
獲取歷史 K 線
curl --request GET \
--url https://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick \
--header 'x-api-key: <api-key>'import requests
url = "https://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick"
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://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick', 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://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick",
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://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick"
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://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.fcontext.com/api/market-data/quote/{symbol}/history_candlestick")
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{
"quote": [
{
"close": "<string>",
"open": "<string>",
"low": "<string>",
"high": "<string>",
"volume": "<string>",
"turnover": "<string>",
"timestamp": "2023-11-07T05:31:56Z"
}
]
}{
"error": "<string>"
}{
"error": "Unauthorized: missing API key"
}授權
ApiKeyHeaderBearerAuth
在帳戶設置中生成的 Financial Context key。請以 x-api-key: <key> 形式發送。
路徑參數
查詢參數
K 線週期,預設 day。支持 1m、5m、15m、30m、1h、day、week、month 和 year。
復權類型:none 表示不復權(預設),forward 表示前復權資料。
adjust 的兼容別名:0 表示不復權,1 表示前復權資料。
可用選項:
0, 1 交易時段:intraday 表示常規交易時段(預設),all 表示所有交易時段。
session 的兼容別名:0 表示常規交易時段,1 表示所有交易時段。
可用選項:
0, 1 日期範圍模式的開始日期 YYYY-MM-DD。
日期範圍模式的結束日期 YYYY-MM-DD。
偏移模式下要返回的記錄數。
必填範圍:
x >= 1向前查詢:true(預設)或 false。
開始時間,格式爲 YYYY-MM-DD HH:MM:SS。
回應
歷史 K 線列表
Show child attributes
Show child attributes
⌘I