curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/quotes/bonds/VIC12103/history?resolution=1D&from=1717200000&to=1717545600"import requests
url = "https://open-api.fhsc.com.vn/market/quotes/bonds/{symbol}/history"
headers = {"X-FH-APIKEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-FH-APIKEY': '<api-key>'}};
fetch('https://open-api.fhsc.com.vn/market/quotes/bonds/{symbol}/history', 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://open-api.fhsc.com.vn/market/quotes/bonds/{symbol}/history",
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-FH-APIKEY: <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://open-api.fhsc.com.vn/market/quotes/bonds/{symbol}/history"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-FH-APIKEY", "<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://open-api.fhsc.com.vn/market/quotes/bonds/{symbol}/history")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/quotes/bonds/{symbol}/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-FH-APIKEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"symbol": "VNM",
"series": [
{
"t": 1717200000,
"o": 192.9,
"h": 194.35,
"l": 191.1,
"c": 193.42,
"v": 51824100,
"yield": 3.85
}
],
"currency": "USD",
"resolution": "1D"
},
"error_code": "0",
"message": "success"
}{
"error_code": "400",
"message": "Invalid parameter"
}{
"error_code": "401",
"message": "Invalid signature"
}{
"error_code": "404",
"message": "Not found"
}{
"error_code": "429",
"message": "Too many requests"
}{
"error_code": "500",
"message": "Internal server error"
}Lịch sử giá trái phiếu
Lịch sử giá OHLCV của 1 mã trái phiếu — chuỗi nến {t, o, h, l, c, v}. from/to là Unix timestamp tính bằng giây. Với trái phiếu Chính phủ (VN10Y, US10Y, JP10Y, DE10Y): mỗi điểm chỉ có {t, yield} (lợi suất %) và luôn ở độ phân giải 1D.
curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/quotes/bonds/VIC12103/history?resolution=1D&from=1717200000&to=1717545600"import requests
url = "https://open-api.fhsc.com.vn/market/quotes/bonds/{symbol}/history"
headers = {"X-FH-APIKEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-FH-APIKEY': '<api-key>'}};
fetch('https://open-api.fhsc.com.vn/market/quotes/bonds/{symbol}/history', 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://open-api.fhsc.com.vn/market/quotes/bonds/{symbol}/history",
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-FH-APIKEY: <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://open-api.fhsc.com.vn/market/quotes/bonds/{symbol}/history"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-FH-APIKEY", "<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://open-api.fhsc.com.vn/market/quotes/bonds/{symbol}/history")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/quotes/bonds/{symbol}/history")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-FH-APIKEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"data": {
"symbol": "VNM",
"series": [
{
"t": 1717200000,
"o": 192.9,
"h": 194.35,
"l": 191.1,
"c": 193.42,
"v": 51824100,
"yield": 3.85
}
],
"currency": "USD",
"resolution": "1D"
},
"error_code": "0",
"message": "success"
}{
"error_code": "400",
"message": "Invalid parameter"
}{
"error_code": "401",
"message": "Invalid signature"
}{
"error_code": "404",
"message": "Not found"
}{
"error_code": "429",
"message": "Too many requests"
}{
"error_code": "500",
"message": "Internal server error"
}Authorizations
API key dài hạn của client. Cấu hình 1 lần lúc khởi tạo; có thể wire thẳng
vào static setter của SDK tự-gen. Đi kèm với FINHAY_API_SECRET — secret
này chỉ dùng ở phía client để tính X-FH-SIGNATURE, không bao giờ
gửi qua mạng.
Path Parameters
Mã trái phiếu HNX (VD: VIC12103, TD2434125) hoặc trái phiếu Chính phủ 10 năm (VN10Y, US10Y, JP10Y, DE10Y).
"VIC12103"
Query Parameters
Độ phân giải nến. Mặc định 1D.
Độ phân giải nến cho các endpoint /market/quotes/{class}/{symbol}/history.
| Giá trị | Ý nghĩa |
|---|---|
1D | Theo ngày (mặc định) |
5 | 5 phút |
15 | 15 phút |
30 | 30 phút |
1H | Theo giờ |
4H | 4 giờ |
1D, 5, 15, 30, 1H, 4H Thời điểm bắt đầu, Unix timestamp tính bằng giây.
x >= 01717200000
Thời điểm kết thúc, Unix timestamp tính bằng giây.
x >= 01717545600
Response
data.series là mảng nến {t, o, h, l, c, v}.
Các field chung của envelope trong mọi response của Finhay API.
error_codelà"0"(string) khi thành công, mã khác"0"khi lỗi.messagelà thông điệp ngắn từ server.