🔌 Vnstock Developer API

Free JSON API cho developers — build Telegram/Discord bots, Excel/Google Sheets integrations, Python notebooks, dashboard custom. CORS enabled · No auth required · Rate limit: 60 req/min/IP · JSON UTF-8.

🔍 Scan Endpoints

Filter stocks theo criteria. Returns top 30 matching stocks với realtime data + AI analysis.

EndpointDescription
/api/scan/rsi-oversold.jsonCổ phiếu RSI < 30 (quá bán)
/api/scan/rsi-overbought.jsonCổ phiếu RSI > 70 (quá mua)
/api/scan/macd-bullish-cross.jsonMACD vừa cắt lên signal line
/api/scan/macd-bearish-cross.jsonMACD vừa cắt xuống signal line
/api/scan/high-score-buy.jsonAI Score >= 7 + signal BUY
/api/scan/low-score-sell.jsonAI Score <= 4 + signal SELL
/api/scan/volume-spike.jsonVolume > 2x trung bình 20 phiên
/api/scan/top-gainers.jsonTop 30 cổ phiếu tăng giá hôm nay
/api/scan/top-losers.jsonTop 30 cổ phiếu giảm giá hôm nay
/api/scan/adx-strong-trend.jsonADX > 25 — trend mạnh
/api/scan/golden-cross.jsonMA50 cắt lên MA200 (golden cross — bullish dài hạn)
/api/scan/death-cross.jsonMA50 cắt xuống MA200 (death cross — bearish dài hạn)

📊 Stock Data Endpoint

Realtime data + AI analysis cho 1 cổ phiếu.

EndpointDescription
/api/stock/<SYM>?market=VNRealtime data + 25 indicators + AI score (single stock)
/api/market-snapshot.jsonTop movers, sector rotation, market breadth, AI signals (full snapshot)
/api/versionServer version + build ID (for cache busting)

📝 Example Response

GET https://vnstock.io.vn/api/scan/rsi-oversold.json

{
  "criteria": "rsi-oversold",
  "description": "Cổ phiếu RSI < 30 (quá bán)",
  "count": 12,
  "timestamp": "2026-05-25T08:30:15+07:00",
  "stocks": [
    {
      "symbol": "STB",
      "name": "Sacombank",
      "price": 27500,
      "change_pct": -2.85,
      "volume": 8450000,
      "rsi": 24.3,
      "adx": 18.5,
      "score": 4.2,
      "signal": "SELL",
      "sector": "Ngân hàng"
    }, ...
  ]
}

🐍 Python Example

import requests

# Lấy stocks RSI < 30
r = requests.get('https://vnstock.io.vn/api/scan/rsi-oversold.json')
data = r.json()
print(f"Found {data['count']} oversold stocks")
for s in data['stocks'][:5]:
    print(f"  {s['symbol']}: RSI {s['rsi']}, Score {s['score']}/10")

# Lấy data 1 mã
r = requests.get('https://vnstock.io.vn/api/stock/VCB?market=VN')
print(r.json()['analysis'])

📱 Telegram Bot Example

import requests, time
TG_TOKEN = "YOUR_BOT_TOKEN"
CHAT_ID = "YOUR_CHAT_ID"

while True:
    r = requests.get('https://vnstock.io.vn/api/scan/macd-bullish-cross.json')
    for s in r.json()['stocks'][:5]:
        msg = f"🟢 {s['symbol']}: Score {s['score']}/10 · {s['signal']}"
        requests.get(f"https://api.telegram.org/bot{TG_TOKEN}/sendMessage",
                     params={"chat_id": CHAT_ID, "text": msg})
    time.sleep(3600)  # check every hour

📊 Google Sheets Integration

// Apps Script — paste vào Google Sheets:
function getVnstockData(symbol) {
  const url = `https://vnstock.io.vn/api/stock/${symbol}?market=VN`;
  const response = UrlFetchApp.fetch(url);
  const data = JSON.parse(response.getContentText());
  return [[data.price, data.chg, data.analysis.total, data.analysis.signal]];
}

// Cell formula:
// =getVnstockData("VCB")

⚙️ Rate Limits + Caching

📜 Terms of Use

🔍 Test scan endpoint
Questions? support@vnstock.io.vn · Built-in calculators · Embed widget