As a developer with years of experience in quantitative trading, I've recently focused on testing various API interfaces for the Vietnam Stock Exchange (primarily the Ho Chi Minh City Stock Exchange, HOSE, with its core VN30 index). The Vietnamese stock market has gained considerable traction in recent years, with HOSE serving as its central exchange and VN30 constituent stocks attracting significant foreign investment interest. However, obtaining stable real-time quotes, historical data, and order book information requires selecting the right API provider. Today, I'll share my hands-on comparison of mainstream providers based on practical experience.
First, let's clarify some core concepts to avoid confusion for beginners: The Vietnam Stock Exchange primarily consists of HOSE (Ho Chi Minh City) and HNX (Hanoi). Commonly discussed Vietnamese stock APIs focus on covering HOSE's VN30 index constituent stocks. Real-time quotes APIs are used to retrieve dynamic data such as latest prices and trading volumes; historical data APIs enable backtesting with candlestick charts (minute/daily/weekly lines, etc.); and order book data includes bid levels 1 to 5 and ask levels 1 to 5 with prices and order quantities, which is essential for high-frequency trading.
I. 2026 Comparison of Mainstream Vietnam HOSE (VN30) API Providers
There aren't many API providers supporting the Vietnam HOSE market currently. I've selected three with strong practicality and compared them across key dimensions such as data coverage, stability, and cost.
1. iTick API
Core Advantages: Comprehensive global multi-market coverage with robust support for Vietnam HOSE, allowing access to real-time quotes, historical quotes, and Level 2 order book data for VN30 constituent stocks; supports both RESTful and WebSocket protocols; free tier sufficient for daily testing, with high cost-effectiveness in paid versions.
Key Information: Latency as low as 100ms, meeting non-ultra-high-frequency trading requirements; historical data coverage exceeds 30 years, supporting minute-level to daily-level candlestick lines; API Token provided upon registration, no credit card required; mature Python client library with low integration costs.
Drawbacks: Enterprise-level ultra-high concurrency needs require customized plans, which ordinary users rarely need.
2. RPDS DATA
Core Advantages: Covers multiple emerging markets globally, including Vietnam HOSE, India, Malaysia, etc., ideal for developers engaged in cross-market arbitrage; strong data cleansing capabilities with low anomaly rates; supports HTTP and WS protocols for full market data retrieval.
Key Information: Solid stability, but limited free quota—testing requires applying for a trial account; suitable for academic research or professional quantitative teams, priced by data volume.
Drawbacks: Limited customized documentation for the Vietnam market; beginners may need more time for debugging.
3. Bloomberg API
Core Advantages: Benchmark in global financial data, with deep coverage of the Vietnam HOSE market and VN30 constituent stocks; data includes real-time quotes, deep order books, historical candlestick lines, and fundamental data; system availability up to 99.99%, backed by global distributed architecture for stability, supporting high-frequency trading scenarios; includes comprehensive compliance and risk control modules, suitable for institutional regulatory requirements.
Key Information: Supports full data for VN30 constituent stocks, including Level 2 order books and tick-level historical data, with latency as low as milliseconds; requires integration with Bloomberg terminals, involving extremely high entry costs, ideal for professional institutions with substantial ongoing investments.
Drawbacks: Highly unfriendly to individual developers and small teams; no independent free tier, with exorbitant annual fees for terminals and API services, plus a steep learning curve.
II. Python Integration for HOSE (VN30): Full Process
The following uses iTick API as an example, as it is currently the most straightforward option for integrating with Vietnam HOSE. The process is simple: Register for a Token → Set up the environment → Call APIs (real-time quotes/historical quotes/order book), all implemented in Python.
1. Preliminary Preparation: Obtaining API Token
- Step 1: Visit the iTick official website and complete a simple registration;
- Step 2: After successful registration, locate the API Token in your personal center—this is the core credential for subsequent API calls; store it securely and avoid disclosure.
2. Environment Setup: Installing Dependencies
You'll need requests (for REST API calls) and websocket-client (for real-time quote subscriptions); install via pip:
pip install requests websocket-client
3. Core API Call Examples
The following examples target VN30 constituent stocks on HOSE.
REST API for Real-Time Quotes of VN30 Constituent Stocks
Suitable for one-time retrieval of basic data such as latest price, percentage change, and trading volume; fast API response, code as follows:
import requests
# Replace with your iTick API Token
ITICK_API_TOKEN = "YOUR_API_TOKEN"
# Target symbol: Vietnam HOSE market VN30 constituent stock - Vietnam Airlines (HVN)
symbol = "HVN"
# Real-time quote API endpoint
url = f"https://api.itick.org/stock/quote?region=VN&code={symbol}"
# Request headers (must include token)
headers = {
"accept": "application/json",
"token": ITICK_API_TOKEN
}
# Send request and handle response
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
# Parse core data (latest price, open price, percentage change, trading volume)
stock_data = data.get("data", {})
print(f"Symbol: {symbol}")
print(f"Latest Price: {stock_data.get('ld')} VND")
print(f"Open Price: {stock_data.get('o')} VND")
print(f"Percentage Change: {stock_data.get('chp')}%")
print(f"Current Volume: {stock_data.get('v')} shares")
else:
print(f"Request failed, status code: {response.status_code}, error message: {response.json().get('message')}")
Retrieving Historical Quotes (Candlestick Data) for VN30 Constituent Stocks
Suitable for strategy backtesting, supporting various periods such as minute-level and daily-level; here, an example of retrieving 100 daily candlesticks:
import requests
ITICK_API_TOKEN = "YOUR_API_TOKEN"
symbol = "HVN" # Vietnam Airlines
# Historical candlestick API (kType=8 for daily lines, limit=100 for 100 candlesticks)
url = f"https://api.itick.org/stock/kline?region=VN&code={symbol}&kType=8&limit=100"
headers = {
"accept": "application/json",
"token": ITICK_API_TOKEN
}
response = requests.get(url, headers=headers)
if response.status_code == 200:
data = response.json()
kline_list = data.get("data", [])
print(f"Retrieved recent 100 daily candlesticks for {symbol}:")
for kline in kline_list:
# Parse candlestick data (timestamp, open, high, low, close, volume)
print(f"Time: {kline.get('t')}, Open: {kline.get('o')}, High: {kline.get('h')}, Low: {kline.get('l')}, Close: {kline.get('c')}, Volume: {kline.get('v')}")
else:
print(f"Request failed, status code: {response.status_code}, error message: {response.json().get('message')}")
WebSocket Subscription for Real-Time Order Book Data of VN30 Constituent Stocks
Suitable for scenarios requiring continuous monitoring of order book changes (e.g., high-frequency trading), enabling real-time retrieval of bid levels 1 to 5 and ask levels 1 to 5 with prices and order quantities:
import websocket
import json
ITICK_API_TOKEN = "YOUR_API_TOKEN"
symbol = "VN$HVN" # Vietnam Airlines
def on_open(ws):
# Send subscription request after successful connection
subscribe_msg = {
"ac": "subscribe",
"params": symbol,
"types": "depth" # Order book data
}
ws.send(json.dumps(subscribe_msg))
print("WebSocket connection successful, subscribed to order book data...")
def on_message(ws, message):
# Receive and parse real-time order book data
data = json.loads(message)
if data.get("type") == "depth":
depth_data = data.get("data", {})
buy_depth = depth_data.get("b", []) # Bid data (bid 1 to 5)
sell_depth = depth_data.get("a", []) # Ask data (ask 1 to 5)
print(f"\n{symbol} Real-Time Order Book ({depth_data.get('t')}):")
print("Asks:", [(f"Ask {i+1}", f"{item.get('p')} VND", f"{item.get('v')} shares") for i, item in enumerate(sell_depth[:5])])
print("Bids:", [(f"Bid {i+1}", f"{item.get('p')} VND", f"{item.get('v')} shares") for i, item in enumerate(buy_depth[:5])])
def on_error(ws, error):
print(f"Connection error: {error}")
def on_close(ws, close_status_code, close_msg):
print(f"Connection closed, status code: {close_status_code}, message: {close_msg}")
# Establish WebSocket connection
ws_url = "wss://api.itick.org/stock"
ws = websocket.WebSocketApp(ws_url,
on_open=on_open,
on_message=on_message,
on_error=on_error,
on_close=on_close)
# Run connection continuously
ws.run_forever()
III. Notes
- Free plans have subscription limits; for multiple symbols, upgrading to a paid tier is recommended for efficiency.
- Do not disclose the API Token to others; leakage will prevent API access.
- Avoid frequent API calls on free plans to prevent triggering rate limits.
IV. Conclusion
For developers planning to enter the quantitative trading field in the Vietnamese stock market, selecting the appropriate API provider is just the first step. More importantly, establish a robust risk management system and investment strategies. As the Vietnamese capital market continues to evolve, related API services will become increasingly refined, offering greater possibilities for quantitative trading.
Reference Document: https://blog.itick.org/stock-api/2026-vietnam-stock-exchange-api-python-tutorial
GitHub: https://github.com/itick-org/
Top comments (0)