curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/stocks?exchange=HOSE&sort=-market_cap&page_size=20"import requests
url = "https://open-api.fhsc.com.vn/market/stocks"
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', 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",
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"
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")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/stocks")
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": {
"items": [
{
"symbol": "VNM",
"name": "CTCP Sữa Việt Nam",
"exchange": "HOSE",
"sector": {
"slug": "consumer-staples",
"name": "Hàng tiêu dùng thiết yếu"
},
"price": 68500,
"change_percent": 0.44,
"market_cap": 143000000000000,
"shares_outstanding": 2089955445,
"pe": 15.2,
"pb": 2.8,
"eps": 4500,
"volume": 1284500,
"value": 87000000000,
"foreign_buy_value": 12000000000,
"foreign_sell_value": 9000000000,
"foreign_net_value": 3000000000,
"foreign_net_volume": 43000,
"foreign_room_available": 120000000,
"foreign_room_available_pct": 5.7,
"proprietary_buy_value": 4000000000,
"proprietary_sell_value": 5000000000,
"proprietary_net_value": -1000000000,
"proprietary_net_volume": -14000,
"ma50": 66200,
"ma200": 61800
}
],
"window": "1D",
"date": "2026-08-05",
"updated_at": "2026-05-27T14:30:15+07:00",
"page": 1,
"page_size": 20,
"total": 312
},
"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"
}Sàng lọc cổ phiếu (screener)
Sàng lọc cổ phiếu trên toàn thị trường: kết hợp filter phạm vi (exchange, index, sector), filter số dạng <field>_gt / <field>_lt, sort, window (hoặc date) và fields. Riêng price_gt / price_lt nhận thêm ma50 / ma200 để so giá với chính đường trung bình động của mã đó. window quét tới phiên đang chạy; date quét đúng một phiên quá khứ đã đóng, khi đó mọi số liệu lấy từ lịch sử lưu trữ nên các field không có giá trị quá khứ (market_cap, shares_outstanding, pe, pb, eps, value, ma50, ma200) trả về null và không dùng để sort / filter được. Kết quả phân trang, mặc định sắp xếp theo vốn hoá giảm dần (theo volume khi dùng date).
curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/stocks?exchange=HOSE&sort=-market_cap&page_size=20"import requests
url = "https://open-api.fhsc.com.vn/market/stocks"
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', 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",
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"
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")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/stocks")
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": {
"items": [
{
"symbol": "VNM",
"name": "CTCP Sữa Việt Nam",
"exchange": "HOSE",
"sector": {
"slug": "consumer-staples",
"name": "Hàng tiêu dùng thiết yếu"
},
"price": 68500,
"change_percent": 0.44,
"market_cap": 143000000000000,
"shares_outstanding": 2089955445,
"pe": 15.2,
"pb": 2.8,
"eps": 4500,
"volume": 1284500,
"value": 87000000000,
"foreign_buy_value": 12000000000,
"foreign_sell_value": 9000000000,
"foreign_net_value": 3000000000,
"foreign_net_volume": 43000,
"foreign_room_available": 120000000,
"foreign_room_available_pct": 5.7,
"proprietary_buy_value": 4000000000,
"proprietary_sell_value": 5000000000,
"proprietary_net_value": -1000000000,
"proprietary_net_volume": -14000,
"ma50": 66200,
"ma200": 61800
}
],
"window": "1D",
"date": "2026-08-05",
"updated_at": "2026-05-27T14:30:15+07:00",
"page": 1,
"page_size": 20,
"total": 312
},
"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
Query Parameters
Quét đúng một phiên quá khứ đã đóng (YYYY-MM-DD, phải nhỏ hơn ngày hôm nay — phiên đang chạy dùng window=1D). Không dùng chung với window. Khi có date, các field chỉ tồn tại ở thời điểm hiện tại (market_cap, shares_outstanding, pe, pb, eps, value, ma50, ma200) trả về null, và sort / filter theo chúng bị từ chối 400.
"2026-08-05"
Field số để sắp xếp, thêm tiền tố - cho giảm dần. VD -market_cap, foreign_net_value. Mặc định -market_cap, riêng khi dùng date mặc định là -volume. Không sắp xếp được theo ma50/ma200; khi dùng date cũng không sắp xếp được theo các field không có giá trị quá khứ (market_cap, shares_outstanding, pe, pb, eps, value).
"-foreign_net_value"
Danh sách field cần trả về, phân tách bằng dấu phẩy. Mặc định symbol,exchange,name,price,change_percent. Field dùng trong sort/filter luôn được thêm vào. Field hợp lệ: symbol, name, exchange, sector, price, change_percent, market_cap, shares_outstanding, pe, pb, eps, volume, value, foreign_buy_value, foreign_sell_value, foreign_net_value, foreign_net_volume, foreign_room_available, foreign_room_available_pct, proprietary_buy_value, proprietary_sell_value, proprietary_net_value, proprietary_net_volume, ma50, ma200. ma50/ma200 chỉ hiển thị được qua fields — không dùng làm sort hay filter trực tiếp, chỉ làm vế phải của price_gt/price_lt.
"symbol,name,pe,market_cap"
Response
data.items là danh sách mã, mỗi item chỉ chứa các field được chọn qua fields.
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.