curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/macro/indicators/vn-cpi?from=2024-01&to=2024-12"import requests
url = "https://open-api.fhsc.com.vn/market/macro/indicators/{indicator}"
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/macro/indicators/{indicator}', 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/macro/indicators/{indicator}",
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/macro/indicators/{indicator}"
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/macro/indicators/{indicator}")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/macro/indicators/{indicator}")
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": {
"indicator": "vn-cpi",
"name": "CPI Việt Nam",
"unit": "%",
"series": [
{
"period": "2024-12",
"value": 3.97
}
]
},
"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"
}Giá trị chỉ tiêu vĩ mô
Giá trị của một chỉ tiêu vĩ mô cho một quốc gia (xác định bởi indicator slug lấy từ /market/macro/indicators). Bỏ trống from/to → chỉ trả về kỳ mới nhất; truyền khoảng thời gian → chuỗi theo kỳ (sort mới nhất ở đầu). period có dạng yyyy, yyyy-Qn hoặc yyyy-MM. value có thể null khi nguồn chưa có dữ liệu.
curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/macro/indicators/vn-cpi?from=2024-01&to=2024-12"import requests
url = "https://open-api.fhsc.com.vn/market/macro/indicators/{indicator}"
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/macro/indicators/{indicator}', 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/macro/indicators/{indicator}",
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/macro/indicators/{indicator}"
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/macro/indicators/{indicator}")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/macro/indicators/{indicator}")
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": {
"indicator": "vn-cpi",
"name": "CPI Việt Nam",
"unit": "%",
"series": [
{
"period": "2024-12",
"value": 3.97
}
]
},
"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
Slug chỉ tiêu vĩ mô. Chỉ dùng slug có sẵn trong danh mục chỉ tiêu vĩ mô đã tra trước đó — không tự đoán, slug sai sẽ không khớp chỉ tiêu nào. VD: vn-cpi.
"vn-cpi"
Query Parameters
Kỳ bắt đầu (bao gồm). Dạng yyyy, yyyy-Qn hoặc yyyy-MM.
"2024-01"
Kỳ kết thúc (bao gồm). Dạng yyyy, yyyy-Qn hoặc yyyy-MM.
"2024-12"
Số kỳ tối đa trả về (1–500). Mặc định 100 khi có khoảng thời gian; 1 khi bỏ trống from/to.
1 <= x <= 500100
Response
data.series là mảng {period, value} theo kỳ.
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.