curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/stocks/HPG/trading/orders/history?from=2026-01-01&to=2026-03-31"import requests
url = "https://open-api.fhsc.com.vn/market/stocks/{symbol}/trading/orders/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}/trading/orders/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}/trading/orders/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}/trading/orders/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}/trading/orders/history")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/stocks/{symbol}/trading/orders/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": "HPG",
"items": [
{
"date": "2026-05-27",
"buy": {
"order_count": 18422,
"volume": 9871300,
"avg_volume_per_order": 535.8
},
"sell": {
"order_count": 18422,
"volume": 9871300,
"avg_volume_per_order": 535.8
},
"net_volume": -412700
}
]
},
"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ử lệnh mua/bán chủ động
Đây KHÔNG phải lệnh chờ trong sổ lệnh: là lệnh đã khớp, phân loại theo bên chủ động — mua chủ động (lifted the offer) và bán chủ động (hit the bid), bao gồm cả thoả thuận.
Nguồn chỉ có dữ liệu sau khi đóng phiên: trong giờ giao dịch, request không kèm date trả về phiên đã đóng gần nhất, không phải hôm nay.
Chuỗi theo phiên. 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. Lịch sử chỉ lưu từ 2021-01-01 — xin sớm hơn sẽ được cắt về mốc này. Chưa phân trang.
curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/stocks/HPG/trading/orders/history?from=2026-01-01&to=2026-03-31"import requests
url = "https://open-api.fhsc.com.vn/market/stocks/{symbol}/trading/orders/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}/trading/orders/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}/trading/orders/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}/trading/orders/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}/trading/orders/history")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/stocks/{symbol}/trading/orders/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": "HPG",
"items": [
{
"date": "2026-05-27",
"buy": {
"order_count": 18422,
"volume": 9871300,
"avg_volume_per_order": 535.8
},
"sell": {
"order_count": 18422,
"volume": 9871300,
"avg_volume_per_order": 535.8
},
"net_volume": -412700
}
]
},
"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.
"HPG"
Query Parameters
Ngày bắt đầu (bao gồm), dạng YYYY-MM-DD. Phải đi kèm to. Sớm hơn 2021-01-01 sẽ bị cắt về mốc đó.
"2026-01-01"
Ngày kết thúc (bao gồm), dạng YYYY-MM-DD. Phải đi kèm from, không sớm hơn from, và khoảng cách tối đa 5 năm.
"2026-03-31"
Response
data.items là chuỗi thống kê lệnh chủ động 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.