AI Price Action

API Explorer & Debug Tool

📊 API Overview

Available Endpoints
7
/tickers, /health, /tickers/group, /analysis/*, /raw/*
Supported Formats
2
JSON, CSV
Time Intervals
9
Base: 1D, 1H, 1m | Aggregated: 5m, 15m, 30m, 4h, 1W, 2W, 1M

🏥 System Health & Performance

Monitor system status, cache performance, and data availability. This endpoint provides real-time insights into the API's health.

📋 Available Tickers

Browse all available stock symbols organized by category. See which tickers have data for different time intervals.

🔄 Refresh Schedule

Reset the next-sync timestamp for workers, making all tickers immediately eligible for re-sync.

🔍 Ticker Data Explorer

Query historical price data with flexible date ranges and formats. Perfect for backtesting and analysis.

Defaults to today if not specified

Number of records to return. Ignored if start_date is provided

Specifying start_date will ignore limit parameter

Defaults: cache/ma/redis/snap ON, ema OFF

⚡ Quick Examples

Try these pre-configured queries to explore different intervals and aggregations.

Base Intervals

Minute Aggregations

Day Aggregations

Cryptocurrency Markets

Global Markets (Yahoo)

📊 Analysis API

Advanced market analysis endpoints for discovering top performers and sector trends.

Top/Bottom Performers

Defaults to latest data

Returns performers for each trading hour (5 hours total)

📊 Sector Analysis & Momentum

Compare sector performance using MA20 and MA50 scores. Identify sector rotation and momentum shifts across the market.

Sector Strength (Average of MA20 & MA50 Scores)

How it works: Each sector's score is the average of all stocks' MA20 and MA50 positions. Positive (green) = trading above moving averages (bullish), Negative (red) = below averages (bearish). Larger bars indicate stronger trends.

📊 Volume Profile Analysis

Discover where the most trading occurred at different price levels. Identify Point of Control (POC), Value Area, High Volume Nodes (HVN), and Low Volume Nodes (LVN) for better trading decisions.

Defaults to today if not specified

Leave empty for single day analysis

Number of price levels (2-100, default: 10 for readability)

Default: 70% of volume

⚠️ Note: Volume Profile analysis requires minute-level (1m) data. Best used for intraday analysis. Historical analysis limited by minute data availability.

Relative Rotation Graph (RRG)

Plot tickers in a 2D quadrant chart (RS-Ratio vs RS-Momentum) relative to a benchmark. Identify leading, weakening, lagging, and improving stocks using the JdK double-smoothed WMA algorithm.

Default: VNINDEX

WMA smoothing period (4-50, default: 10)

Number of historical trail points (0 = no trails, 1-120)

Exclude tickers below this volume (default: 100000)

Compute RRG at this date (default: today)

How RRG works: RS-Ratio ≥ 100 means outperforming the benchmark. RS-Momentum ≥ 100 means relative strength is improving. Leading (top-right) = outperforming + improving. Weakening (bottom-right) = outperforming but losing steam. Lagging (bottom-left) = underperforming + deteriorating. Improving (top-left) = underperforming but recovering.

📚 API Reference

GET /tickers

Retrieve historical price data with 20 technical indicators.

Parameters:
symbol - Ticker symbol(s) (optional, repeatable: symbol=VCB&symbol=FPT)
interval - Time interval (optional, default: 1D)
Base intervals: 1D, 1H, 1m (raw data)
Minute aggregations: 5m, 15m, 30m (computed from 1m)
Hour aggregation: 4h (computed from 1h)
Day aggregations: 1W, 2W, 1M (computed from 1D)
start_date - Start date YYYY-MM-DD (optional, overrides limit)
end_date - End date YYYY-MM-DD (optional, defaults to today)
limit - Number of records from end_date (optional, ignored if start_date provided)
format - Response format: json, csv (default: json)
legacy - Divide stock prices by 1000 (optional, default: false)
Note: Legacy format only applies to stocks, not indices
cache - Use 60s cache (optional, default: true)
Response:
JSON array with performance metrics or CSV download
Includes: response_time_ms, data_source, cache_hit
Errors:
400 - Invalid date format or parameters
404 - Ticker not found
500 - Server error (JSON: {"error": "message"})
GET /tickers/group

List all available ticker symbols grouped by data availability.

Returns: Groups of tickers with their available intervals
GET /health

Check API health status and performance metrics.

Response:
System status with performance and cache metrics
Fields: status, uptime_secs, memory_usage_mb, memory_usage_percent
Data counts: active_tickers_count, daily_records_count, hourly_records_count, minute_records_count
Cache: disk_cache_stats {size_mb, hit_rate_percent}
Workers: last_sync_times {daily, hourly, minute}
GET /analysis/top-performers

Get top/bottom performing stocks with hourly breakdown option.

Parameters:
date - Analysis date YYYY-MM-DD (optional, defaults to latest)
sort_by - Sort metric (optional, default: close_changed)
Options: close_changed, volume, volume_changed, total_money_changed, ma10_score, ma20_score, ma50_score, ma100_score, ma200_score
direction - Sort direction: asc, desc (optional, default: desc)
limit - Number of results (optional, default: 10, max: 100)
sector - Filter by sector name (optional, e.g., VN30, NGAN_HANG)
min_volume - Minimum trading volume (optional, default: 10000)
with_hour - Include hourly breakdown (optional, default: false)
When true: Returns performers for each trading hour (5 hours total)
Response:
JSON object with daily performers + optional hourly breakdown
Structure: {date, performers: [...], hourly_performers: {hour: [...]}}
GET /analysis/ma-scores-by-sector

Moving average analysis grouped by stock sectors with filtering options.

Parameters:
date - Analysis date YYYY-MM-DD (optional, defaults to latest)
ma_period - MA period: 10, 20, 50, 100, 200 (optional, default: 20)
min_score - Minimum MA score threshold (optional, default: 0.0)
above_threshold_only - Only stocks above threshold (optional, default: false)
top_per_sector - Max stocks per sector (optional, default: 10, max: 50)
Response:
JSON object with sector-wise MA analysis
Structure: {date, ma_period, sectors: [{name, stocks: [...]}]}
GET /analysis/rrg

Relative Rotation Graph: plot tickers by RS-Ratio vs RS-Momentum against a benchmark.

Parameters:
benchmark - Benchmark ticker (optional, default: VNINDEX)
algorithm - Algorithm: jdk (optional, default: jdk)
period - WMA smoothing period 4-50 (optional, default: 10)
trails - Number of trail points 0-120 (optional, default: 10, clamped to 1-120 when > 0)
min_volume - Exclude tickers with volume below this value (optional, default: 1000)
mode - Data source: vn, crypto, yahoo, all (optional, default: vn)
Response:
JSON with ticker snapshots: rs_ratio, rs_momentum, raw_rs, close, volume, sector
RS-Ratio ≥ 100 = outperforming benchmark, RS-Momentum ≥ 100 = improving
GET /raw/*

Legacy GitHub proxy for backward compatibility.

Note: ⚠️ Deprecated - use /tickers endpoint instead
GET /explorer

Serves the API Explorer UI (this page).

Returns: HTML interface for API testing and exploration
GET /public/*

Static assets for the Explorer UI (CSS, JS, images).

Examples: /public/js/app.js, /public/css/styles.css

⚙️ Technical Details

⚡ Performance & Caching
  • Cache TTL: 60 seconds for all endpoints
  • Memory Cache: Last 1 year of daily data (4GB limit)
  • Disk Cache: Hourly/minute data with LRU eviction (500MB limit)
  • Cache Control: Use cache=false to force refresh
  • Response Time: Typically 50-200ms with cache, 500ms-2s without
🔒 Rate Limiting & Security
  • VCI API Rate: ~30 requests/minute (upstream limit)
  • CORS: Enabled for subdomains and localhost
  • No Authentication: Public API (rate-limited by design)
  • Request Size: No hard limit, practical limit ~100MB
  • Retry Logic: Exponential backoff, max 5 retries
🔄 Data Processing
  • Aggregated Intervals: Computed on-demand from base data
  • 5m/15m/30m: Derived from 1m data (OHLCV aggregation)
  • 4h: Derived from 1h data (OHLCV aggregation)
  • 1W/2W/1M: Derived from 1D data (weekly/monthly aggregation)
  • Processing Time: 100-500ms for aggregated intervals
  • Indicators: 20 technical indicators calculated during sync
⚠️ Error Handling
  • 400 Bad Request: Invalid parameters, date format errors
  • 404 Not Found: Ticker symbol not available
  • 429 Too Many Requests: Upstream rate limit exceeded
  • 500 Server Error: Internal processing errors
  • Error Format: JSON: {"error": "descriptive message"}
📊 CSV Format (20 Columns)
OHLCV: ticker,time,open,high,low,close,volume
Moving Averages: ma10,ma20,ma50,ma100,ma200
MA Scores: ma10_score,ma20_score,ma50_score,ma100_score,ma200_score
Changes: close_changed,volume_changed,total_money_changed
Note: All prices stored in full VND (no division)
🕐 Trading Hours & Sync
  • Market Hours: 9:00-15:00 ICT (UTC+7) Monday-Friday
  • Daily Sync: Every 15s (trading), 5min (off-hours)
  • Hourly/Minute Sync: Every 5min (trading), 30min (off-hours)
  • Weekends: Reduced sync frequency
  • Time Zone: All timestamps in ICT (Vietnam time)

💡 Tips & Best Practices

🚀 Performance
  • CSV format is faster for large datasets
  • Use start_date to limit data range
  • Disk cache improves repeat queries
📊 Data Quality
  • Check /health for data freshness
  • 1m data has limited history
  • Use 1D for long-term analysis
🔧 Integration
  • CORS enabled for subdomains
  • JSON format for web apps
  • CSV format for data science tools
⚠️ Common Issues
  • Check ticker availability first
  • Verify date format (YYYY-MM-DD)
  • Ensure interval matches data