aipa-data
Developed by AIPriceAction. More data and documentation at https://aipriceaction.com
Lời Truyền Cảm Hứng Cho Nhà Giao Dịch
Tư duy và Phương pháp luận
- "Chỉ có xu hướng mới mang lại lợi nhuận, đừng cố tranh cãi với thị trường."
- "Giao dịch không phải là dự đoán tương lai, mà là quản lý rủi ro và tuân thủ kỷ luật."
- "Volume là dấu chân của dòng tiền thông minh. Giá có thể lừa dối, nhưng khối lượng thì không."
- "Kiên nhẫn chờ đợi thiết lập phù hợp là chiếc chìa khóa vàng dẫn đến thành công."
- "Thị trường luôn đúng, chỉ có túi tiền của chúng ta là tự chịu trách nhiệm."
- "Lợi nhuận bền vững không đến từ việc đoán đúng đỉnh đáy, mà đến từ sự kiên nhẫn và nhất quán."
- "Giảm nhiều chưa chắc hết giảm — cần xác nhận thêm."
Kỷ luật và Quản trị rủi ro
- "Tuân thủ kỷ luật quản trị rủi ro thì không hề 'toang' bạn nhé!"
- "Giao dịch không có kế hoạch chính là đang lập kế hoạch cho sự thất bại."
- "Cắt lỗ luôn đúng, gồng lỗ luôn sai."
- "Sống sót trước khi nghĩ đến lợi nhuận."
- "Giữ được vốn quan trọng hơn kiếm được tiền."
- "Đừng bao giờ yêu một cổ phiếu, hãy chỉ yêu lợi nhuận và sự an toàn mà nó mang lại."
- "Spring cần 2-3 phiên xác nhận + pullback No Supply. Một phiên bùng nổ chưa nói lên điều gì."
- "Không bắt dao rơi dù đã rơi 30%. Chờ đến khi có Volume Profile + Wyckoff xác nhận."
Tâm lý và Thực chiến
- "Thà chảy nước miếng còn hơn chảy nước mắt."
- "Đừng cố bắt dao rơi khi chưa thấy đáy vững chắc."
- "Trong một xu hướng tăng ai cũng là thiên tài đầu tư, chỉ khi thủy triều rút mới biết ai không mặc quần."
- "Mua đuổi (FOMO) khi giá đã tăng nóng giống như đi tàu lượn siêu tốc mà quên thắt dây an toàn."
- "Đừng đoán đỉnh, đừng dò đáy."
- "Bò kiếm tiền, gấu kiếm tiền, lợn bị làm thịt."
- "Xu hướng là bạn, hãy đi cùng bạn."
- "Mua tin đồn, bán sự thật."
- "Sai lầm lớn nhất là thấy cổ phiếu giảm nhiều rồi nghĩ nó sẽ lên lại — thị trường không nợ bạn một lý do."
- "Phân biệt Spring và Upthrust: hỏi 'cổ này đã giảm đủ để clear supply chưa?' Nếu chưa giảm nhiều = còn supply = rủi ro. Nếu đã giảm nhiều = không còn ai bán = cơ hội."
Kiên nhẫn và Quản lý vị thế (No Premature TP & Add-Size)
- "Hãy để lợi nhuận chạy."
- "Chốt non là mất ngon."
- "Đúng thì thêm, sai thì cắt."
- "Lợi nhuận lớn đến từ việc ngồi yên."
- "Đúng giữ, sai cắt."
What is aipa
aipa is an AI-powered financial analysis CLI for Vietnamese stocks, cryptocurrencies, and global assets. The get-ohlcv-data command fetches raw OHLCV price data — no AI, no API key required.
Installation
Use uvx — no install needed. On the first call of each session, use uvx aipa-cli@latest to refresh the cache. For all subsequent calls, use plain uvx aipa-cli (fast, cached).
# All calls — fast cached execution (uvx automatically checks for updates)
uvx aipa-cli get-ohlcv-data VCB
uvx aipa-cli get-ohlcv-data TCB
# Fallback: pip (if uv is not available)
pip install aipa-cli
aipa get-ohlcv-data VCB
# Fallback: system pip (if pip fails due to PEP 668)
python3 -m pip install aipa-cli --break-system-packages
aipa get-ohlcv-data VCB
# If neither uv nor pip are installed, install uv first:
curl -LsSf https://astral.sh/uv/install.sh | sh
# If the install script fails, see: https://docs.astral.sh/uv/getting-started/installation/
All command examples in this skill use aipa for brevity. Replace aipa with uvx aipa-cli if not installed globally.
Keeping the CLI Updated
The aipa CLI is actively developed with frequent improvements. Always prefer uvx aipa-cli over aipa. When using uvx:
- Use plain
uvx for fast cached execution:
uvx aipa-cli get-ohlcv-data VCB
- Fallback on failure — if a command fails with a schema or missing argument error, retry with
@latest:
uvx aipa-cli get-ohlcv-data VCB (add @latest if the command fails)
If aipa is installed globally via pip, update before each session:
pip install --upgrade aipa-cli
The agent should prefer uvx aipa-cli for all commands. Only fall back to aipa if uvx is unavailable.
Environment Variables
None required. get-ohlcv-data fetches data from public S3 archives — no backend API or API key needed.
Available Data Sources
- Vietnamese stocks (
source: vn): VIC, VCB, FPT, HPG, VNM, MBB, TCB, CTG, VPB, HDB, etc.
- Cryptocurrencies (
source: crypto): BTCUSDT, ETHUSDT, BNBUSDT, SOLUSDT, etc.
- Global/Yahoo (
source: global/yahoo): AAPL, TSLA, NVDA, SPY, etc.
- SJC Gold (
source: sjc): SJC gold prices
Predefined Watchlists
The CLI has built-in watchlists for common ticker groups. Use aipa watchlist get <NAME> to get tickers for a group, or reference them directly when the user asks about a group like "VN30 stocks" or "Vingroup ecosystem".
| Name |
Tickers |
Count |
| VN30 |
ACB, BID, BSR, CTG, FPT, GAS, GVR, HDB, HPG, LPB, MBB, MSN, MWG, PLX, SAB, SHB, SSB, SSI, STB, TCB, TPB, VCB, VHM, VIB, VIC, VJC, VNM, VPB, VRE, VPL |
30 |
| VINGROUP |
VIC, VHM, VRE, VPL |
4 |
| TM |
GEX, GEE, VIX, EIB, VGC, IDC |
6 |
| MASAN |
MSN, MCH, MSR, MML, VCF, VSN, NET |
7 |
| INDEX |
VNINDEX, VN30, VN30F1M, VN100, VNMIDCAP, VNSMALLCAP, VNALLSHARE, VNXALLSHARE, VNFIN, HNX30, VNREAL, VNENE, VNMITECH, VNUTI, VNCONS, VNCOND, VNHEAL, VNIND, VNFINLEAD, VNFINSELECT, VNDIAMOND, VNDIVIDEND |
22 |
| CROSS |
VNINDEX, ^GSPC, GC=F, SJC-GOLD, KC=F, BZ=F, BTCUSDT |
7 |
Note: VN30 was updated on 2026-05-13 — DGC removed (placed under controlled status), BSR added as replacement.
# List all watchlists (predefined + custom)
aipa watchlist ls
# Get tickers for a specific watchlist
aipa watchlist get VN30
aipa watchlist get VINGROUP
# Create a custom watchlist
aipa watchlist set MYWATCHLIST FPT VCB HPG VIC
# Delete a custom watchlist
aipa watchlist rm MYWATCHLIST
# Using watchlist tickers with get-ohlcv-data
aipa get-ohlcv-data $(aipa watchlist get VN30)
Supported Intervals
| Interval |
Description |
Best For |
1D |
1 day (default) |
Swing trading, trend analysis |
1h |
1 hour |
Intraday analysis, day trading |
1m |
1 minute |
Scalping, micro structure |
5m |
5 minutes |
Scalping, micro structure |
15m |
15 minutes |
Intraday patterns |
30m |
30 minutes |
Intraday patterns |
4h |
4 hours |
Swing trading, intraday |
1W |
1 week |
Medium-term trend analysis |
2W |
2 weeks |
Medium-term trend analysis |
aipa get-ohlcv-data — Raw OHLCV Data
Fetch raw OHLCV price data without AI analysis. Outputs price data with optional moving averages.
aipa get-ohlcv-data TICKER [TICKERS...] [options]
Flags
| Flag |
Default |
Description |
TICKER [TICKERS...] |
— |
One or more ticker symbols (auto-uppercased) |
--interval |
1D |
Time interval: 1m, 5m, 15m, 30m, 1h, 4h, 1D, 1W, 2W |
--limit N |
— |
Number of bars |
--start-date |
— |
Start date (e.g. 2025-01-01) |
--end-date |
— |
End date (e.g. 2025-05-01) |
--source |
auto-detect |
Filter by source: vn, crypto, global |
--ma / --no-ma |
included |
Include/exclude moving averages |
--sma / --ema |
settings |
Force SMA or EMA (overrides use_sma setting). Default MA type controlled by aipa config get use_sma. |
--no-system-prompt |
— |
Exclude persona header from output |
aipa-config — Settings Management
aipa config get # show all settings (JSON, api_key redacted)
aipa config get use_sma # show single value: true or false
aipa config get language # show language: en or vn
aipa config set use_sma false # switch all commands to EMA
aipa config set use_sma true # switch to SMA
aipa config set language vn # change language
aipa config path # show path to settings file
| Setting |
Default |
Values |
Description |
use_sma |
true |
true / false |
true = SMA, false = EMA. Controls MA type for all commands. CLI flags (--sma, --ema) override per-invocation. |
language |
vn |
en / vn |
Output language for analyze and deep-research |
MA Type Priority: CLI flag (--sma/--ema) > settings.json (use_sma) > default (sma).
IMPORTANT: Before any analysis session, run aipa config get use_sma to check the current MA type setting. Do NOT assume SMA — the user may have switched to EMA. All MA references in your analysis must match the active setting (SMA or EMA).
Useful Presets
These presets cover the most common data-fetching scenarios. Use them as-is or adapt the parameters.
Quick Look
# Last 20 daily candles with MA indicators (type from use_sma setting)
aipa get-ohlcv-data VCB
# Last 20 daily candles, raw OHLCV only
aipa get-ohlcv-data VCB --no-ma
Trend Analysis (Swing Trading)
# 50 daily bars with MA indicators (type from use_sma setting) — good for trend identification
aipa get-ohlcv-data VCB --limit 50
# 100 daily bars for long-term trend
aipa get-ohlcv-data VIC --limit 100
# EMA for more responsive trend analysis
aipa get-ohlcv-data FPT --limit 50 --ema
Intraday Data
# Last 50 hourly candles
aipa get-ohlcv-data BTCUSDT --interval 1h --limit 50
# Last 100 hourly candles for intraday patterns
aipa get-ohlcv-data ETHUSDT --interval 1h --limit 100
# Minute data for scalping analysis
aipa get-ohlcv-data BTCUSDT --interval 1m --limit 100
Date Range
# Specific date range
aipa get-ohlcv-data FPT --start-date 2025-01-01 --end-date 2025-05-01
# From a date to today
aipa get-ohlcv-data VCB --start-date 2025-04-01
# All data in a range, no MA
aipa get-ohlcv-data HPG --start-date 2025-01-01 --end-date 2025-05-01 --no-ma
Cryptocurrency
# BTC daily with EMA
aipa get-ohlcv-data BTCUSDT --limit 50
# ETH hourly for intraday
aipa get-ohlcv-data ETHUSDT --interval 1h --limit 100
# SOL raw candles, no MA
aipa get-ohlcv-data SOLUSDT --limit 30 --no-ma
# BNB daily with EMA
aipa get-ohlcv-data BNBUSDT --limit 50 --ema
Vietnamese Stocks
# Banking sector — all in one call
aipa get-ohlcv-data VCB TCB MBB CTG --limit 30
# Blue chips
aipa get-ohlcv-data VIC FPT VNM --limit 50
# Market index
aipa get-ohlcv-data VNINDEX --limit 50
Global Stocks
# US tech stocks
aipa get-ohlcv-data AAPL --limit 50
aipa get-ohlcv-data NVDA --limit 50
aipa get-ohlcv-data TSLA --limit 50
# Market index
aipa get-ohlcv-data SPY --limit 100
Minimal Output (for parsing / spreadsheets)
# Strip persona header for clean data output
aipa get-ohlcv-data VCB --no-system-prompt
# Raw OHLCV only, no MA, no header — cleanest output
aipa get-ohlcv-data VCB --no-ma --no-system-prompt
aipa ticker-list — List Available Tickers
List available ticker symbols with metadata (name, group, exchange, source). No LLM involved, no API key needed.
Use this to discover what tickers are available before fetching data.
aipa ticker-list [--source vn|crypto|global|sjc] [--group GROUP] [--compact]
Flags
| Flag |
Default |
Description |
--source |
— |
Filter by source: vn, crypto, global, sjc |
--group |
— |
Filter by group (e.g. NGAN_HANG, CHUNG_KHOAN, BAT_DONG_SAN) |
--compact |
— |
Output symbols only, comma-separated |
Usage Examples
# All tickers
aipa ticker-list
# VN stocks only
aipa ticker-list --source vn
# Banking sector
aipa ticker-list --source vn --group NGAN_HANG
# Crypto symbols only (for passing to other commands)
aipa ticker-list --source crypto --compact
Data Fields
Each row includes: ticker, name, group, exchange, source.
aipa live-data — Top Tickers by Trading Value
Fetch the latest candle for all tickers or specific tickers. No LLM involved, no API key needed. When no tickers are specified, returns top N tickers sorted by trading value (close × volume) descending.
Use this to quickly identify the most actively traded tickers and get a market overview.
aipa live-data [TICKERS...] [--top 50] [--interval 1D]
Flags
| Flag |
Default |
Description |
TICKERS... |
— |
Optional ticker symbols (auto-uppercased). Omit for top N by trading value. |
--top N |
50 |
Number of top tickers to show when no tickers specified |
--interval |
1D |
Time interval: 1m, 5m, 15m, 30m, 1h, 4h, 1D, 1W, 2W |
--source |
— |
Filter by source: vn, crypto, global, sjc |
Usage Examples
# Top 50 by trading value (broad market overview)
aipa live-data
# Top 10 only
aipa live-data --top 10
# Top 20 hourly
aipa live-data --interval 1h --top 20
# Filter by source: SJC gold
aipa live-data --source sjc
# Filter by source: crypto top 10
aipa live-data --source crypto --top 10
# Specific tickers only
aipa live-data VCB TCB MBB
Data Fields
Each row includes: ticker, time, open, high, low, close, volume, close_changed (%), volume_changed (%), ma10_score, ma50_score.
aipa performers — Top/Worst Performers
Rank top and worst performers from live daily data by any metric. No LLM involved, no API key needed. Defaults to VN stocks.
aipa performers [--sort-by close_changed] [--direction desc] [--limit 10] [--source vn] [--group NGAN_HANG]
Flags
| Flag |
Default |
Description |
--sort-by |
close_changed |
Metric: close_changed, volume, value, volume_changed, ma10_score, ma20_score, ma50_score, ma100_score, ma200_score, total_money_changed |
--direction |
desc |
Sort direction: desc (strongest first) or asc (weakest first) |
--limit N |
10 |
Number of entries per list |
--min-volume N |
10000 |
Minimum volume for VN tickers |
--source |
vn |
Data source: vn, crypto, global, sjc |
--group |
— |
Filter by sector: NGAN_HANG, CHUNG_KHOAN, BAT_DONG_SAN, CONG_NGHE, DAU_KHI, etc. |
Usage Examples
# Top 10 VN stocks by price change (default)
aipa performers
# Top 5 by volume, ascending
aipa performers --sort-by volume --direction asc --limit 5
# Top 20 by MA50 score
aipa performers --sort-by ma50_score --limit 20
# Crypto performers
aipa performers --source crypto --limit 5
# Top 10 by trading value (close × volume)
aipa performers --sort-by value --limit 10
# By money flow
aipa performers --sort-by total_money_changed --limit 15
# Banking sector only, sorted by value
aipa performers --group NGAN_HANG --sort-by value
# Securities sector top gainers
aipa performers --group CHUNG_KHOAN --sort-by close_changed --limit 5
# Real estate sector by MA50 trend
aipa performers --group BAT_DONG_SAN --sort-by ma50_score
aipa volume-profile — Volume-by-Price Histogram
Volume profile analysis from 1-minute data showing Point of Control (POC), Value Area, and volume-weighted statistics. No LLM involved, no API key needed.
aipa volume-profile TICKER [--date YYYY-MM-DD] [--source vn] [--bins 50] [--value-area-pct 70]
Flags
| Flag |
Default |
Description |
TICKER |
— |
Ticker symbol (required) |
--date |
today |
Single date (YYYY-MM-DD) |
--start-date / --end-date |
— |
Date range |
--source |
auto-detect |
Source for tick size: vn, crypto, global, sjc |
--bins N |
50 |
Number of price bins (2–200) |
--value-area-pct |
70 |
Value area target % (60–90) |
Usage Examples
Prefer multi-day ranges over single-day profiles — they produce more reliable support/resistance levels and smooth out intraday noise. Use --start-date and --end-date covering at least 20 trading days as the default approach. Only use a single --date when the user explicitly asks for one specific day.
# 1-month range for VCB (preferred default)
aipa volume-profile VCB --start-date 2026-04-14 --end-date 2026-05-09
# 2-week range
aipa volume-profile VCB --start-date 2026-04-28 --end-date 2026-05-09 --bins 30
# Specific date (only when user asks for one day)
aipa volume-profile VCB --date 2026-05-09
# Crypto multi-day range
aipa volume-profile BTCUSDT --source crypto --bins 30 --start-date 2026-05-05 --end-date 2026-05-09
# Full options: date range with wider value area
aipa volume-profile FPT --start-date 2026-05-01 --end-date 2026-05-09 --bins 30 --value-area-pct 80
Output
- POC (Point of Control): price level with the highest volume
- Value Area: price range containing the target % of total volume (default 70%)
- Statistics: volume-weighted mean, median, standard deviation, skewness
- Profile: binned price levels with volume, percentage, and visual bar chart
Interpreting Output
The CLI outputs to two streams:
- stdout: The OHLCV data table. This is what you should present to the user.
- stderr: Status messages with structured markers.
Status Markers (stderr)
| Marker |
Meaning |
[build] |
Data fetching status and timing |
[error] |
Error message |
[done] |
Fetch complete, includes total time |
Data Fields
Each row includes: date/time, open, high, low, close, volume. When --ma is enabled (default), moving average columns are also included.
Attribution
When presenting data or any derived analysis to the user, always include an attribution line at the end of your response:
- English: "Data by AIPriceAction | AI-powered analysis — may contain errors. Verify before trading."
- Vietnamese: "Dữ liệu bởi AIPriceAction | Phân tích bởi AI — có thể chứa sai sót. Vui lòng kiểm chứng trước khi giao dịch."
Do NOT say "analysis provided by AIPriceAction" or "phân tích được cung cấp bởi AIPriceAction". AIPriceAction provides the data; the analysis is AI-generated and may be inaccurate.
aipa fundamentals — Fundamental Data (requires aipa-cli >= 0.1.48)
Version gate: aipa fundamentals requires aipa-cli >= 0.1.48. Verify before use:
aipa --version
# or
uvx aipa-cli --version
If the version is < 0.1.48, upgrade: uvx aipa-cli@latest fundamentals info ACB or pip install --upgrade aipa-cli.
No LLM involved, no API key needed. Reads from cached vn.zip (downloads ~15-20 MB on first call, cached locally after).
IMPORTANT: Fundamentals commands only accept the flags documented below.
When to fetch: Do NOT automatically run fundamentals. Technical analysis (VPA, Wyckoff, MA) is the default. When the user says "report" or "báo cáo", they may want fundamentals — if unclear, ask to confirm.
aipa fundamentals info — Company Profile
Show company profile, shareholders, and officers for a ticker.
aipa fundamentals info TICKER [--source vn]
Flags
| Flag |
Default |
Description |
TICKER |
— |
Ticker symbol (required) |
--source |
auto |
Data source |
Usage Examples
# Company profile for ACB
aipa fundamentals info ACB
# With explicit source
aipa fundamentals info FPT --source vn
Output Fields
Industry, market cap, current price, outstanding shares, top shareholders with ownership %, officers with positions.
aipa fundamentals ratios — Financial Ratios
Show financial ratios for a ticker, organized by category. No LLM involved, no API key needed.
aipa fundamentals ratios TICKER [options]
Flags
| Flag |
Default |
Description |
TICKER |
— |
Ticker symbol (required) |
--latest |
off |
Show latest period only (quarterly or yearly) — fastest, single result |
--no-yearly |
off |
Include quarterly reports |
--yearly |
off |
Yearly reports only |
--year YEAR |
— |
Show specific year (e.g. 2024) |
--period PERIOD |
— |
Specific period like "2024" or "2024 Q2" |
--category |
all |
valuation, profitability, leverage, liquidity, bank, efficiency |
--json |
off |
Raw JSON output |
--source |
auto |
Data source |
Usage Examples
# All periods (yearly + quarterly) — default
aipa fundamentals ratios VCB
# Latest period only (quarterly or yearly) — quickest, single result
aipa fundamentals ratios VCB --latest
# Specific year
aipa fundamentals ratios VCB --year 2024
# Specific quarter
aipa fundamentals ratios VCB --period "2024 Q2"
# Include quarterly reports (same as default)
aipa fundamentals ratios VCB --no-yearly
# Yearly reports only
aipa fundamentals ratios VCB --yearly
# Only bank-specific fields
aipa fundamentals ratios VCB --category bank
# Raw JSON output
aipa fundamentals ratios VCB --json
Categories
| Category |
Fields |
| Valuation |
PE, PB, PS, EV/EBITDA, Price/CashFlow, Dividend Yield, Market Cap |
| Profitability |
ROE, ROA, ROIC, Gross Margin, After-Tax Margin, Pre-Tax Margin, EBIT Margin, Net Interest Margin |
| Efficiency |
Asset Turnover, Fixed Asset Turnover, Cash Cycle, DSO, DIO, DPO |
| Leverage |
Debt/Equity, Financial Leverage, Equity/Liabilities, Equity/Loans, Equity/Total Asset |
| Liquidity |
Current Ratio, Quick Ratio, Cash Ratio |
| Bank |
NPL, LDR, CAR, CASA, CIR, Non-Interest Income, Deposit/Loans Growth, LLR ratios |
aipa fundamentals rank — Rank by Fundamental Field
Rank tickers by any of 50+ fundamental fields. No LLM involved, no API key needed.
aipa fundamentals rank [TICKERS...] [options]
Flags
| Flag |
Default |
Description |
tickers |
all VN |
Positional ticker symbols |
--sort-by |
roe |
Field to rank by (50+ fields, see below) |
--direction |
desc |
desc (highest first) or asc (lowest first) |
--limit |
10 |
Max results |
--latest |
off |
Show latest period only (quarterly or yearly) |
--yearly |
off |
Yearly reports only |
--year YEAR |
— |
Specific year (e.g. 2024) |
--period PERIOD |
— |
Specific period like "2024" or "2024 Q2" |
--watchlist |
— |
Use watchlist as ticker source (VN30, VINGROUP, TM, MASAN, custom...) |
--source |
auto |
Data source |
Usage Examples
# Top 10 VN stocks by ROE (default)
aipa fundamentals rank
# Cheapest 20 by PE
aipa fundamentals rank --sort-by pe --direction asc --limit 20
# Banking tickers ranked by CAR
aipa fundamentals rank VCB BID CTG TCB MBB --sort-by car --direction desc
# VN30 watchlist ranked by ROE
aipa fundamentals rank --watchlist VN30 --sort-by roe --limit 15
# Best asset quality (lowest NPL)
aipa fundamentals rank --sort-by npl --direction asc --limit 10
# Highest dividend yield
aipa fundamentals rank --sort-by dividend_yield --direction desc
# Largest by market cap
aipa fundamentals rank --sort-by market_cap --direction desc --limit 20
# Historical year
aipa fundamentals rank --year 2023 --sort-by roe
# Specific quarter
aipa fundamentals rank --period "2016 Q4" --sort-by roe
Sortable Fields (50+)
pe, pb, ps, ev_to_ebitda, price_to_cash_flow, dividend_yield, market_cap, roe, roa, roic, gross_margin, after_tax_profit_margin, pre_tax_profit_margin, ebit_margin, net_interest_margin, ebit, ebitda, asset_turnover, fixed_asset_turnover, debt_to_equity, debt_per_equity, financial_leverage, equity_to_liabilities, equity_to_loans, total_equity_total_asset, owners_equity, equity, current_ratio, quick_ratio, cash_ratio, cash_cycle, day_sale_outstanding, days_inventory_outstanding, days_payable_outstanding, npl, ldr_loan_deposit_ratio, car, casa_ratio, cir, cost_to_income, non_and_interest_income, deposit_growth, loans_growth, loans_loss_reserve_to_loans, loans_loss_reserves_to_npl, provision_to_outstanding_loans, average_cost_of_financing, average_yield_on_earning_assets, outstanding_shares, employees, current_price.
Ticker Source Resolution (rank and screen)
--watchlist NAME — resolve from predefined (VN30, VINGROUP...) or custom watchlists
- Positional
tickers — explicit list
- Default — all VN tickers from ticker metadata
aipa fundamentals screen — Multi-Criteria Screening
Filter tickers by fundamental criteria, then rank by a field. No LLM involved, no API key needed.
aipa fundamentals screen [TICKERS...] [options]
Flags
| Flag |
Default |
Description |
tickers |
all VN |
Positional ticker symbols |
--sort-by |
roe |
Field to rank by (same as rank) |
--direction |
desc |
Sort direction |
--limit |
50 |
Max results (1–500) |
--latest |
off |
Show latest period only (quarterly or yearly) |
--yearly |
off |
Yearly reports only |
--year YEAR |
— |
Specific year (e.g. 2024) |
--period PERIOD |
— |
Specific period like "2024" or "2024 Q2" |
--watchlist |
— |
Use watchlist as ticker source |
--source |
auto |
Data source |
--pe-min / --pe-max |
— |
PE range filter |
--pb-min / --pb-max |
— |
PB range filter |
--roe-min / --roe-max |
— |
ROE range filter |
--roa-min / --roa-max |
— |
ROA range filter |
--dividend-yield-min / --dividend-yield-max |
— |
Dividend yield range |
--debt-to-equity-max |
— |
Max Debt/Equity |
--npl-max |
— |
Max NPL (banks) |
--car-min |
— |
Min CAR (banks) |
--cir-max |
— |
Max CIR (banks) |
--market-cap-min / --market-cap-max |
— |
Market cap range |
--industry |
— |
Industry filter (substring, case-insensitive) |
Usage Examples
# Value stocks: low PE + high ROE
aipa fundamentals screen --pe-max 15 --roe-min 0.15 --sort-by roe
# Banking sector only
aipa fundamentals screen --industry "ngân hàng" --sort-by roe
# Safe banks: low NPL + high CAR
aipa fundamentals screen --npl-max 0.015 --car-min 0.10 --sort-by npl --direction asc
# Dividend stocks
aipa fundamentals screen --dividend-yield-min 0.03 --sort-by dividend_yield
# Screen VN30 watchlist
aipa fundamentals screen --watchlist VN30 --pe-max 20 --roe-min 0.10
# Specific tickers
aipa fundamentals screen VCB FPT HPG VNM --roe-min 0.15 --sort-by pe --direction asc
# Historical year
aipa fundamentals screen --year 2024 --sort-by roe
# Specific quarter
aipa fundamentals screen --period "2024 Q3" --sort-by roe
Filter Behavior
- All filters are optional — pass only what you need
- Tickers with missing data for a filtered field are excluded
- Range filters are inclusive:
--roe-min 0.15 matches roe >= 0.15
--industry is case-insensitive substring match (e.g. "ngân hàng" matches "Ngân hàng")
Fundamental Comparison Workflow
When comparing fundamentals across multiple tickers (e.g., "compare VCB TCB MBB fundamentals", "which bank is healthiest", "rank banks by NPL"), follow this workflow. Do NOT just call aipa fundamentals ratios TICKER --latest for each ticker individually — that produces N separate outputs that are hard to compare. Use rank and screen first.
Step 1: Side-by-side ranking (mandatory)
Use aipa fundamentals rank with the specific tickers to get a comparative table in a single call. Run at least 2 perspectives relevant to the sector:
# Profitability comparison
aipa fundamentals rank VCB BID CTG TCB MBB --sort-by roe
# Valuation comparison
aipa fundamentals rank VCB BID CTG TCB MBB --sort-by pe --direction asc
# Bank health: asset quality + capital adequacy
aipa fundamentals rank VCB BID CTG TCB MBB --sort-by npl --direction asc
aipa fundamentals rank VCB BID CTG TCB MBB --sort-by car --direction desc
# General stocks: dividend + valuation
aipa fundamentals rank FPT VNM HPG MWG --sort-by dividend_yield --direction desc
aipa fundamentals rank FPT VNM HPG MWG --sort-by pe --direction asc
Step 2: Screen for quality (optional but recommended)
Use aipa fundamentals screen with the tickers to filter by quality criteria. This eliminates weak candidates immediately:
# Only banks with acceptable asset quality AND profitability
aipa fundamentals screen VCB BID CTG TCB MBB --npl-max 0.015 --roe-min 0.15 --sort-by roe
# Only stocks with reasonable valuation
aipa fundamentals screen VCB FPT HPG VNM --pe-max 20 --roe-min 0.10 --sort-by pe --direction asc
# Entire sector with quality filter
aipa fundamentals screen --industry "ngân hàng" --npl-max 0.02 --car-min 0.09 --sort-by roe
Step 3: Individual deep dive (only for shortlisted tickers)
Only after Steps 1-2, use ratios --latest for individual tickers that ranked at the top or need further investigation. Use info for company context:
aipa fundamentals ratios VCB --latest # full ratios for top candidate
aipa fundamentals ratios VCB --category bank --latest # bank-specific deep dive
aipa fundamentals info VCB # company profile context
Why this matters: rank and screen return all tickers in a single comparative table — far more efficient than calling ratios N times for N tickers and trying to manually compare across outputs. The ranking shows relative position immediately, and the screen eliminates unsuitable candidates before wasting tokens on deep dives.
When to Use This Skill vs Others
| User Request |
Use |
| "Get price data for VCB" |
aipa-data (this skill) |
| "Show me OHLCV candles for BTC" |
aipa-data (this skill) |
| "What's the moving average for FPT?" |
aipa-data (this skill) |
| "Historical prices for VNINDEX" |
aipa-data (this skill) |
| "What are the top stocks today?" |
aipa live-data (this skill) |
| "Most active tickers" |
aipa live-data (this skill) |
| "Show me market overview" |
aipa live-data (this skill) |
| "What tickers are available?" |
aipa ticker-list (this skill) |
| "List banking stocks" |
aipa ticker-list --source vn --group NGAN_HANG (this skill) |
| "Top gainers / losers" |
aipa performers (this skill) |
| "Best performing stocks" |
aipa performers --sort-by close_changed (this skill) |
| "Rank by MA score" |
aipa performers --sort-by ma50_score (this skill) |
| "Volume profile for VCB" |
aipa volume-profile VCB (this skill) |
| "Where is the POC?" |
aipa volume-profile TICKER (this skill) |
| "Support/resistance by volume" |
aipa volume-profile TICKER (this skill) |
| "Company profile for ACB" |
aipa fundamentals info ACB (this skill) |
| "PE ratio for VCB" |
aipa fundamentals ratios VCB --latest (this skill) |
| "Top stocks by ROE" |
aipa fundamentals rank --sort-by roe (this skill) |
| "Screen for low PE banks" |
aipa fundamentals screen --industry "ngân hàng" --pe-max 10 (this skill) |
| "Bank NPL comparison" |
aipa fundamentals rank --sort-by npl --direction asc (this skill) |
| "Analyze VCB" |
aipa-analyze (AI analysis) |
| "Compare FPT and VNM" |
aipa-analyze (AI comparison) |
| "Research the banking sector" |
aipa-research (multi-agent pipeline) |
Key rule: raw numbers → aipa-data, AI insights → aipa-analyze, comprehensive report → aipa-research.
Nhóm Chủ Lực (Core Market Sectors - VN Market Only)
When fetching data or ranking VN tickers, be aware of these core sector groupings for contextual reference:
- Nhóm Ngân hàng (Banking): VCB, BID, CTG, TCB, MBB, ACB, VPB, HDB, SHB, TPB, VIB, SSB, MSB, STB, LPB, EIB.
- Nhóm Bất động sản (Real Estate): VIC, VHM, VRE, VPL, DIG, CEO, L14, TCH, HHS, VGC, IDC.
- Nhóm Chứng khoán (Securities): SSI, VND, HCM, VCI, SHS, VIX, VDS.
- Nhóm Trụ cột / Sản xuất & Bán lẻ (Blue-chips / Core Economy): HPG, HSG, NKG, FPT, MWG, GAS, GVR, PLX, BSR, MSN, VNM, SAB.
- Nhóm Hệ sinh thái (Corporate Ecosystems):
- Họ Vingroup: VIC, VHM, VRE, VPL.
- Họ Bầu Thụy: STB, LPB, THD, HAG.
- Họ Gelex ("Tuấn Mượt"): GEX, GEE, VIX, VGC, EIB, IDC.
- Họ Hoàng Huy: TCH, HHS.
- Họ A7: DIG, CEO, L14.
- Họ TTC (Thành Thành Công): SBT, GEG, VDS.
- Họ Masan: MSN, MCH, MSR, MML, VCF, VSN, NET.
- Họ Viettel: VGI, CTR, VTP.
(Note: This classification applies only to the Vietnamese market. Crypto and Global markets do not use this specific grouping yet.)
Data Usage Policy (CRITICAL)
- NEVER generate, guess, estimate, or hallucinate any numbers — prices, volumes, MA values, MA scores, percentages, dates, or any financial data. Only use data from tool results or user-provided context
- NEVER mention a specific number unless it appears in your tool results or user-provided context
- Use tools proactively — call
aipa get-ohlcv-data and/or aipa performers BEFORE answering price-related questions. Only fall back to asking the user if tools fail
- When researching news or events, ALWAYS include the source name (e.g., "Source: CafeF", "Source: VNExpress")
- Trading Hours: VN market trades 09:00–15:00 ICT (UTC+7), Mon–Fri. Crypto 24/7. If the latest bar shows unusually low volume, the session may still be in progress
Strict Data Reading & Validation (CRITICAL)
Symptom: Misreading or hallucinating the relationship between Price and Moving Averages (e.g., stating a stock is "below EMA20" when it is actually above), or misclassifying a technical event (e.g., calling a failed breakout a "healthy pullback").
Rules:
- Row-by-Row Verification: When reading OHLCV data output from the CLI, you MUST strictly read the exact row for the exact date requested. Do not accidentally read data from an adjacent row or a different ticker's block in multi-ticker outputs.
- Precision Filter with Grep: To minimize reading errors and context volume, always use
grep -E to isolate your target dates across one or multiple tickers. Use "time" as your header anchor.
- Surgical view (Header + Today + Breakout Day):
uvx aipa-cli get-ohlcv-data TCB MSB STB | grep -E "time|2026-05-27|2026-05-07"
- Comparing recent days:
uvx aipa-cli get-ohlcv-data VND | grep -E "time|2026-05-27|2026-05-26"
- Explicit Value Comparison: Before concluding whether a trend is broken or intact, explicitly state the values being compared:
[Close Price] vs [MA/EMA Value].
- Example: "Close is 17.750, EMA20 is 16.881. 17.750 > 16.881 → Price is ABOVE EMA20 (Trend intact)."
- Breakout Validation: A breakout (significant positive price change + high volume) creates a critical support at the structural breakout level — the top of the pre-breakout base/range, the prior swing high, or the pattern's neckline. The breakout candle's Low is NOT a reliable invalidation point: it can extend well below the structural level due to gap opens, intraday noise, or volatile entry bars.
- The correct invalidation is a fall back below the structural breakout level, not below the candle's Low.
- If price pulls back but stays above the structural level, the breakout is intact — this is a healthy pullback.
- If price falls below the structural breakout level, it is a Failed Breakout / Structural Violation.
- Action: Always identify the pre-breakout structure first. Only then assess whether a pullback is healthy (above structure) or a failure (below structure).
Precheck Mandatory — Safety Gate Before Every Entry Decision
Symptom: Analyzing entry on low timeframe (15m/1h) without checking higher timeframe structure — missing historical supply zones (Buying Climax, UTAD) that invalidate the thesis.
Rule: Before proposing ANY entry, trade decision, or price target, you MUST run:
# 1. Daily 60 — detect BC/UTAD/historical structure
aipa get-ohlcv-data TICKER --limit 60 --no-ma
# 2. Weekly 52 — confirm overall trend direction
aipa get-ohlcv-data TICKER --interval 1W --limit 52 --no-ma
# 3. Volume Profile 30+ days — identify key price levels
aipa volume-profile TICKER --start-date [30+ days ago] --end-date [today]
This is a safety gate, not analysis. The purpose is to detect structural red flags before spending tokens on deeper analysis:
| Detection |
Meaning |
Action |
| Buying Climax (BC) at current price zone |
Historical volume peak = large supply |
DO NOT enter here. Lower entry zone or cancel. |
| Upthrust After Distribution (UTAD) |
False breakout, bull trap |
Cancel entry. Wait for return to range. |
| Weekly trend bearish (price below MA20/50 weekly) |
Overall trend is down |
DO NOT go long. Wait for weekly reversal. |
| SOS confirmed + weekly up |
Genuine breakout |
✅ Proceed with entry analysis. |
| Spring at POC + weekly support |
Successful bottom test |
✅ Entry is valid. |
Preflight checklist before every entry:
□ Daily 60 — no BC/UTAD at current price zone
□ Weekly 52 — trend aligned with entry direction
□ VP 30d — TP anchored to swing high/VAH (not round number)
□ SL below POC/VAH/MA20
□ R:R ≥ 1:2 after precheck
Root cause of the FPT error on June 4, 2026: Skipped daily 60 + weekly 52, went straight to 15m intraday. Saw pullback from 77,700 to 76,300 with declining volume → incorrectly assumed LPS (Last Point of Support) in a healthy markup. Missed the May 20 Buying Climax (high 77,432, close 76,643, volume 26M — 2.2× average) which was the exact same supply zone price was retesting at 76,300-76,500 on June 4. Precheck (daily 60 + weekly 52 + VP 30d) would have caught the BC immediately and blocked any buy recommendation at that level.
Calculate Metrics with Python — No Hallucinated Numbers
Symptom: AI writes "vol 5x TB" or "volume gấp 20x trung bình" based on day-over-day % change (+557% vs yesterday) instead of computing the actual volume-vs-average multiplier. The day-over-day % change and the vs-20d-average multiplier are completely different metrics — confusing them produces wrong claims.
Rule: Before writing ANY numerical claim in analysis (volume multiplier, R:R ratio, average cost, MA distance), you MUST compute it using aipa-cli | python3 pipe. NEVER estimate or guess.
Volume vs 20-day Average (the most common mistake)
uvx aipa-cli get-ohlcv-data TICKER --limit 50 --no-ma --no-system-prompt 2>/dev/null | python3 -c "
import sys
from collections import defaultdict
data = defaultdict(list)
for line in sys.stdin:
parts = line.split()
if len(parts) >= 7 and parts[0] != 'time':
data[parts[-1]].append((parts[0], int(float(parts[5]))))
for sym, rows in data.items():
if len(rows) >= 21:
avg20 = sum(r[1] for r in rows[-21:-1]) / 20
last_vol = rows[-1][1]
print(f'{sym} {rows[-1][0]}: vol={last_vol/1e6:.1f}M | avg20d={avg20/1e6:.1f}M | ratio={last_vol/avg20:.1f}x')
"
Anti-pattern: NEVER do this:
volume_changed is +557% → write "vol 5x TB" ❌ (557% ≠ 5x, and it's vs yesterday, not vs 20d avg)
volume_changed is +216% → write "vol 2x TB" ❌ (same mistake)
Correct pattern:
volume_changed +557% means today's volume is 6.57× yesterday's volume (1 + 5.57)
- To get vs-20d-average multiplier, you MUST compute:
today_vol / average(last_20_days_vol)
Batch Volume Verification (multiple tickers + specific dates)
uvx aipa-cli get-ohlcv-data VCB TCB MBB --limit 50 --no-ma --no-system-prompt 2>/dev/null | python3 -c "
import sys
from collections import defaultdict
data = defaultdict(list)
for line in sys.stdin:
parts = line.split()
if len(parts) >= 7 and parts[0] != 'time':
data[parts[-1]].append((parts[0], int(float(parts[5]))))
checks = [
('VCB', '2026-06-10', 20),
('TCB', '2026-06-10', 20),
('MBB', '2026-06-10', 20),
]
for sym, date, ndays in checks:
for i, (d, v) in enumerate(data.get(sym, [])):
if d == date:
start = max(0, i - ndays)
avg = sum(r[1] for r in data[sym][start:i]) / len(data[sym][start:i])
print(f'{sym} {date}: vol={v/1e6:.1f}M avg{ndays}d={avg/1e6:.1f}M ratio={v/avg:.1f}x')
break
"
…(truncated)
1---2name: aipa-data3description: Fetch raw OHLCV price data using the aipa CLI. Use this skill whenever the user asks for price data, candle data, OHLCV data, historical prices, stock quotes, crypto prices, moving averages, volume data, or any raw market data without AI analysis. Also use for: top performers, worst performers, best stocks, top gainers, biggest losers, market movers, ranking tickers by price change / volume / value / MA scores / money flow (`aipa performers`); volume profile, POC, point of control, value area, support/resistance by volume, volume-by-price histogram (`aipa volume-profile`). Also use for fundamental data: company info, financial ratios, PE, PB, ROE, NPL, CAR, fundamental ranking and screening (`aipa fundamentals info/ratios/rank/screen`). Also use when the user wants to inspect what data is available, build charts, perform their own calculations, or get numbers for a spreadsheet. Even if the user doesn't mention "aipa", trigger this skill for any raw financial data, fundamental data, or market ranking request.4---56# aipa-data78Developed by AIPriceAction. More data and documentation at https://aipriceaction.com910## Lời Truyền Cảm Hứng Cho Nhà Giao Dịch1112### Tư duy và Phương pháp luận13- *"Chỉ có xu hướng mới mang lại lợi nhuận, đừng cố tranh cãi với thị trường."*14- *"Giao dịch không phải là dự đoán tương lai, mà là quản lý rủi ro và tuân thủ kỷ luật."*15- *"Volume là dấu chân của dòng tiền thông minh. Giá có thể lừa dối, nhưng khối lượng thì không."*16- *"Kiên nhẫn chờ đợi thiết lập phù hợp là chiếc chìa khóa vàng dẫn đến thành công."*17- *"Thị trường luôn đúng, chỉ có túi tiền của chúng ta là tự chịu trách nhiệm."*18- *"Lợi nhuận bền vững không đến từ việc đoán đúng đỉnh đáy, mà đến từ sự kiên nhẫn và nhất quán."*19- *"Giảm nhiều chưa chắc hết giảm — cần xác nhận thêm."*2021### Kỷ luật và Quản trị rủi ro22- *"Tuân thủ kỷ luật quản trị rủi ro thì không hề 'toang' bạn nhé!"*23- *"Giao dịch không có kế hoạch chính là đang lập kế hoạch cho sự thất bại."*24- *"Cắt lỗ luôn đúng, gồng lỗ luôn sai."*25- *"Sống sót trước khi nghĩ đến lợi nhuận."*26- *"Giữ được vốn quan trọng hơn kiếm được tiền."*27- *"Đừng bao giờ yêu một cổ phiếu, hãy chỉ yêu lợi nhuận và sự an toàn mà nó mang lại."*28- *"Spring cần 2-3 phiên xác nhận + pullback No Supply. Một phiên bùng nổ chưa nói lên điều gì."*29- *"Không bắt dao rơi dù đã rơi 30%. Chờ đến khi có Volume Profile + Wyckoff xác nhận."*3031### Tâm lý và Thực chiến32- *"Thà chảy nước miếng còn hơn chảy nước mắt."*33- *"Đừng cố bắt dao rơi khi chưa thấy đáy vững chắc."*34- *"Trong một xu hướng tăng ai cũng là thiên tài đầu tư, chỉ khi thủy triều rút mới biết ai không mặc quần."*35- *"Mua đuổi (FOMO) khi giá đã tăng nóng giống như đi tàu lượn siêu tốc mà quên thắt dây an toàn."*36- *"Đừng đoán đỉnh, đừng dò đáy."*37- *"Bò kiếm tiền, gấu kiếm tiền, lợn bị làm thịt."*38- *"Xu hướng là bạn, hãy đi cùng bạn."*39- *"Mua tin đồn, bán sự thật."*40- *"Sai lầm lớn nhất là thấy cổ phiếu giảm nhiều rồi nghĩ nó sẽ lên lại — thị trường không nợ bạn một lý do."*41- *"Phân biệt Spring và Upthrust: hỏi 'cổ này đã giảm đủ để clear supply chưa?' Nếu chưa giảm nhiều = còn supply = rủi ro. Nếu đã giảm nhiều = không còn ai bán = cơ hội."*4243### Kiên nhẫn và Quản lý vị thế (No Premature TP & Add-Size)44- *"Hãy để lợi nhuận chạy."*45- *"Chốt non là mất ngon."*46- *"Đúng thì thêm, sai thì cắt."*47- *"Lợi nhuận lớn đến từ việc ngồi yên."*48- *"Đúng giữ, sai cắt."*4950## What is aipa5152`aipa` is an AI-powered financial analysis CLI for Vietnamese stocks, cryptocurrencies, and global assets. The `get-ohlcv-data` command fetches raw OHLCV price data — no AI, no API key required.5354## Installation5556Use `uvx` — no install needed. On the **first call of each session**, use `uvx aipa-cli@latest` to refresh the cache. For all subsequent calls, use plain `uvx aipa-cli` (fast, cached).5758```bash59# All calls — fast cached execution (uvx automatically checks for updates)60uvx aipa-cli get-ohlcv-data VCB6162uvx aipa-cli get-ohlcv-data TCB6364# Fallback: pip (if uv is not available)65pip install aipa-cli66aipa get-ohlcv-data VCB6768# Fallback: system pip (if pip fails due to PEP 668)69python3 -m pip install aipa-cli --break-system-packages70aipa get-ohlcv-data VCB7172# If neither uv nor pip are installed, install uv first:73curl -LsSf https://astral.sh/uv/install.sh | sh74# If the install script fails, see: https://docs.astral.sh/uv/getting-started/installation/75```7677All command examples in this skill use `aipa` for brevity. Replace `aipa` with `uvx aipa-cli` if not installed globally.7879## Keeping the CLI Updated8081The aipa CLI is actively developed with frequent improvements. **Always prefer `uvx aipa-cli` over `aipa`**. When using `uvx`:82831. **Use plain `uvx` for fast cached execution:**84 `uvx aipa-cli get-ohlcv-data VCB`852. **Fallback on failure** — if a command fails with a schema or missing argument error, retry with `@latest`:86 `uvx aipa-cli get-ohlcv-data VCB` (add `@latest` if the command fails)8788If `aipa` is installed globally via `pip`, update before each session:8990```bash91pip install --upgrade aipa-cli92```9394The agent should prefer `uvx aipa-cli` for all commands. Only fall back to `aipa` if `uvx` is unavailable.9596## Environment Variables9798None required. `get-ohlcv-data` fetches data from public S3 archives — no backend API or API key needed.99100## Available Data Sources101102- **Vietnamese stocks** (`source: vn`): VIC, VCB, FPT, HPG, VNM, MBB, TCB, CTG, VPB, HDB, etc.103- **Cryptocurrencies** (`source: crypto`): BTCUSDT, ETHUSDT, BNBUSDT, SOLUSDT, etc.104- **Global/Yahoo** (`source: global/yahoo`): AAPL, TSLA, NVDA, SPY, etc.105- **SJC Gold** (`source: sjc`): SJC gold prices106107### Predefined Watchlists108109The CLI has built-in watchlists for common ticker groups. Use `aipa watchlist get <NAME>` to get tickers for a group, or reference them directly when the user asks about a group like "VN30 stocks" or "Vingroup ecosystem".110111| Name | Tickers | Count |112|---|---|---|113| **VN30** | ACB, BID, **BSR**, CTG, FPT, GAS, GVR, HDB, HPG, LPB, MBB, MSN, MWG, PLX, SAB, SHB, SSB, SSI, STB, TCB, TPB, VCB, VHM, VIB, VIC, VJC, VNM, VPB, VRE, VPL | 30 |114| **VINGROUP** | VIC, VHM, VRE, VPL | 4 |115| **TM** | GEX, GEE, VIX, EIB, VGC, IDC | 6 |116| **MASAN** | MSN, MCH, MSR, MML, VCF, VSN, NET | 7 |117| **INDEX** | VNINDEX, VN30, VN30F1M, VN100, VNMIDCAP, VNSMALLCAP, VNALLSHARE, VNXALLSHARE, VNFIN, HNX30, VNREAL, VNENE, VNMITECH, VNUTI, VNCONS, VNCOND, VNHEAL, VNIND, VNFINLEAD, VNFINSELECT, VNDIAMOND, VNDIVIDEND | 22 |118| **CROSS** | VNINDEX, ^GSPC, GC=F, SJC-GOLD, KC=F, BZ=F, BTCUSDT | 7 |119120Note: VN30 was updated on 2026-05-13 — DGC removed (placed under controlled status), BSR added as replacement.121122```bash123# List all watchlists (predefined + custom)124aipa watchlist ls125126# Get tickers for a specific watchlist127aipa watchlist get VN30128aipa watchlist get VINGROUP129130# Create a custom watchlist131aipa watchlist set MYWATCHLIST FPT VCB HPG VIC132133# Delete a custom watchlist134aipa watchlist rm MYWATCHLIST135136# Using watchlist tickers with get-ohlcv-data137aipa get-ohlcv-data $(aipa watchlist get VN30)138```139140### Supported Intervals141142| Interval | Description | Best For |143|---|---|---|144| `1D` | 1 day (default) | Swing trading, trend analysis |145| `1h` | 1 hour | Intraday analysis, day trading |146| `1m` | 1 minute | Scalping, micro structure |147| `5m` | 5 minutes | Scalping, micro structure |148| `15m` | 15 minutes | Intraday patterns |149| `30m` | 30 minutes | Intraday patterns |150| `4h` | 4 hours | Swing trading, intraday |151| `1W` | 1 week | Medium-term trend analysis |152| `2W` | 2 weeks | Medium-term trend analysis |153154---155156## `aipa get-ohlcv-data` — Raw OHLCV Data157158Fetch raw OHLCV price data without AI analysis. Outputs price data with optional moving averages.159160```bash161aipa get-ohlcv-data TICKER [TICKERS...] [options]162```163164### Flags165166| Flag | Default | Description |167|---|---|---|168| `TICKER [TICKERS...]` | — | One or more ticker symbols (auto-uppercased) |169| `--interval` | `1D` | Time interval: `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1D`, `1W`, `2W` |170| `--limit N` | — | Number of bars |171| `--start-date` | — | Start date (e.g. `2025-01-01`) |172| `--end-date` | — | End date (e.g. `2025-05-01`) |173| `--source` | auto-detect | Filter by source: `vn`, `crypto`, `global` |174| `--ma` / `--no-ma` | included | Include/exclude moving averages |175| `--sma` / `--ema` | settings | Force SMA or EMA (overrides `use_sma` setting). Default MA type controlled by `aipa config get use_sma`. |176| `--no-system-prompt` | — | Exclude persona header from output |177178### aipa-config — Settings Management179180```bash181aipa config get # show all settings (JSON, api_key redacted)182aipa config get use_sma # show single value: true or false183aipa config get language # show language: en or vn184aipa config set use_sma false # switch all commands to EMA185aipa config set use_sma true # switch to SMA186aipa config set language vn # change language187aipa config path # show path to settings file188```189190| Setting | Default | Values | Description |191|---|---|---|---|192| `use_sma` | `true` | `true` / `false` | `true` = SMA, `false` = EMA. Controls MA type for all commands. CLI flags (`--sma`, `--ema`) override per-invocation. |193| `language` | `vn` | `en` / `vn` | Output language for analyze and deep-research |194195**MA Type Priority:** CLI flag (`--sma`/`--ema`) > `settings.json` (`use_sma`) > default (`sma`).196197> **IMPORTANT:** Before any analysis session, run `aipa config get use_sma` to check the current MA type setting. Do NOT assume SMA — the user may have switched to EMA. All MA references in your analysis must match the active setting (SMA or EMA).198199---200201## Useful Presets202203These presets cover the most common data-fetching scenarios. Use them as-is or adapt the parameters.204205### Quick Look206207```bash208# Last 20 daily candles with MA indicators (type from use_sma setting)209aipa get-ohlcv-data VCB210211# Last 20 daily candles, raw OHLCV only212aipa get-ohlcv-data VCB --no-ma213```214215### Trend Analysis (Swing Trading)216217```bash218# 50 daily bars with MA indicators (type from use_sma setting) — good for trend identification219aipa get-ohlcv-data VCB --limit 50220221# 100 daily bars for long-term trend222aipa get-ohlcv-data VIC --limit 100223224# EMA for more responsive trend analysis225aipa get-ohlcv-data FPT --limit 50 --ema226```227228### Intraday Data229230```bash231# Last 50 hourly candles232aipa get-ohlcv-data BTCUSDT --interval 1h --limit 50233234# Last 100 hourly candles for intraday patterns235aipa get-ohlcv-data ETHUSDT --interval 1h --limit 100236237# Minute data for scalping analysis238aipa get-ohlcv-data BTCUSDT --interval 1m --limit 100239```240241### Date Range242243```bash244# Specific date range245aipa get-ohlcv-data FPT --start-date 2025-01-01 --end-date 2025-05-01246247# From a date to today248aipa get-ohlcv-data VCB --start-date 2025-04-01249250# All data in a range, no MA251aipa get-ohlcv-data HPG --start-date 2025-01-01 --end-date 2025-05-01 --no-ma252```253254### Cryptocurrency255256```bash257# BTC daily with EMA258aipa get-ohlcv-data BTCUSDT --limit 50259260# ETH hourly for intraday261aipa get-ohlcv-data ETHUSDT --interval 1h --limit 100262263# SOL raw candles, no MA264aipa get-ohlcv-data SOLUSDT --limit 30 --no-ma265266# BNB daily with EMA267aipa get-ohlcv-data BNBUSDT --limit 50 --ema268```269270### Vietnamese Stocks271272```bash273# Banking sector — all in one call274aipa get-ohlcv-data VCB TCB MBB CTG --limit 30275276# Blue chips277aipa get-ohlcv-data VIC FPT VNM --limit 50278279# Market index280aipa get-ohlcv-data VNINDEX --limit 50281```282283### Global Stocks284285```bash286# US tech stocks287aipa get-ohlcv-data AAPL --limit 50288aipa get-ohlcv-data NVDA --limit 50289aipa get-ohlcv-data TSLA --limit 50290291# Market index292aipa get-ohlcv-data SPY --limit 100293```294295### Minimal Output (for parsing / spreadsheets)296297```bash298# Strip persona header for clean data output299aipa get-ohlcv-data VCB --no-system-prompt300301# Raw OHLCV only, no MA, no header — cleanest output302aipa get-ohlcv-data VCB --no-ma --no-system-prompt303```304305---306307## `aipa ticker-list` — List Available Tickers308309List available ticker symbols with metadata (name, group, exchange, source). No LLM involved, no API key needed.310311Use this to discover what tickers are available before fetching data.312313```bash314aipa ticker-list [--source vn|crypto|global|sjc] [--group GROUP] [--compact]315```316317### Flags318319| Flag | Default | Description |320|---|---|---|321| `--source` | — | Filter by source: `vn`, `crypto`, `global`, `sjc` |322| `--group` | — | Filter by group (e.g. `NGAN_HANG`, `CHUNG_KHOAN`, `BAT_DONG_SAN`) |323| `--compact` | — | Output symbols only, comma-separated |324325### Usage Examples326327```bash328# All tickers329aipa ticker-list330331# VN stocks only332aipa ticker-list --source vn333334# Banking sector335aipa ticker-list --source vn --group NGAN_HANG336337# Crypto symbols only (for passing to other commands)338aipa ticker-list --source crypto --compact339```340341### Data Fields342343Each row includes: ticker, name, group, exchange, source.344345---346347## `aipa live-data` — Top Tickers by Trading Value348349Fetch the latest candle for all tickers or specific tickers. No LLM involved, no API key needed. When no tickers are specified, returns top N tickers sorted by trading value (close × volume) descending.350351Use this to quickly identify the most actively traded tickers and get a market overview.352353```bash354aipa live-data [TICKERS...] [--top 50] [--interval 1D]355```356357### Flags358359| Flag | Default | Description |360|---|---|---|361| `TICKERS...` | — | Optional ticker symbols (auto-uppercased). Omit for top N by trading value. |362| `--top N` | `50` | Number of top tickers to show when no tickers specified |363| `--interval` | `1D` | Time interval: `1m`, `5m`, `15m`, `30m`, `1h`, `4h`, `1D`, `1W`, `2W` |364| `--source` | — | Filter by source: `vn`, `crypto`, `global`, `sjc` |365366### Usage Examples367368```bash369# Top 50 by trading value (broad market overview)370aipa live-data371372# Top 10 only373aipa live-data --top 10374375# Top 20 hourly376aipa live-data --interval 1h --top 20377378# Filter by source: SJC gold379aipa live-data --source sjc380381# Filter by source: crypto top 10382aipa live-data --source crypto --top 10383384# Specific tickers only385aipa live-data VCB TCB MBB386```387388### Data Fields389390Each row includes: ticker, time, open, high, low, close, volume, close_changed (%), volume_changed (%), ma10_score, ma50_score.391392---393394## `aipa performers` — Top/Worst Performers395396Rank top and worst performers from live daily data by any metric. No LLM involved, no API key needed. Defaults to VN stocks.397398```bash399aipa performers [--sort-by close_changed] [--direction desc] [--limit 10] [--source vn] [--group NGAN_HANG]400```401402### Flags403404| Flag | Default | Description |405|---|---|---|406| `--sort-by` | `close_changed` | Metric: `close_changed`, `volume`, `value`, `volume_changed`, `ma10_score`, `ma20_score`, `ma50_score`, `ma100_score`, `ma200_score`, `total_money_changed` |407| `--direction` | `desc` | Sort direction: `desc` (strongest first) or `asc` (weakest first) |408| `--limit N` | `10` | Number of entries per list |409| `--min-volume N` | `10000` | Minimum volume for VN tickers |410| `--source` | `vn` | Data source: `vn`, `crypto`, `global`, `sjc` |411| `--group` | — | Filter by sector: `NGAN_HANG`, `CHUNG_KHOAN`, `BAT_DONG_SAN`, `CONG_NGHE`, `DAU_KHI`, etc. |412413### Usage Examples414415```bash416# Top 10 VN stocks by price change (default)417aipa performers418419# Top 5 by volume, ascending420aipa performers --sort-by volume --direction asc --limit 5421422# Top 20 by MA50 score423aipa performers --sort-by ma50_score --limit 20424425# Crypto performers426aipa performers --source crypto --limit 5427428# Top 10 by trading value (close × volume)429aipa performers --sort-by value --limit 10430431# By money flow432aipa performers --sort-by total_money_changed --limit 15433434# Banking sector only, sorted by value435aipa performers --group NGAN_HANG --sort-by value436437# Securities sector top gainers438aipa performers --group CHUNG_KHOAN --sort-by close_changed --limit 5439440# Real estate sector by MA50 trend441aipa performers --group BAT_DONG_SAN --sort-by ma50_score442```443444---445446## `aipa volume-profile` — Volume-by-Price Histogram447448Volume profile analysis from 1-minute data showing Point of Control (POC), Value Area, and volume-weighted statistics. No LLM involved, no API key needed.449450```bash451aipa volume-profile TICKER [--date YYYY-MM-DD] [--source vn] [--bins 50] [--value-area-pct 70]452```453454### Flags455456| Flag | Default | Description |457|---|---|---|458| `TICKER` | — | Ticker symbol (required) |459| `--date` | today | Single date (YYYY-MM-DD) |460| `--start-date` / `--end-date` | — | Date range |461| `--source` | auto-detect | Source for tick size: `vn`, `crypto`, `global`, `sjc` |462| `--bins N` | `50` | Number of price bins (2–200) |463| `--value-area-pct` | `70` | Value area target % (60–90) |464465### Usage Examples466467**Prefer multi-day ranges** over single-day profiles — they produce more reliable support/resistance levels and smooth out intraday noise. Use `--start-date` and `--end-date` covering at least 20 trading days as the default approach. Only use a single `--date` when the user explicitly asks for one specific day.468469```bash470# 1-month range for VCB (preferred default)471aipa volume-profile VCB --start-date 2026-04-14 --end-date 2026-05-09472473# 2-week range474aipa volume-profile VCB --start-date 2026-04-28 --end-date 2026-05-09 --bins 30475476# Specific date (only when user asks for one day)477aipa volume-profile VCB --date 2026-05-09478479# Crypto multi-day range480aipa volume-profile BTCUSDT --source crypto --bins 30 --start-date 2026-05-05 --end-date 2026-05-09481482# Full options: date range with wider value area483aipa volume-profile FPT --start-date 2026-05-01 --end-date 2026-05-09 --bins 30 --value-area-pct 80484```485486### Output487488- **POC** (Point of Control): price level with the highest volume489- **Value Area**: price range containing the target % of total volume (default 70%)490- **Statistics**: volume-weighted mean, median, standard deviation, skewness491- **Profile**: binned price levels with volume, percentage, and visual bar chart492493---494495## Interpreting Output496497The CLI outputs to two streams:498499- **stdout**: The OHLCV data table. This is what you should present to the user.500- **stderr**: Status messages with structured markers.501502### Status Markers (stderr)503504| Marker | Meaning |505|---|---|506| `[build]` | Data fetching status and timing |507| `[error]` | Error message |508| `[done]` | Fetch complete, includes total time |509510### Data Fields511512Each row includes: date/time, open, high, low, close, volume. When `--ma` is enabled (default), moving average columns are also included.513514### Attribution515516When presenting data or any derived analysis to the user, always include an attribution line at the end of your response:517- **English**: "_Data by [AIPriceAction](https://aipriceaction.com/) | AI-powered analysis — may contain errors. Verify before trading._"518- **Vietnamese**: "_Dữ liệu bởi [AIPriceAction](https://aipriceaction.com/) | Phân tích bởi AI — có thể chứa sai sót. Vui lòng kiểm chứng trước khi giao dịch._"519520Do NOT say "analysis provided by AIPriceAction" or "phân tích được cung cấp bởi AIPriceAction". AIPriceAction provides the **data**; the **analysis** is AI-generated and may be inaccurate.521522---523524## `aipa fundamentals` — Fundamental Data (requires aipa-cli >= 0.1.48)525526> **Version gate:** `aipa fundamentals` requires **aipa-cli >= 0.1.48**. Verify before use:527> ```bash528> aipa --version529> # or530> uvx aipa-cli --version531> ```532> If the version is < 0.1.48, upgrade: `uvx aipa-cli@latest fundamentals info ACB` or `pip install --upgrade aipa-cli`.533534No LLM involved, no API key needed. Reads from cached `vn.zip` (downloads ~15-20 MB on first call, cached locally after).535536> **IMPORTANT:** Fundamentals commands only accept the flags documented below.537>538> **When to fetch:** Do NOT automatically run fundamentals. Technical analysis (VPA, Wyckoff, MA) is the default. When the user says "report" or "báo cáo", they may want fundamentals — if unclear, ask to confirm.539540---541542## `aipa fundamentals info` — Company Profile543544Show company profile, shareholders, and officers for a ticker.545546```bash547aipa fundamentals info TICKER [--source vn]548```549550### Flags551552| Flag | Default | Description |553|---|---|---|554| `TICKER` | — | Ticker symbol (required) |555| `--source` | auto | Data source |556557### Usage Examples558559```bash560# Company profile for ACB561aipa fundamentals info ACB562563# With explicit source564aipa fundamentals info FPT --source vn565```566567### Output Fields568569Industry, market cap, current price, outstanding shares, top shareholders with ownership %, officers with positions.570571---572573## `aipa fundamentals ratios` — Financial Ratios574575Show financial ratios for a ticker, organized by category. No LLM involved, no API key needed.576577```bash578aipa fundamentals ratios TICKER [options]579```580581### Flags582583| Flag | Default | Description |584|---|---|---|585| `TICKER` | — | Ticker symbol (required) |586| `--latest` | off | Show latest period only (quarterly or yearly) — fastest, single result |587| `--no-yearly` | off | Include quarterly reports |588| `--yearly` | off | Yearly reports only |589| `--year YEAR` | — | Show specific year (e.g. `2024`) |590| `--period PERIOD` | — | Specific period like `"2024"` or `"2024 Q2"` |591| `--category` | all | `valuation`, `profitability`, `leverage`, `liquidity`, `bank`, `efficiency` |592| `--json` | off | Raw JSON output |593| `--source` | auto | Data source |594595### Usage Examples596597```bash598# All periods (yearly + quarterly) — default599aipa fundamentals ratios VCB600601# Latest period only (quarterly or yearly) — quickest, single result602aipa fundamentals ratios VCB --latest603604# Specific year605aipa fundamentals ratios VCB --year 2024606607# Specific quarter608aipa fundamentals ratios VCB --period "2024 Q2"609610# Include quarterly reports (same as default)611aipa fundamentals ratios VCB --no-yearly612613# Yearly reports only614aipa fundamentals ratios VCB --yearly615616# Only bank-specific fields617aipa fundamentals ratios VCB --category bank618619# Raw JSON output620aipa fundamentals ratios VCB --json621```622623### Categories624625| Category | Fields |626|---|---|627| Valuation | PE, PB, PS, EV/EBITDA, Price/CashFlow, Dividend Yield, Market Cap |628| Profitability | ROE, ROA, ROIC, Gross Margin, After-Tax Margin, Pre-Tax Margin, EBIT Margin, Net Interest Margin |629| Efficiency | Asset Turnover, Fixed Asset Turnover, Cash Cycle, DSO, DIO, DPO |630| Leverage | Debt/Equity, Financial Leverage, Equity/Liabilities, Equity/Loans, Equity/Total Asset |631| Liquidity | Current Ratio, Quick Ratio, Cash Ratio |632| Bank | NPL, LDR, CAR, CASA, CIR, Non-Interest Income, Deposit/Loans Growth, LLR ratios |633634---635636## `aipa fundamentals rank` — Rank by Fundamental Field637638Rank tickers by any of 50+ fundamental fields. No LLM involved, no API key needed.639640```bash641aipa fundamentals rank [TICKERS...] [options]642```643644### Flags645646| Flag | Default | Description |647|---|---|---|648| `tickers` | all VN | Positional ticker symbols |649| `--sort-by` | `roe` | Field to rank by (50+ fields, see below) |650| `--direction` | `desc` | `desc` (highest first) or `asc` (lowest first) |651| `--limit` | `10` | Max results |652| `--latest` | off | Show latest period only (quarterly or yearly) |653| `--yearly` | off | Yearly reports only |654| `--year YEAR` | — | Specific year (e.g. `2024`) |655| `--period PERIOD` | — | Specific period like `"2024"` or `"2024 Q2"` |656| `--watchlist` | — | Use watchlist as ticker source (VN30, VINGROUP, TM, MASAN, custom...) |657| `--source` | auto | Data source |658659### Usage Examples660661```bash662# Top 10 VN stocks by ROE (default)663aipa fundamentals rank664665# Cheapest 20 by PE666aipa fundamentals rank --sort-by pe --direction asc --limit 20667668# Banking tickers ranked by CAR669aipa fundamentals rank VCB BID CTG TCB MBB --sort-by car --direction desc670671# VN30 watchlist ranked by ROE672aipa fundamentals rank --watchlist VN30 --sort-by roe --limit 15673674# Best asset quality (lowest NPL)675aipa fundamentals rank --sort-by npl --direction asc --limit 10676677# Highest dividend yield678aipa fundamentals rank --sort-by dividend_yield --direction desc679680# Largest by market cap681aipa fundamentals rank --sort-by market_cap --direction desc --limit 20682683# Historical year684aipa fundamentals rank --year 2023 --sort-by roe685686# Specific quarter687aipa fundamentals rank --period "2016 Q4" --sort-by roe688```689690### Sortable Fields (50+)691692`pe`, `pb`, `ps`, `ev_to_ebitda`, `price_to_cash_flow`, `dividend_yield`, `market_cap`, `roe`, `roa`, `roic`, `gross_margin`, `after_tax_profit_margin`, `pre_tax_profit_margin`, `ebit_margin`, `net_interest_margin`, `ebit`, `ebitda`, `asset_turnover`, `fixed_asset_turnover`, `debt_to_equity`, `debt_per_equity`, `financial_leverage`, `equity_to_liabilities`, `equity_to_loans`, `total_equity_total_asset`, `owners_equity`, `equity`, `current_ratio`, `quick_ratio`, `cash_ratio`, `cash_cycle`, `day_sale_outstanding`, `days_inventory_outstanding`, `days_payable_outstanding`, `npl`, `ldr_loan_deposit_ratio`, `car`, `casa_ratio`, `cir`, `cost_to_income`, `non_and_interest_income`, `deposit_growth`, `loans_growth`, `loans_loss_reserve_to_loans`, `loans_loss_reserves_to_npl`, `provision_to_outstanding_loans`, `average_cost_of_financing`, `average_yield_on_earning_assets`, `outstanding_shares`, `employees`, `current_price`.693694### Ticker Source Resolution (rank and screen)6956961. `--watchlist NAME` — resolve from predefined (VN30, VINGROUP...) or custom watchlists6972. Positional `tickers` — explicit list6983. Default — all VN tickers from ticker metadata699700---701702## `aipa fundamentals screen` — Multi-Criteria Screening703704Filter tickers by fundamental criteria, then rank by a field. No LLM involved, no API key needed.705706```bash707aipa fundamentals screen [TICKERS...] [options]708```709710### Flags711712| Flag | Default | Description |713|---|---|---|714| `tickers` | all VN | Positional ticker symbols |715| `--sort-by` | `roe` | Field to rank by (same as rank) |716| `--direction` | `desc` | Sort direction |717| `--limit` | `50` | Max results (1–500) |718| `--latest` | off | Show latest period only (quarterly or yearly) |719| `--yearly` | off | Yearly reports only |720| `--year YEAR` | — | Specific year (e.g. `2024`) |721| `--period PERIOD` | — | Specific period like `"2024"` or `"2024 Q2"` |722| `--watchlist` | — | Use watchlist as ticker source |723| `--source` | auto | Data source |724| `--pe-min` / `--pe-max` | — | PE range filter |725| `--pb-min` / `--pb-max` | — | PB range filter |726| `--roe-min` / `--roe-max` | — | ROE range filter |727| `--roa-min` / `--roa-max` | — | ROA range filter |728| `--dividend-yield-min` / `--dividend-yield-max` | — | Dividend yield range |729| `--debt-to-equity-max` | — | Max Debt/Equity |730| `--npl-max` | — | Max NPL (banks) |731| `--car-min` | — | Min CAR (banks) |732| `--cir-max` | — | Max CIR (banks) |733| `--market-cap-min` / `--market-cap-max` | — | Market cap range |734| `--industry` | — | Industry filter (substring, case-insensitive) |735736### Usage Examples737738```bash739# Value stocks: low PE + high ROE740aipa fundamentals screen --pe-max 15 --roe-min 0.15 --sort-by roe741742# Banking sector only743aipa fundamentals screen --industry "ngân hàng" --sort-by roe744745# Safe banks: low NPL + high CAR746aipa fundamentals screen --npl-max 0.015 --car-min 0.10 --sort-by npl --direction asc747748# Dividend stocks749aipa fundamentals screen --dividend-yield-min 0.03 --sort-by dividend_yield750751# Screen VN30 watchlist752aipa fundamentals screen --watchlist VN30 --pe-max 20 --roe-min 0.10753754# Specific tickers755aipa fundamentals screen VCB FPT HPG VNM --roe-min 0.15 --sort-by pe --direction asc756757# Historical year758aipa fundamentals screen --year 2024 --sort-by roe759760# Specific quarter761aipa fundamentals screen --period "2024 Q3" --sort-by roe762```763764### Filter Behavior765766- All filters are optional — pass only what you need767- Tickers with missing data for a filtered field are excluded768- Range filters are inclusive: `--roe-min 0.15` matches `roe >= 0.15`769- `--industry` is case-insensitive substring match (e.g. `"ngân hàng"` matches `"Ngân hàng"`)770771---772773### Fundamental Comparison Workflow774775When comparing fundamentals across multiple tickers (e.g., "compare VCB TCB MBB fundamentals", "which bank is healthiest", "rank banks by NPL"), follow this workflow. **Do NOT just call `aipa fundamentals ratios TICKER --latest` for each ticker individually** — that produces N separate outputs that are hard to compare. Use `rank` and `screen` first.776777**Step 1: Side-by-side ranking (mandatory)**778779Use `aipa fundamentals rank` with the specific tickers to get a comparative table in a single call. Run at least 2 perspectives relevant to the sector:780781```bash782# Profitability comparison783aipa fundamentals rank VCB BID CTG TCB MBB --sort-by roe784785# Valuation comparison786aipa fundamentals rank VCB BID CTG TCB MBB --sort-by pe --direction asc787788# Bank health: asset quality + capital adequacy789aipa fundamentals rank VCB BID CTG TCB MBB --sort-by npl --direction asc790aipa fundamentals rank VCB BID CTG TCB MBB --sort-by car --direction desc791792# General stocks: dividend + valuation793aipa fundamentals rank FPT VNM HPG MWG --sort-by dividend_yield --direction desc794aipa fundamentals rank FPT VNM HPG MWG --sort-by pe --direction asc795```796797**Step 2: Screen for quality (optional but recommended)**798799Use `aipa fundamentals screen` with the tickers to filter by quality criteria. This eliminates weak candidates immediately:800801```bash802# Only banks with acceptable asset quality AND profitability803aipa fundamentals screen VCB BID CTG TCB MBB --npl-max 0.015 --roe-min 0.15 --sort-by roe804805# Only stocks with reasonable valuation806aipa fundamentals screen VCB FPT HPG VNM --pe-max 20 --roe-min 0.10 --sort-by pe --direction asc807808# Entire sector with quality filter809aipa fundamentals screen --industry "ngân hàng" --npl-max 0.02 --car-min 0.09 --sort-by roe810```811812**Step 3: Individual deep dive (only for shortlisted tickers)**813814Only after Steps 1-2, use `ratios --latest` for individual tickers that ranked at the top or need further investigation. Use `info` for company context:815816```bash817aipa fundamentals ratios VCB --latest # full ratios for top candidate818aipa fundamentals ratios VCB --category bank --latest # bank-specific deep dive819aipa fundamentals info VCB # company profile context820```821822**Why this matters:** `rank` and `screen` return all tickers in a single comparative table — far more efficient than calling `ratios` N times for N tickers and trying to manually compare across outputs. The ranking shows relative position immediately, and the screen eliminates unsuitable candidates before wasting tokens on deep dives.823824---825826## When to Use This Skill vs Others827828| User Request | Use |829|---|---|830| "Get price data for VCB" | `aipa-data` (this skill) |831| "Show me OHLCV candles for BTC" | `aipa-data` (this skill) |832| "What's the moving average for FPT?" | `aipa-data` (this skill) |833| "Historical prices for VNINDEX" | `aipa-data` (this skill) |834| "What are the top stocks today?" | `aipa live-data` (this skill) |835| "Most active tickers" | `aipa live-data` (this skill) |836| "Show me market overview" | `aipa live-data` (this skill) |837| "What tickers are available?" | `aipa ticker-list` (this skill) |838| "List banking stocks" | `aipa ticker-list --source vn --group NGAN_HANG` (this skill) |839| "Top gainers / losers" | `aipa performers` (this skill) |840| "Best performing stocks" | `aipa performers --sort-by close_changed` (this skill) |841| "Rank by MA score" | `aipa performers --sort-by ma50_score` (this skill) |842| "Volume profile for VCB" | `aipa volume-profile VCB` (this skill) |843| "Where is the POC?" | `aipa volume-profile TICKER` (this skill) |844| "Support/resistance by volume" | `aipa volume-profile TICKER` (this skill) |845| "Company profile for ACB" | `aipa fundamentals info ACB` (this skill) |846| "PE ratio for VCB" | `aipa fundamentals ratios VCB --latest` (this skill) |847| "Top stocks by ROE" | `aipa fundamentals rank --sort-by roe` (this skill) |848| "Screen for low PE banks" | `aipa fundamentals screen --industry "ngân hàng" --pe-max 10` (this skill) |849| "Bank NPL comparison" | `aipa fundamentals rank --sort-by npl --direction asc` (this skill) |850| "Analyze VCB" | `aipa-analyze` (AI analysis) |851| "Compare FPT and VNM" | `aipa-analyze` (AI comparison) |852| "Research the banking sector" | `aipa-research` (multi-agent pipeline) |853854Key rule: **raw numbers → `aipa-data`, AI insights → `aipa-analyze`, comprehensive report → `aipa-research`**.855856---857858## Nhóm Chủ Lực (Core Market Sectors - VN Market Only)859860When fetching data or ranking VN tickers, be aware of these core sector groupings for contextual reference:861862* **Nhóm Ngân hàng (Banking):** VCB, BID, CTG, TCB, MBB, ACB, VPB, HDB, SHB, TPB, VIB, SSB, MSB, STB, LPB, EIB.863* **Nhóm Bất động sản (Real Estate):** VIC, VHM, VRE, VPL, DIG, CEO, L14, TCH, HHS, VGC, IDC.864* **Nhóm Chứng khoán (Securities):** SSI, VND, HCM, VCI, SHS, VIX, VDS.865* **Nhóm Trụ cột / Sản xuất & Bán lẻ (Blue-chips / Core Economy):** HPG, HSG, NKG, FPT, MWG, GAS, GVR, PLX, BSR, MSN, VNM, SAB.866* **Nhóm Hệ sinh thái (Corporate Ecosystems):**867 * Họ Vingroup: VIC, VHM, VRE, VPL.868 * Họ Bầu Thụy: STB, LPB, THD, HAG.869 * Họ Gelex ("Tuấn Mượt"): GEX, GEE, VIX, VGC, EIB, IDC.870 * Họ Hoàng Huy: TCH, HHS.871 * Họ A7: DIG, CEO, L14.872 * Họ TTC (Thành Thành Công): SBT, GEG, VDS.873 * Họ Masan: MSN, MCH, MSR, MML, VCF, VSN, NET.874 * Họ Viettel: VGI, CTR, VTP.875876*(Note: This classification applies only to the Vietnamese market. Crypto and Global markets do not use this specific grouping yet.)*877878---879880## Data Usage Policy (CRITICAL)8818821. **NEVER generate, guess, estimate, or hallucinate any numbers** — prices, volumes, MA values, MA scores, percentages, dates, or any financial data. Only use data from tool results or user-provided context8832. **NEVER mention a specific number unless it appears in your tool results or user-provided context**8843. **Use tools proactively** — call `aipa get-ohlcv-data` and/or `aipa performers` BEFORE answering price-related questions. Only fall back to asking the user if tools fail8854. **When researching news or events, ALWAYS include the source name** (e.g., "Source: CafeF", "Source: VNExpress")8865. **Trading Hours**: VN market trades 09:00–15:00 ICT (UTC+7), Mon–Fri. Crypto 24/7. If the latest bar shows unusually low volume, the session may still be in progress887888## Strict Data Reading & Validation (CRITICAL)889890**Symptom:** Misreading or hallucinating the relationship between Price and Moving Averages (e.g., stating a stock is "below EMA20" when it is actually above), or misclassifying a technical event (e.g., calling a failed breakout a "healthy pullback").891892**Rules:**893894- **Row-by-Row Verification:** When reading OHLCV data output from the CLI, you MUST strictly read the exact row for the exact date requested. Do not accidentally read data from an adjacent row or a different ticker's block in multi-ticker outputs.895- **Precision Filter with Grep:** To minimize reading errors and context volume, always use `grep -E` to isolate your **target dates** across one or multiple tickers. Use `"time"` as your header anchor.896 - *Surgical view (Header + Today + Breakout Day):*897 `uvx aipa-cli get-ohlcv-data TCB MSB STB | grep -E "time|2026-05-27|2026-05-07"`898 - *Comparing recent days:*899 `uvx aipa-cli get-ohlcv-data VND | grep -E "time|2026-05-27|2026-05-26"`900- **Explicit Value Comparison:** Before concluding whether a trend is broken or intact, explicitly state the values being compared: `[Close Price]` vs `[MA/EMA Value]`.901 - *Example:* "Close is 17.750, EMA20 is 16.881. 17.750 > 16.881 → Price is ABOVE EMA20 (Trend intact)."902- **Breakout Validation:** A breakout (significant positive price change + high volume) creates a critical support at the **structural breakout level** — the top of the pre-breakout base/range, the prior swing high, or the pattern's neckline. The breakout candle's **Low** is NOT a reliable invalidation point: it can extend well below the structural level due to gap opens, intraday noise, or volatile entry bars.903 - The correct invalidation is a fall back **below the structural breakout level**, not below the candle's Low.904 - If price pulls back but stays above the structural level, the breakout is intact — this is a healthy pullback.905 - If price falls **below the structural breakout level**, it is a **Failed Breakout / Structural Violation**.906 - *Action:* Always identify the pre-breakout structure first. Only then assess whether a pullback is healthy (above structure) or a failure (below structure).907908---909910## Precheck Mandatory — Safety Gate Before Every Entry Decision911912**Symptom:** Analyzing entry on low timeframe (15m/1h) without checking higher timeframe structure — missing historical supply zones (Buying Climax, UTAD) that invalidate the thesis.913914**Rule:** Before proposing ANY entry, trade decision, or price target, you MUST run:915916```bash917# 1. Daily 60 — detect BC/UTAD/historical structure918aipa get-ohlcv-data TICKER --limit 60 --no-ma919920# 2. Weekly 52 — confirm overall trend direction921aipa get-ohlcv-data TICKER --interval 1W --limit 52 --no-ma922923# 3. Volume Profile 30+ days — identify key price levels924aipa volume-profile TICKER --start-date [30+ days ago] --end-date [today]925```926927This is a **safety gate**, not analysis. The purpose is to detect structural red flags before spending tokens on deeper analysis:928929| Detection | Meaning | Action |930|---|---|---|931| **Buying Climax (BC)** at current price zone | Historical volume peak = large supply | DO NOT enter here. Lower entry zone or cancel. |932| **Upthrust After Distribution (UTAD)** | False breakout, bull trap | Cancel entry. Wait for return to range. |933| **Weekly trend bearish** (price below MA20/50 weekly) | Overall trend is down | DO NOT go long. Wait for weekly reversal. |934| **SOS confirmed + weekly up** | Genuine breakout | ✅ Proceed with entry analysis. |935| **Spring at POC + weekly support** | Successful bottom test | ✅ Entry is valid. |936937**Preflight checklist before every entry:**938939```940□ Daily 60 — no BC/UTAD at current price zone941□ Weekly 52 — trend aligned with entry direction942□ VP 30d — TP anchored to swing high/VAH (not round number)943□ SL below POC/VAH/MA20944□ R:R ≥ 1:2 after precheck945```946947> **Root cause of the FPT error on June 4, 2026:** Skipped daily 60 + weekly 52, went straight to 15m intraday. Saw pullback from 77,700 to 76,300 with declining volume → incorrectly assumed LPS (Last Point of Support) in a healthy markup. Missed the May 20 Buying Climax (high 77,432, close 76,643, volume 26M — 2.2× average) which was the exact same supply zone price was retesting at 76,300-76,500 on June 4. Precheck (daily 60 + weekly 52 + VP 30d) would have caught the BC immediately and blocked any buy recommendation at that level.948949---950951## Calculate Metrics with Python — No Hallucinated Numbers952953**Symptom:** AI writes "vol 5x TB" or "volume gấp 20x trung bình" based on day-over-day % change (`+557% vs yesterday`) instead of computing the actual volume-vs-average multiplier. The day-over-day % change and the vs-20d-average multiplier are **completely different metrics** — confusing them produces wrong claims.954955**Rule:** Before writing ANY numerical claim in analysis (volume multiplier, R:R ratio, average cost, MA distance), you MUST compute it using `aipa-cli | python3` pipe. NEVER estimate or guess.956957### Volume vs 20-day Average (the most common mistake)958959```bash960uvx aipa-cli get-ohlcv-data TICKER --limit 50 --no-ma --no-system-prompt 2>/dev/null | python3 -c "961import sys962from collections import defaultdict963data = defaultdict(list)964for line in sys.stdin:965 parts = line.split()966 if len(parts) >= 7 and parts[0] != 'time':967 data[parts[-1]].append((parts[0], int(float(parts[5]))))968for sym, rows in data.items():969 if len(rows) >= 21:970 avg20 = sum(r[1] for r in rows[-21:-1]) / 20971 last_vol = rows[-1][1]972 print(f'{sym} {rows[-1][0]}: vol={last_vol/1e6:.1f}M | avg20d={avg20/1e6:.1f}M | ratio={last_vol/avg20:.1f}x')973"974```975976**Anti-pattern:** NEVER do this:977- `volume_changed` is +557% → write "vol 5x TB" ❌ (557% ≠ 5x, and it's vs yesterday, not vs 20d avg)978- `volume_changed` is +216% → write "vol 2x TB" ❌ (same mistake)979980**Correct pattern:**981- `volume_changed` +557% means today's volume is 6.57× yesterday's volume (1 + 5.57)982- To get vs-20d-average multiplier, you MUST compute: `today_vol / average(last_20_days_vol)`983984### Batch Volume Verification (multiple tickers + specific dates)985986```bash987uvx aipa-cli get-ohlcv-data VCB TCB MBB --limit 50 --no-ma --no-system-prompt 2>/dev/null | python3 -c "988import sys989from collections import defaultdict990data = defaultdict(list)991for line in sys.stdin:992 parts = line.split()993 if len(parts) >= 7 and parts[0] != 'time':994 data[parts[-1]].append((parts[0], int(float(parts[5]))))995checks = [996 ('VCB', '2026-06-10', 20),997 ('TCB', '2026-06-10', 20),998 ('MBB', '2026-06-10', 20),999]1000for sym, date, ndays in checks:1001 for i, (d, v) in enumerate(data.get(sym, [])):1002 if d == date:1003 start = max(0, i - ndays)1004 avg = sum(r[1] for r in data[sym][start:i]) / len(data[sym][start:i])1005 print(f'{sym} {date}: vol={v/1e6:.1f}M avg{ndays}d={avg/1e6:.1f}M ratio={v/avg:.1f}x')1006 break1007"1008```1009101010111012…(truncated)