curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/stocks/VNM/ownership/foreign-room/history?from=2026-01-01&to=2026-03-31"import requests
url = "https://open-api.fhsc.com.vn/market/stocks/{symbol}/ownership/foreign-room/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/stocks/{symbol}/ownership/foreign-room/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/stocks/{symbol}/ownership/foreign-room/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/stocks/{symbol}/ownership/foreign-room/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/stocks/{symbol}/ownership/foreign-room/history")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/stocks/{symbol}/ownership/foreign-room/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",
"items": [
{
"date": "2026-05-27",
"max_pct": 100,
"max_volume": 2089955445,
"owned": 1969955445,
"available": 120000000
}
],
"resolution": "1D",
"from": "2026-02-27",
"to": "2026-05-27",
"page": 1,
"page_size": 20,
"total": 61,
"updated_at": "2026-05-27T14:30:15+07:00"
},
"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ử room ngoại
Chuỗi room ngoại theo ngày của 1 mã. from/to phải truyền cùng nhau (dạng YYYY-MM-DD, khoảng tối đa 5 năm); bỏ trống cả hai → 3 tháng gần nhất. Kết quả phân trang, total là tổng số phiên trong khoảng.
curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/stocks/VNM/ownership/foreign-room/history?from=2026-01-01&to=2026-03-31"import requests
url = "https://open-api.fhsc.com.vn/market/stocks/{symbol}/ownership/foreign-room/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/stocks/{symbol}/ownership/foreign-room/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/stocks/{symbol}/ownership/foreign-room/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/stocks/{symbol}/ownership/foreign-room/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/stocks/{symbol}/ownership/foreign-room/history")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/stocks/{symbol}/ownership/foreign-room/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",
"items": [
{
"date": "2026-05-27",
"max_pct": 100,
"max_volume": 2089955445,
"owned": 1969955445,
"available": 120000000
}
],
"resolution": "1D",
"from": "2026-02-27",
"to": "2026-05-27",
"page": 1,
"page_size": 20,
"total": 61,
"updated_at": "2026-05-27T14:30:15+07:00"
},
"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ã cổ phiếu niêm yết (3–10 ký tự chữ/số, không phân biệt hoa thường). VD: VNM, FPT.
"VNM"
Query Parameters
Ngày bắt đầu (bao gồm), dạng YYYY-MM-DD. Phải đi kèm to.
"2026-01-01"
Ngày kết thúc (bao gồm), dạng YYYY-MM-DD. Phải đi kèm from, và không sớm hơn from.
"2026-03-31"
Độ phân giải của bar. Hiện chỉ hỗ trợ 1D.
1D "1D"
Trang, bắt đầu từ 1. Mặc định 1.
x >= 11
Số phiên mỗi trang (1–50). Mặc định 20.
1 <= x <= 5020
Response
data.items là chuỗi room ngoại theo phiên.
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.