API & Tích hợp

Tạo API key để n8n, LLM, hoặc ứng dụng khác gọi vào đọc dữ liệu khuyến nghị.

API Key

Endpoints

Base URL:

1. Lấy tất cả tín hiệu (JSON)
GET /api/public-signals.php?api_key=YOUR_KEY
2. Lọc theo sàn
GET /api/public-signals.php?api_key=YOUR_KEY&exchange=HOSE
3. Lọc theo mã
GET /api/public-signals.php?api_key=YOUR_KEY&ticker=VNM
4. Xuất Markdown (cho LLM)
GET /api/public-signals.php?api_key=YOUR_KEY&format=md
5. Ép tính lại (bỏ cache)
GET /api/public-signals.php?api_key=YOUR_KEY&refresh=1

Ví dụ tích hợp

cURL
curl -H "X-API-Key: YOUR_KEY" http://localhost:8080/api/public-signals.php
n8n HTTP Request
URL: http://localhost:8080/api/public-signals.php
Method: GET
Headers: X-API-Key = YOUR_KEY
Query: exchange=HOSE (tuỳ chọn)
Python
import requests
r = requests.get("http://localhost:8080/api/public-signals.php",
    headers={"X-API-Key": "YOUR_KEY"})
data = r.json()
for s in data["signals"]:
    print(s["ticker"], s["action"], s["confidence"])
JavaScript (fetch)
const res = await fetch("http://localhost:8080/api/public-signals.php", {
  headers: { "X-API-Key": "YOUR_KEY" }
});
const data = await res.json();
console.log(data.signals.length, "signals");

Response JSON

{
  "signals": [{
    "ticker": "VNM",
    "exchange": "HOSE",
    "action": "strong-buy",
    "confidence": 78,
    "entryPrice": 72.50,
    "stopLoss": 69.80,
    "takeProfit": 79.20,
    "riskRewardRatio": "2.48",
    "breakevenPlan": {...},
    "reasons": ["Giá trên SMA20...", ...],
    "warnings": [...],
    "pattern": { "winRate": 72, ... },
    "candlestick": { "patterns": [...], ... },
    "multiTimeframe": { "alignment": "aligned_bullish", ... }
  }, ...],
  "total": 403,
  "updatedAt": "2026-06-02T19:30:00+07:00",
  "fromCache": true
}
Gợi ý sử dụng