aipa-research
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 deep-research command runs a multi-agent pipeline that produces comprehensive market reports far more thorough than single-ticker analysis.
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 deep-research
uvx aipa-cli deep-research
# Fallback: pip (if uv is not available)
pip install aipa-cli
aipa deep-research
# Fallback: system pip (if pip fails due to PEP 668)
python3 -m pip install aipa-cli --break-system-packages
aipa deep-research
# 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 deep-research
- Fallback on failure — if a command fails with a schema or missing argument error, retry with
@latest:
uvx aipa-cli deep-research (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
| Variable |
Required |
Default |
Purpose |
OPENAI_API_KEY |
Only with --run |
— |
API key for the LLM provider |
OPENAI_BASE_URL |
No |
OpenRouter |
Base URL for OpenAI-compatible API |
OPENAI_MODEL |
No |
openrouter/owl-alpha |
Model to use for analysis |
Run aipa setup for interactive first-run configuration. Settings are saved to ~/.aipriceaction/settings.json.
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).
Pre-Execution: Ask the User
STOP. Do NOT run any commands yet. You MUST call AskUserQuestion (or question / QuestionTool in compatible agents) first to ask the user which mode they want.
If you run any aipa command before asking the user, you have failed. Always ask first.
Ask the user this question using the AskUserQuestion tool (or equivalent question tool):
- Fast Research (Recommended) — Run
aipa deep-research to get the market snapshot, then you (the AI agent) replicate the multi-agent pipeline using subagents + aipa get-ohlcv-data. No API key needed. This is the recommended default — it produces thorough results without the 5-10 minute wait.
- Full pipeline (
--run) — Run aipa deep-research --run to use the actual CLI multi-agent pipeline. Takes 5-10 minutes and requires an API key configured via aipa setup.
Only skip asking if the user's request explicitly indicates they want the full CLI pipeline (e.g., "run the full pipeline", "use --run").
- If the user chooses Fast Research: follow the Fast Research: Agent-Driven Pipeline section below.
- If the user chooses Full pipeline: run
aipa deep-research --run [QUESTION] and present the stdout output.
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 in deep-research worker assignments
aipa watchlist get VN30 # use these tickers for the VN30 sector worker
Supported Intervals
| Interval |
Description |
1m |
1 minute |
5m |
5 minutes |
15m |
15 minutes |
30m |
30 minutes |
1h |
1 hour |
4h |
4 hours |
1D |
1 day (default) |
1W |
1 week |
2W |
2 weeks |
aipa deep-research — Multi-Agent Research Pipeline
The default behavior (aipa deep-research without flags) fetches and prints a market snapshot. Add --run to execute the full multi-agent pipeline. Use --source to target different markets — the supervisor, workers, prompts, and default question all adapt to the selected source.
aipa deep-research [QUESTION] [options]
Flags
| Flag |
Default |
Description |
QUESTION |
market overview |
Research question (optional) |
--run |
off |
Run the full multi-agent pipeline (5-10 min). Without this, only dumps market snapshot. |
--source |
vn |
Data source: vn, crypto, global, sjc |
--resume ID |
— |
Resume from a checkpoint session ID |
--output FILE |
— |
Save final report to file |
--lang |
saved setting |
Language: en or vn |
MA Type: All MA indicators follow the use_sma setting (~/.aipriceaction/settings.json). Run aipa config get use_sma to check the active type before analysis. Use aipa config set use_sma false for EMA, or pass --sma/--ema flags on individual aipa analyze calls.
Usage Examples
# Market snapshot only (default, fast, no API key needed)
aipa deep-research
# Crypto market snapshot
aipa deep-research --source crypto
# Market snapshot with a custom question in the output
aipa deep-research "Research banking sector"
# Run the FULL multi-agent pipeline (slow, 5-10 min, requires API key)
aipa deep-research --run
# Full pipeline for global stocks
aipa deep-research --source global --run
# Full pipeline for crypto
aipa deep-research --source crypto --run
# Full pipeline with a custom research question
aipa deep-research --run "Deep research on the banking sector: analyze top 10 banks by market cap, assess trend direction, VPA signals, MA momentum, and identify leaders vs laggards"
# Save full pipeline report to file
aipa deep-research --run --output banking_report.md
# Vietnamese output (full pipeline)
aipa deep-research --run "Phân tích toàn diện thị trường chứng khoán Việt Nam" --lang vn
# Resume an interrupted research session
aipa deep-research --run --resume abc123
How the Pipeline Works
The deep-research pipeline uses a multi-agent architecture with quality control:
Supervisor
│ Decomposes question into 3-5 sector subtasks
│ Selects top 10 tickers per sector
▼
Parallel Workers (fan-out)
│ Each worker analyzes one sector
│ Fetches OHLCV data for each ticker
│ Produces sector-specific report
▼
Aggregator
│ Synthesizes all sector reports
│ Cross-references findings
│ Builds unified ranking table
▼
Reviewer
│ Checks data integrity
│ Verifies MA scores and ticker coverage
│ Approves or rejects with feedback
▼
Final Report
Pipeline Stages
Market Snapshot: Fetches latest OHLCV data for all tickers from the selected source (--source, default vn) to identify active sectors and tickers.
Supervisor: Analyzes the research question and market snapshot. Decomposes into 3-5 sector-specific subtasks. Mandatory sectors depend on the source:
- VN: Banking, Securities, Real Estate
- Crypto: Layer 1 (BTC, ETH, SOL), DeFi, AI tokens
- Global/Yahoo: Technology, Financials, Energy
- SJC: Gold / Precious Metals
Adds 0-2 additional sectors based on market activity.
Parallel Workers: Each worker handles one sector:
- Fetches OHLCV data for each assigned ticker (limit=50 bars)
- Runs volume profile for the top 3 most important tickers (30+ trading day range)
- Fetches intraday data (1h) for tickers showing breakout/reversal patterns
- Analyzes trend direction, VPA signals, MA score momentum, volume, and S/R
- Cross-references volume profile levels with price action
- Provides per-ticker assessment, sector ranking, and key risk factors
- Workers run concurrently for efficiency
Aggregator: Collects all worker reports and synthesizes a unified analysis:
- Cross-references findings across sectors
- Builds multi-sector ranking table
- Identifies cross-sector rotation patterns
- Highlights key opportunities and risks
Reviewer: Quality assurance check:
- Verifies no phantom stocks (tickers not in worker reports)
- Spot-checks MA score fidelity (3-5 reported scores)
- Confirms table completeness
- Approves or rejects with specific feedback
- Maximum 3 review rounds
Final Output: Approved report is output. If --output is specified, saved to file.
Checkpoint & Resume
Research sessions are checkpointed to disk. Each session gets a unique ID. Intermediate outputs are saved as markdown files:
/tmp/aipriceaction-checkpoints/{session_id}/
├── worker_Technology.md
├── worker_Financials.md
├── worker_Energy.md
├── worker_Additional_Sector.md
├── aggregator_output.md
└── final_report.md
Use --resume ID to continue an interrupted or previously completed session.
Fast Research: Agent-Driven Pipeline
This is the recommended approach for research. Run aipa deep-research to get the market snapshot, then you (the AI agent) orchestrate the multi-agent pipeline using subagents. This produces equally thorough results and does not require an API key or aipa setup.
Step 1 — Fetch market snapshot
Run aipa deep-research (without --run) to fetch the latest market snapshot. Use --source to select the market (default: vn). This gives you the market context to distribute to workers.
# VN stocks (default)
aipa deep-research
# Crypto
aipa deep-research --source crypto
# Global stocks
aipa deep-research --source global
Step 2 — Multi-perspective performers scan (optional but recommended)
Run aipa performers with multiple --sort-by values to cross-reference market movers. This enriches your sector analysis.
aipa performers # top gainers / worst losers
aipa performers --sort-by value # where the money flows
aipa performers --sort-by ma50_score # trend strength
# For sector-specific:
aipa performers --group NGAN_HANG --sort-by value
# For crypto:
aipa performers --source crypto --sort-by value
Step 3 — Supervisor (you)
Using the market snapshot and performers results, decompose the research question into 3-5 sector-specific subtasks. Mandatory sectors depend on the source:
- VN: Banking, Securities, Real Estate
- Crypto: Layer 1, DeFi, AI tokens
- Global: Technology, Financials, Energy
- SJC: Gold / Precious Metals
Add 0-2 more sectors based on market activity. For each sector, pick ~10 tickers.
Step 3.5 — Fundamental Context (optional, VN only)
Version gate: aipa fundamentals requires aipa-cli >= 0.1.48. Verify with aipa --version before use.
For VN stock research, fundamentals add critical context. Only include if the user asked for fundamental analysis or if valuation/financial health is relevant to the research question. Do NOT automatically run fundamentals for purely technical research. When the user says "report" or "báo cáo", they may want fundamentals — if unclear, ask to confirm.
When relevant, add fundamental screening to the supervisor step. Follow this 3-step 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
# Historical year
aipa fundamentals rank --year 2023 --sort-by roe
# Specific quarter
aipa fundamentals rank --period "2016 Q4" --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
# Top stocks by ROE across all VN
aipa fundamentals rank --sort-by roe --limit 20
Step 2: Screen for quality (optional but recommended)
Use aipa fundamentals screen to filter by quality criteria. This eliminates weak candidates immediately:
# Only banks with acceptable asset quality AND profitability
aipa fundamentals screen --industry "ngân hàng" --npl-max 0.02 --car-min 0.10 --sort-by roe --limit 15
# Value screen: low PE + high ROE
aipa fundamentals screen --pe-max 15 --roe-min 0.15 --sort-by roe --limit 20
# Screen specific tickers by quality
aipa fundamentals screen VCB BID CTG TCB MBB --npl-max 0.015 --roe-min 0.15 --sort-by roe
Step 3: Individual deep dive (only for shortlisted tickers)
Only after Steps 1-2, use ratios --latest for 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. The ranking shows relative position immediately, and the screen eliminates unsuitable candidates before wasting tokens on deep dives.
Pass the fundamental ranking data to workers so they can cross-reference technical signals with fundamental strength/weakness.
Step 4 — Spawn worker subagents (in parallel)
For each sector subtask, spawn a separate subagent (use the Task tool) that:
- Receives the sector name, ticker list, the research question, and the market snapshot
- Fetches detailed OHLCV data for its assigned tickers (
aipa get-ohlcv-data with --limit 50)
- Runs
aipa volume-profile for the top 3 most important tickers in its sector (highest trading value, most interesting price action, or portfolio/watchlist tickers). Use a multi-day range covering at least 30 trading days ending on today
- For tickers showing breakout/reversal patterns or key S/R levels, also fetch intraday data (
--interval 1h --limit 50) to assess entry timing
- Analyzes trend direction, VPA signals, MA momentum, volume patterns, and support/resistance
- Cross-references volume profile levels (POC, Value Area High/Low) with OHLCV analysis
- Ranks tickers within the sector
- Returns a structured sector report with per-ticker assessment, ranking, and key risk factors
Spawn all worker subagents concurrently in a single message — do not run them sequentially.
Step 5 — Aggregate (you)
Once all workers return, synthesize the sector reports into a unified analysis:
- Cross-reference findings across sectors
- Build a multi-sector ranking table
- Identify cross-sector rotation patterns
- Highlight key opportunities and risks
Step 6 — Review (you)
Quality-check your own aggregated report:
- Verify no phantom stocks (tickers not in worker reports)
- Spot-check MA score plausibility
- Confirm table completeness
- Fix any issues and produce the final report
Present the final report to the user. Use the research question and the user's language to determine focus and output language.
When to Use Research vs Analyze
| Scenario |
Use |
| "Analyze VCB" |
aipa analyze VCB (single ticker) |
| "Compare FPT and VNM" |
aipa analyze FPT VNM (quick comparison) |
| "What's the trend for BTCUSDT?" |
aipa analyze BTCUSDT (focused question) |
| "Research the banking sector" |
aipa-research skill (multi-agent, sector-wide) |
| "Comprehensive market overview" |
aipa-research skill (full market scan) |
| "Deep dive into real estate" |
aipa-research skill (thorough investigation) |
| "Which sectors are leading?" |
aipa-research skill (cross-sector analysis) |
| "Most active tickers right now?" |
aipa live-data (no AI, instant top list) |
| "Top gainers / losers" |
aipa performers (no AI) |
| "Best stocks by trading value" |
aipa performers --sort-by value (no AI) |
| "Banking sector top movers" |
aipa performers --group NGAN_HANG --sort-by value (no AI) |
| "Volume profile / POC / value area" |
aipa volume-profile TICKER (no AI) |
| "What tickers are in the real estate sector?" |
aipa ticker-list --source vn --group BAT_DONG_SAN |
Key Differences
aipa analyze: Fast, focused on 1-5 tickers, single LLM call, results in seconds.
aipa deep-research --run: Covers entire sectors, multiple LLM calls across agents, results in minutes. Produces a comprehensive report with quality review.
- Fast Research (agent-driven): You replicate the pipeline with subagents. Thorough results without the CLI wait time.
Use deep-research when:
- The question spans multiple sectors
- The user wants a comprehensive report (not a quick take)
- Cross-sector comparison or rotation analysis is needed
- The user explicitly asks for "research", "deep dive", or "comprehensive analysis"
Use analyze when:
- The question is about specific tickers
- Speed matters more than depth
- The user wants a focused answer, not a full report
Interpreting Output
The CLI outputs to two streams:
- stdout: The final research report. This is what you should present to the user.
- stderr: Status messages with structured markers for tracking pipeline progress.
Status Markers (stderr)
| Marker |
Meaning |
[build] |
Context building status and timing |
[tool] |
Tool call being executed (e.g., fetching OHLCV data) |
[tool-result] |
Tool execution result returned |
[thinking] |
Agent reasoning tokens |
[error] |
Error message |
[done] |
Pipeline complete, includes total time |
[result] |
Final research report output follows |
When presenting results to the user, always use the stdout output (the final approved report).
Attribution
When presenting any research report 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.
Analysis Framework
When performing analysis (either via workers or as agent-driven pipeline), follow these priorities:
- Volume Price Action (VPA) Analysis: Always analyze the relationship between price and volume to identify smart money behavior, accumulation/distribution patterns, and confirm trend strength
- Price-Volume Confirmation: Look for volume confirmation on price movements — increasing volume on breakouts (bullish) vs decreasing volume on rallies (bearish divergence)
- Wyckoff Phases: Identify market phases (Accumulation, Markup, Distribution, Markdown) based on price-volume patterns. Key events: Spring, Upthrust, SOS (Sign of Strength), SOW (Sign of Weakness), Buying Climax, Test for Supply
- Support/Resistance with Volume: Key levels are more significant when accompanied by high volume — look for volume spikes at support/resistance
- Volume Trends & Spikes: Compare current volume to recent average volume (e.g. 20-day average), NOT just the previous day's volume. A large day-over-day percentage jump (like
volume_changed +92%) is a FALSE SIGNAL if the previous day had abnormally low liquidity. Always verify absolute volume against the average before claiming an "explosive", "distribution", or "climax" event.
- Extreme Price Changes: Detect moves exceeding ±6.7%/day (VN market limit) and search recent news/events to find causes
- Risk Management: Every analysis must include both positive (opportunities, strengths, bullish signals) and negative (risks, weaknesses, bearish signals) insights. Quantify downside risk with specific price levels, identify what would invalidate the current thesis, and never present a one-sided view
- Nhóm Chủ Lực (Core Market Sectors - VN Market Only): When analyzing the Vietnamese market, always contextualize tickers within their respective "Nhóm Chủ Lực" (Core Sectors) to assess systemic flow. The key groups are:
- 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 — fetch OHLCV data before producing any analysis. The market snapshot alone is insufficient — every analysis MUST include at least one
get-ohlcv-data tool call
- 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
T+2 Settlement Rule (VN stocks only)
This rule applies ONLY to Vietnamese stocks (--source vn). Crypto and global stocks are not subject to T+2 settlement.
IMPORTANT: For all stock purchases in the Vietnamese stock market, shares are only settled and available for trading (selling) on the afternoon of T+2 (specifically at 13:00 / 1:00 PM on day T+2, not T+3).
- NEVER propose or attempt to execute any Stop Loss or Take Profit actions on T+1 (the first business day after the purchase), as the shares have not yet settled.
- Always check the purchase date of any stock positions when recommending sell actions.
Portfolio File
The agent looks for a portfolio file in the working directory to track positions. Accepted file names (checked in order):
DANH_MUC.md
PORTFOLIO.md
ACCOUNT.md
If none exists, the agent should ask the user whether they want to create one.
Watchlist File
The agent also looks for a watchlist file to track tickers being monitored (no positions yet). Accepted file names (checked in order):
THEO_DOI.md
WATCHLIST.md
This tracks potential entry candidates. Include: ticker, sector, watch reason, entry zone, key level, and added date.
Risk Management Rules (MANDATORY)
- Always check settlement status before recommending sell actions (VN stocks only) — cross-reference buy date with today. For VN stocks, shares are NOT sellable until afternoon of T+2. Does NOT apply to crypto or global stocks
- Every analysis must quantify risk — include specific Stop Loss and Take Profit levels with reasoning, state what invalidates the thesis, calculate risk-reward ratio
- Never present one-sided analysis — every ticker must have both bullish signals and bearish risks
- Position sizing awareness — flag concentration risk when >30% of portfolio is in one sector
- Daily portfolio review — mark settled positions, check SL/TP hits, flag thesis changes
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).
No Premature TP (Chốt Non) — CRITICAL
Symptom: Position is up 1-3% and agent recommends partial or full close because "TP1 was hit" — ignoring the Wyckoff thesis (Phase E Markup / SOS / LPS unconfirmed).
Rules:
Never recommend TP (partial or full) when P&L < 1× ATR(14) from entry. If ATR is unavailable: do not TP when profit < 3% for Markup Phase D/E, < 5% for Accumulation breakout.
Always check Wyckoff phase before mentioning "take profit":
- Phase E Markup / SOS breakout: DO NOT TP — the trend is just starting. This is a trend trade, not a scalp.
- Re-accumulation / Spring test: DO NOT TP — position just formed.
- Only consider TP when distribution signs appear (volume climax, weekly bearish engulfing, Upthrust after extended markup).
Check momentum before suggesting TP:
- Is price at a swing high with volume > 20-day average?
- Are there distribution candles (shooting star, bearish engulfing, volume spike)?
- Is there weekly resistance above?
- If all 3 are NO → TP is forbidden. Let it run.
Premature TP checklist (run before every sell/reduce recommendation):
| Question |
Pass/Fail |
| P&L > 3%? |
|
| Is Wyckoff phase Distribution / Upthrust? |
|
| Are there distribution signs (volume climax, bearish weekly)? |
|
| Does the weekly chart show strong resistance above? |
|
If all 4 are NO → TP is BLOCKED. Document the reason in the report.
Controlled exception: Premature TP is only allowed when the user explicitly requests it or needs urgent liquidity. The agent must NEVER autonomously propose premature TP in any form (including "protect profits", "reduce risk", etc.).
Add-Size Rules — Propose Add Instead of Premature TP
Symptom: Position is up 2-3% and agent recommends partial TP. Instead, the agent should be looking for add-size opportunities — a position proving itself is a candidate for more, not for reducing.
Shift in mindset: When a position is working (up 2-5% with Volume Price Action confirmation), the correct response is:
- Don't: "Chốt lời 50% tại đây"
- Do: "Here's where you can add on pullback / breakout confirmation"
Rules:
When a position is in profit and thesis is intact, always check for add-size setups before considering any TP. The add-size plan must be defined at entry (not invented after the position moves).
Two valid add scenarios (must pick one at entry):
- Pullback add (Zone B): Price pulls back to a lower value zone with declining volume (No Supply). Example: GAS bought at 84,800 → add at 82,500-83,500 on low volume test.
- Breakout add: Price breaks a clear structural level (range ceiling, swing high) with volume > 1.5× 20-day average. Example: ACB > 25,500 with vol > 40M.
Never add at market price without a structural reason. "Momentum is strong" is not a reason — waiting for a pullback to a predefined zone is.
Add-size check before every suggestion:
| Question |
Pass/Fail |
| Is the original Wyckoff thesis still intact? |
|
| Is price at a predefined add zone (not no-man's land)? |
|
| Does volume confirm? (pullback = low/declining, breakout = high/surge) |
|
| Is the position NOT testing its SL? |
|
| Would this add lot have R:R ≥ 1:1 as an independent trade? |
|
If all pass → propose the add. If any fail → hold only, no add.
Max 2 adds per position. After reaching max size, just hold and let the trend run. No further pyramiding.
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 = su
…(truncated)
1---2name: aipa-research3description: Multi-agent deep research for comprehensive market analysis using the aipa CLI. Use this skill when the user asks for deep research, thorough market analysis, sector-wide investigation, comprehensive stock comparison, or detailed financial report. This runs a supervisor → parallel workers → aggregator → reviewer pipeline that takes longer but produces more thorough results than a simple analyze. Trigger for requests like "research banking sector", "deep dive into real estate stocks", or "comprehensive market overview". Can also incorporate fundamental analysis (PE, ROE, NPL, CAR, financial ratios) via `aipa fundamentals` when the user asks for fundamental context alongside technical research.4---56# aipa-research78Developed 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 `deep-research` command runs a multi-agent pipeline that produces comprehensive market reports far more thorough than single-ticker analysis.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 deep-research6162uvx aipa-cli deep-research6364# Fallback: pip (if uv is not available)65pip install aipa-cli66aipa deep-research6768# Fallback: system pip (if pip fails due to PEP 668)69python3 -m pip install aipa-cli --break-system-packages70aipa deep-research7172# 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 deep-research`852. **Fallback on failure** — if a command fails with a schema or missing argument error, retry with `@latest`:86 `uvx aipa-cli deep-research` (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 Variables9798| Variable | Required | Default | Purpose |99|---|---|---|---|100| `OPENAI_API_KEY` | Only with `--run` | — | API key for the LLM provider |101| `OPENAI_BASE_URL` | No | OpenRouter | Base URL for OpenAI-compatible API |102| `OPENAI_MODEL` | No | `openrouter/owl-alpha` | Model to use for analysis |103104Run `aipa setup` for interactive first-run configuration. Settings are saved to `~/.aipriceaction/settings.json`.105106### aipa-config — Settings Management107108```bash109aipa config get # show all settings (JSON, api_key redacted)110aipa config get use_sma # show single value: true or false111aipa config get language # show language: en or vn112aipa config set use_sma false # switch all commands to EMA113aipa config set use_sma true # switch to SMA114aipa config set language vn # change language115aipa config path # show path to settings file116```117118| Setting | Default | Values | Description |119|---|---|---|---|120| `use_sma` | `true` | `true` / `false` | `true` = SMA, `false` = EMA. Controls MA type for all commands. CLI flags (`--sma`, `--ema`) override per-invocation. |121| `language` | `vn` | `en` / `vn` | Output language for analyze and deep-research |122123**MA Type Priority:** CLI flag (`--sma`/`--ema`) > `settings.json` (`use_sma`) > default (`sma`).124125> **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).126127---128129## Pre-Execution: Ask the User130131**STOP. Do NOT run any commands yet. You MUST call `AskUserQuestion` (or `question` / QuestionTool in compatible agents) first to ask the user which mode they want.**132133If you run any `aipa` command before asking the user, you have failed. Always ask first.134135Ask the user this question using the `AskUserQuestion` tool (or equivalent `question` tool):1361371. **Fast Research (Recommended)** — Run `aipa deep-research` to get the market snapshot, then you (the AI agent) replicate the multi-agent pipeline using subagents + `aipa get-ohlcv-data`. No API key needed. This is the recommended default — it produces thorough results without the 5-10 minute wait.1382. **Full pipeline (`--run`)** — Run `aipa deep-research --run` to use the actual CLI multi-agent pipeline. Takes 5-10 minutes and requires an API key configured via `aipa setup`.139140Only skip asking if the user's request explicitly indicates they want the full CLI pipeline (e.g., "run the full pipeline", "use --run").141142- If the user chooses **Fast Research**: follow the [Fast Research: Agent-Driven Pipeline](#fast-research-agent-driven-pipeline) section below.143- If the user chooses **Full pipeline**: run `aipa deep-research --run [QUESTION]` and present the stdout output.144145---146147## Available Data Sources148149- **Vietnamese stocks** (`source: vn`): VIC, VCB, FPT, HPG, VNM, MBB, TCB, CTG, VPB, HDB, etc.150- **Cryptocurrencies** (`source: crypto`): BTCUSDT, ETHUSDT, BNBUSDT, SOLUSDT, etc.151- **Global/Yahoo** (`source: global/yahoo`): AAPL, TSLA, NVDA, SPY, etc.152- **SJC Gold** (`source: sjc`): SJC gold prices153154### Predefined Watchlists155156The 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".157158| Name | Tickers | Count |159|---|---|---|160| **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 |161| **VINGROUP** | VIC, VHM, VRE, VPL | 4 |162| **TM** | GEX, GEE, VIX, EIB, VGC, IDC | 6 |163| **MASAN** | MSN, MCH, MSR, MML, VCF, VSN, NET | 7 |164| **INDEX** | VNINDEX, VN30, VN30F1M, VN100, VNMIDCAP, VNSMALLCAP, VNALLSHARE, VNXALLSHARE, VNFIN, HNX30, VNREAL, VNENE, VNMITECH, VNUTI, VNCONS, VNCOND, VNHEAL, VNIND, VNFINLEAD, VNFINSELECT, VNDIAMOND, VNDIVIDEND | 22 |165| **CROSS** | VNINDEX, ^GSPC, GC=F, SJC-GOLD, KC=F, BZ=F, BTCUSDT | 7 |166167Note: VN30 was updated on 2026-05-13 — DGC removed (placed under controlled status), BSR added as replacement.168169```bash170# List all watchlists (predefined + custom)171aipa watchlist ls172173# Get tickers for a specific watchlist174aipa watchlist get VN30175aipa watchlist get VINGROUP176177# Create a custom watchlist178aipa watchlist set MYWATCHLIST FPT VCB HPG VIC179180# Delete a custom watchlist181aipa watchlist rm MYWATCHLIST182183# Using watchlist tickers in deep-research worker assignments184aipa watchlist get VN30 # use these tickers for the VN30 sector worker185```186187### Supported Intervals188189| Interval | Description |190|---|---|191| `1m` | 1 minute |192| `5m` | 5 minutes |193| `15m` | 15 minutes |194| `30m` | 30 minutes |195| `1h` | 1 hour |196| `4h` | 4 hours |197| `1D` | 1 day (default) |198| `1W` | 1 week |199| `2W` | 2 weeks |200201---202203## `aipa deep-research` — Multi-Agent Research Pipeline204205The default behavior (`aipa deep-research` without flags) fetches and prints a market snapshot. Add `--run` to execute the full multi-agent pipeline. Use `--source` to target different markets — the supervisor, workers, prompts, and default question all adapt to the selected source.206207```bash208aipa deep-research [QUESTION] [options]209```210211### Flags212213| Flag | Default | Description |214|---|---|---|215| `QUESTION` | market overview | Research question (optional) |216| `--run` | off | Run the full multi-agent pipeline (5-10 min). Without this, only dumps market snapshot. |217| `--source` | `vn` | Data source: `vn`, `crypto`, `global`, `sjc` |218| `--resume ID` | — | Resume from a checkpoint session ID |219| `--output FILE` | — | Save final report to file |220| `--lang` | saved setting | Language: `en` or `vn` |221222**MA Type:** All MA indicators follow the `use_sma` setting (`~/.aipriceaction/settings.json`). Run `aipa config get use_sma` to check the active type before analysis. Use `aipa config set use_sma false` for EMA, or pass `--sma`/`--ema` flags on individual `aipa analyze` calls.223224### Usage Examples225226```bash227# Market snapshot only (default, fast, no API key needed)228aipa deep-research229230# Crypto market snapshot231aipa deep-research --source crypto232233# Market snapshot with a custom question in the output234aipa deep-research "Research banking sector"235236# Run the FULL multi-agent pipeline (slow, 5-10 min, requires API key)237aipa deep-research --run238239# Full pipeline for global stocks240aipa deep-research --source global --run241242# Full pipeline for crypto243aipa deep-research --source crypto --run244245# Full pipeline with a custom research question246aipa deep-research --run "Deep research on the banking sector: analyze top 10 banks by market cap, assess trend direction, VPA signals, MA momentum, and identify leaders vs laggards"247248# Save full pipeline report to file249aipa deep-research --run --output banking_report.md250251# Vietnamese output (full pipeline)252aipa deep-research --run "Phân tích toàn diện thị trường chứng khoán Việt Nam" --lang vn253254# Resume an interrupted research session255aipa deep-research --run --resume abc123256```257258---259260## How the Pipeline Works261262The deep-research pipeline uses a multi-agent architecture with quality control:263264```265Supervisor266 │ Decomposes question into 3-5 sector subtasks267 │ Selects top 10 tickers per sector268 ▼269Parallel Workers (fan-out)270 │ Each worker analyzes one sector271 │ Fetches OHLCV data for each ticker272 │ Produces sector-specific report273 ▼274Aggregator275 │ Synthesizes all sector reports276 │ Cross-references findings277 │ Builds unified ranking table278 ▼279Reviewer280 │ Checks data integrity281 │ Verifies MA scores and ticker coverage282 │ Approves or rejects with feedback283 ▼284Final Report285```286287### Pipeline Stages2882891. **Market Snapshot**: Fetches latest OHLCV data for all tickers from the selected source (`--source`, default `vn`) to identify active sectors and tickers.2902912. **Supervisor**: Analyzes the research question and market snapshot. Decomposes into 3-5 sector-specific subtasks. Mandatory sectors depend on the source:292 - **VN**: Banking, Securities, Real Estate293 - **Crypto**: Layer 1 (BTC, ETH, SOL), DeFi, AI tokens294 - **Global/Yahoo**: Technology, Financials, Energy295 - **SJC**: Gold / Precious Metals296297 Adds 0-2 additional sectors based on market activity.2982993. **Parallel Workers**: Each worker handles one sector:300 - Fetches OHLCV data for each assigned ticker (limit=50 bars)301 - Runs volume profile for the top 3 most important tickers (30+ trading day range)302 - Fetches intraday data (1h) for tickers showing breakout/reversal patterns303 - Analyzes trend direction, VPA signals, MA score momentum, volume, and S/R304 - Cross-references volume profile levels with price action305 - Provides per-ticker assessment, sector ranking, and key risk factors306 - Workers run concurrently for efficiency3073084. **Aggregator**: Collects all worker reports and synthesizes a unified analysis:309 - Cross-references findings across sectors310 - Builds multi-sector ranking table311 - Identifies cross-sector rotation patterns312 - Highlights key opportunities and risks3133145. **Reviewer**: Quality assurance check:315 - Verifies no phantom stocks (tickers not in worker reports)316 - Spot-checks MA score fidelity (3-5 reported scores)317 - Confirms table completeness318 - Approves or rejects with specific feedback319 - Maximum 3 review rounds3203216. **Final Output**: Approved report is output. If `--output` is specified, saved to file.322323### Checkpoint & Resume324325Research sessions are checkpointed to disk. Each session gets a unique ID. Intermediate outputs are saved as markdown files:326327```328/tmp/aipriceaction-checkpoints/{session_id}/329├── worker_Technology.md330├── worker_Financials.md331├── worker_Energy.md332├── worker_Additional_Sector.md333├── aggregator_output.md334└── final_report.md335```336337Use `--resume ID` to continue an interrupted or previously completed session.338339---340341## Fast Research: Agent-Driven Pipeline342343This is the **recommended** approach for research. Run `aipa deep-research` to get the market snapshot, then you (the AI agent) orchestrate the multi-agent pipeline using subagents. This produces equally thorough results and does not require an API key or `aipa setup`.344345### Step 1 — Fetch market snapshot346Run `aipa deep-research` (without `--run`) to fetch the latest market snapshot. Use `--source` to select the market (default: `vn`). This gives you the market context to distribute to workers.347348```bash349# VN stocks (default)350aipa deep-research351352# Crypto353aipa deep-research --source crypto354355# Global stocks356aipa deep-research --source global357```358359### Step 2 — Multi-perspective performers scan (optional but recommended)360Run `aipa performers` with multiple `--sort-by` values to cross-reference market movers. This enriches your sector analysis.361362```bash363aipa performers # top gainers / worst losers364aipa performers --sort-by value # where the money flows365aipa performers --sort-by ma50_score # trend strength366# For sector-specific:367aipa performers --group NGAN_HANG --sort-by value368# For crypto:369aipa performers --source crypto --sort-by value370```371372### Step 3 — Supervisor (you)373Using the market snapshot and performers results, decompose the research question into 3-5 sector-specific subtasks. Mandatory sectors depend on the source:374- **VN**: Banking, Securities, Real Estate375- **Crypto**: Layer 1, DeFi, AI tokens376- **Global**: Technology, Financials, Energy377- **SJC**: Gold / Precious Metals378379Add 0-2 more sectors based on market activity. For each sector, pick ~10 tickers.380381### Step 3.5 — Fundamental Context (optional, VN only)382383> **Version gate:** `aipa fundamentals` requires **aipa-cli >= 0.1.48**. Verify with `aipa --version` before use.384385For VN stock research, fundamentals add critical context. **Only include if the user asked for fundamental analysis or if valuation/financial health is relevant to the research question.** Do NOT automatically run fundamentals for purely technical research. When the user says "report" or "báo cáo", they may want fundamentals — if unclear, ask to confirm.386387When relevant, add fundamental screening to the supervisor step. **Follow this 3-step 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.388389**Step 1: Side-by-side ranking (mandatory)**390391Use `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:392393```bash394# Profitability comparison395aipa fundamentals rank VCB BID CTG TCB MBB --sort-by roe396397# Historical year398aipa fundamentals rank --year 2023 --sort-by roe399400# Specific quarter401aipa fundamentals rank --period "2016 Q4" --sort-by roe402403# Valuation comparison404aipa fundamentals rank VCB BID CTG TCB MBB --sort-by pe --direction asc405406# Bank health: asset quality + capital adequacy407aipa fundamentals rank VCB BID CTG TCB MBB --sort-by npl --direction asc408aipa fundamentals rank VCB BID CTG TCB MBB --sort-by car --direction desc409410# Top stocks by ROE across all VN411aipa fundamentals rank --sort-by roe --limit 20412```413414**Step 2: Screen for quality (optional but recommended)**415416Use `aipa fundamentals screen` to filter by quality criteria. This eliminates weak candidates immediately:417418```bash419# Only banks with acceptable asset quality AND profitability420aipa fundamentals screen --industry "ngân hàng" --npl-max 0.02 --car-min 0.10 --sort-by roe --limit 15421422# Value screen: low PE + high ROE423aipa fundamentals screen --pe-max 15 --roe-min 0.15 --sort-by roe --limit 20424425# Screen specific tickers by quality426aipa fundamentals screen VCB BID CTG TCB MBB --npl-max 0.015 --roe-min 0.15 --sort-by roe427```428429**Step 3: Individual deep dive (only for shortlisted tickers)**430431Only after Steps 1-2, use `ratios --latest` for tickers that ranked at the top or need further investigation. Use `info` for company context:432433```bash434aipa fundamentals ratios VCB --latest # full ratios for top candidate435aipa fundamentals ratios VCB --category bank --latest # bank-specific deep dive436aipa fundamentals info VCB # company profile context437```438439**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. The ranking shows relative position immediately, and the screen eliminates unsuitable candidates before wasting tokens on deep dives.440441Pass the fundamental ranking data to workers so they can cross-reference technical signals with fundamental strength/weakness.442443### Step 4 — Spawn worker subagents (in parallel)444For each sector subtask, spawn a separate subagent (use the Task tool) that:445- Receives the sector name, ticker list, the research question, and the market snapshot446- Fetches detailed OHLCV data for its assigned tickers (`aipa get-ohlcv-data` with `--limit 50`)447- Runs `aipa volume-profile` for the **top 3 most important tickers** in its sector (highest trading value, most interesting price action, or portfolio/watchlist tickers). Use a multi-day range covering at least 30 trading days ending on today448- For tickers showing breakout/reversal patterns or key S/R levels, also fetch **intraday data** (`--interval 1h --limit 50`) to assess entry timing449- Analyzes trend direction, VPA signals, MA momentum, volume patterns, and support/resistance450- Cross-references volume profile levels (POC, Value Area High/Low) with OHLCV analysis451- Ranks tickers within the sector452- Returns a structured sector report with per-ticker assessment, ranking, and key risk factors453454**Spawn all worker subagents concurrently in a single message** — do not run them sequentially.455456### Step 5 — Aggregate (you)457Once all workers return, synthesize the sector reports into a unified analysis:458- Cross-reference findings across sectors459- Build a multi-sector ranking table460- Identify cross-sector rotation patterns461- Highlight key opportunities and risks462463### Step 6 — Review (you)464Quality-check your own aggregated report:465- Verify no phantom stocks (tickers not in worker reports)466- Spot-check MA score plausibility467- Confirm table completeness468- Fix any issues and produce the final report469470Present the final report to the user. Use the research question and the user's language to determine focus and output language.471472---473474## When to Use Research vs Analyze475476| Scenario | Use |477|---|---|478| "Analyze VCB" | `aipa analyze VCB` (single ticker) |479| "Compare FPT and VNM" | `aipa analyze FPT VNM` (quick comparison) |480| "What's the trend for BTCUSDT?" | `aipa analyze BTCUSDT` (focused question) |481| "Research the banking sector" | `aipa-research` skill (multi-agent, sector-wide) |482| "Comprehensive market overview" | `aipa-research` skill (full market scan) |483| "Deep dive into real estate" | `aipa-research` skill (thorough investigation) |484| "Which sectors are leading?" | `aipa-research` skill (cross-sector analysis) |485| "Most active tickers right now?" | `aipa live-data` (no AI, instant top list) |486| "Top gainers / losers" | `aipa performers` (no AI) |487| "Best stocks by trading value" | `aipa performers --sort-by value` (no AI) |488| "Banking sector top movers" | `aipa performers --group NGAN_HANG --sort-by value` (no AI) |489| "Volume profile / POC / value area" | `aipa volume-profile TICKER` (no AI) |490| "What tickers are in the real estate sector?" | `aipa ticker-list --source vn --group BAT_DONG_SAN` |491492### Key Differences493494- **`aipa analyze`**: Fast, focused on 1-5 tickers, single LLM call, results in seconds.495- **`aipa deep-research --run`**: Covers entire sectors, multiple LLM calls across agents, results in minutes. Produces a comprehensive report with quality review.496- **Fast Research (agent-driven)**: You replicate the pipeline with subagents. Thorough results without the CLI wait time.497498Use `deep-research` when:499- The question spans multiple sectors500- The user wants a comprehensive report (not a quick take)501- Cross-sector comparison or rotation analysis is needed502- The user explicitly asks for "research", "deep dive", or "comprehensive analysis"503504Use `analyze` when:505- The question is about specific tickers506- Speed matters more than depth507- The user wants a focused answer, not a full report508509---510511## Interpreting Output512513The CLI outputs to two streams:514515- **stdout**: The final research report. This is what you should present to the user.516- **stderr**: Status messages with structured markers for tracking pipeline progress.517518### Status Markers (stderr)519520| Marker | Meaning |521|---|---|522| `[build]` | Context building status and timing |523| `[tool]` | Tool call being executed (e.g., fetching OHLCV data) |524| `[tool-result]` | Tool execution result returned |525| `[thinking]` | Agent reasoning tokens |526| `[error]` | Error message |527| `[done]` | Pipeline complete, includes total time |528| `[result]` | Final research report output follows |529530When presenting results to the user, always use the stdout output (the final approved report).531532### Attribution533534When presenting any research report to the user, always include an attribution line at the end of your response:535- **English**: "_Data by [AIPriceAction](https://aipriceaction.com/) | AI-powered analysis — may contain errors. Verify before trading._"536- **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._"537538Do 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.539540---541542## Analysis Framework543544When performing analysis (either via workers or as agent-driven pipeline), follow these priorities:5455461. **Volume Price Action (VPA) Analysis**: Always analyze the relationship between price and volume to identify smart money behavior, accumulation/distribution patterns, and confirm trend strength5472. **Price-Volume Confirmation**: Look for volume confirmation on price movements — increasing volume on breakouts (bullish) vs decreasing volume on rallies (bearish divergence)5483. **Wyckoff Phases**: Identify market phases (Accumulation, Markup, Distribution, Markdown) based on price-volume patterns. Key events: Spring, Upthrust, SOS (Sign of Strength), SOW (Sign of Weakness), Buying Climax, Test for Supply5494. **Support/Resistance with Volume**: Key levels are more significant when accompanied by high volume — look for volume spikes at support/resistance5505. **Volume Trends & Spikes**: Compare current volume to recent average volume (e.g. 20-day average), NOT just the previous day's volume. A large day-over-day percentage jump (like `volume_changed` +92%) is a FALSE SIGNAL if the previous day had abnormally low liquidity. Always verify absolute volume against the average before claiming an "explosive", "distribution", or "climax" event.5516. **Extreme Price Changes**: Detect moves exceeding ±6.7%/day (VN market limit) and search recent news/events to find causes5527. **Risk Management**: Every analysis must include both positive (opportunities, strengths, bullish signals) and negative (risks, weaknesses, bearish signals) insights. Quantify downside risk with specific price levels, identify what would invalidate the current thesis, and never present a one-sided view5538. **Nhóm Chủ Lực (Core Market Sectors - VN Market Only)**: When analyzing the Vietnamese market, always contextualize tickers within their respective "Nhóm Chủ Lực" (Core Sectors) to assess systemic flow. The key groups are:554 * **Nhóm Ngân hàng (Banking):** VCB, BID, CTG, TCB, MBB, ACB, VPB, HDB, SHB, TPB, VIB, SSB, MSB, STB, LPB, EIB.555 * **Nhóm Bất động sản (Real Estate):** VIC, VHM, VRE, VPL, DIG, CEO, L14, TCH, HHS, VGC, IDC.556 * **Nhóm Chứng khoán (Securities):** SSI, VND, HCM, VCI, SHS, VIX, VDS.557 * **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.558 * **Nhóm Hệ sinh thái (Corporate Ecosystems):**559 * Họ Vingroup: VIC, VHM, VRE, VPL.560 * Họ Bầu Thụy: STB, LPB, THD, HAG.561 * Họ Gelex ("Tuấn Mượt"): GEX, GEE, VIX, VGC, EIB, IDC.562 * Họ Hoàng Huy: TCH, HHS.563 * Họ A7: DIG, CEO, L14.564 * Họ TTC (Thành Thành Công): SBT, GEG, VDS.565 * Họ Masan: MSN, MCH, MSR, MML, VCF, VSN, NET.566 * Họ Viettel: VGI, CTR, VTP.567 *(Note: This classification applies only to the Vietnamese market. Crypto and Global markets do not use this specific grouping yet).*568569## Data Usage Policy (CRITICAL)5705711. **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 context5722. **NEVER mention a specific number unless it appears in your tool results or user-provided context**5733. **Use tools proactively** — fetch OHLCV data before producing any analysis. The market snapshot alone is insufficient — every analysis MUST include at least one `get-ohlcv-data` tool call5744. **When researching news or events, ALWAYS include the source name** (e.g., "Source: CafeF", "Source: VNExpress")5755. **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 progress576577## T+2 Settlement Rule (VN stocks only)578579> **This rule applies ONLY to Vietnamese stocks (`--source vn`).** Crypto and global stocks are not subject to T+2 settlement.580581> **IMPORTANT:** For all stock purchases in the Vietnamese stock market, shares are only settled and available for trading (selling) on the **afternoon of T+2** (specifically at 13:00 / 1:00 PM on day T+2, not T+3).582> - **NEVER** propose or attempt to execute any Stop Loss or Take Profit actions on **T+1** (the first business day after the purchase), as the shares have not yet settled.583> - Always check the purchase date of any stock positions when recommending sell actions.584585## Portfolio File586587The agent looks for a portfolio file in the working directory to track positions. Accepted file names (checked in order):5885891. `DANH_MUC.md`5902. `PORTFOLIO.md`5913. `ACCOUNT.md`592593If none exists, the agent should ask the user whether they want to create one.594595## Watchlist File596597The agent also looks for a watchlist file to track tickers being monitored (no positions yet). Accepted file names (checked in order):5985991. `THEO_DOI.md`6002. `WATCHLIST.md`601602This tracks potential entry candidates. Include: ticker, sector, watch reason, entry zone, key level, and added date.603604## Risk Management Rules (MANDATORY)6056061. **Always check settlement status before recommending sell actions (VN stocks only)** — cross-reference buy date with today. For VN stocks, shares are NOT sellable until afternoon of T+2. Does NOT apply to crypto or global stocks6072. **Every analysis must quantify risk** — include specific Stop Loss and Take Profit levels with reasoning, state what invalidates the thesis, calculate risk-reward ratio6083. **Never present one-sided analysis** — every ticker must have both bullish signals and bearish risks6094. **Position sizing awareness** — flag concentration risk when >30% of portfolio is in one sector6105. **Daily portfolio review** — mark settled positions, check SL/TP hits, flag thesis changes611612## Strict Data Reading & Validation (CRITICAL)613614**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").615616**Rules:**617618- **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.619- **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.620 - *Surgical view (Header + Today + Breakout Day):*621 `uvx aipa-cli get-ohlcv-data TCB MSB STB | grep -E "time|2026-05-27|2026-05-07"`622 - *Comparing recent days:*623 `uvx aipa-cli get-ohlcv-data VND | grep -E "time|2026-05-27|2026-05-26"`624- **Explicit Value Comparison:** Before concluding whether a trend is broken or intact, explicitly state the values being compared: `[Close Price]` vs `[MA/EMA Value]`.625 - *Example:* "Close is 17.750, EMA20 is 16.881. 17.750 > 16.881 → Price is ABOVE EMA20 (Trend intact)."626- **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.627 - The correct invalidation is a fall back **below the structural breakout level**, not below the candle's Low.628 - If price pulls back but stays above the structural level, the breakout is intact — this is a healthy pullback.629 - If price falls **below the structural breakout level**, it is a **Failed Breakout / Structural Violation**.630 - *Action:* Always identify the pre-breakout structure first. Only then assess whether a pullback is healthy (above structure) or a failure (below structure).631632---633634## No Premature TP (Chốt Non) — CRITICAL635636**Symptom:** Position is up 1-3% and agent recommends partial or full close because "TP1 was hit" — ignoring the Wyckoff thesis (Phase E Markup / SOS / LPS unconfirmed).637638**Rules:**6396401. **Never recommend TP (partial or full) when P&L < 1× ATR(14) from entry.** If ATR is unavailable: do not TP when profit < 3% for Markup Phase D/E, < 5% for Accumulation breakout.6416422. **Always check Wyckoff phase before mentioning "take profit":**643 - **Phase E Markup / SOS breakout:** DO NOT TP — the trend is just starting. This is a trend trade, not a scalp.644 - **Re-accumulation / Spring test:** DO NOT TP — position just formed.645 - **Only consider TP when distribution signs appear** (volume climax, weekly bearish engulfing, Upthrust after extended markup).6466473. **Check momentum before suggesting TP:**648 - Is price at a **swing high with volume > 20-day average**?649 - Are there **distribution candles** (shooting star, bearish engulfing, volume spike)?650 - Is there **weekly resistance** above?651 - If all 3 are NO → **TP is forbidden.** Let it run.6526534. **Premature TP checklist** (run before every sell/reduce recommendation):654655 | Question | Pass/Fail |656 |---|---|657 | P&L > 3%? | |658 | Is Wyckoff phase Distribution / Upthrust? | |659 | Are there distribution signs (volume climax, bearish weekly)? | |660 | Does the weekly chart show strong resistance above? | |661662 If **all 4 are NO** → **TP is BLOCKED.** Document the reason in the report.6636645. **Controlled exception:** Premature TP is only allowed when the user **explicitly requests it** or needs urgent liquidity. The agent must NEVER autonomously propose premature TP in any form (including "protect profits", "reduce risk", etc.).665666---667668## Add-Size Rules — Propose Add Instead of Premature TP669670**Symptom:** Position is up 2-3% and agent recommends partial TP. Instead, the agent should be looking for **add-size opportunities** — a position proving itself is a candidate for more, not for reducing.671672**Shift in mindset:** When a position is working (up 2-5% with Volume Price Action confirmation), the correct response is:673- **Don't:** "Chốt lời 50% tại đây"674- **Do:** "Here's where you can add on pullback / breakout confirmation"675676**Rules:**6776781. **When a position is in profit and thesis is intact, always check for add-size setups before considering any TP.** The add-size plan must be defined at entry (not invented after the position moves).6796802. **Two valid add scenarios (must pick one at entry):**681 - **Pullback add (Zone B):** Price pulls back to a lower value zone with declining volume (No Supply). Example: GAS bought at 84,800 → add at 82,500-83,500 on low volume test.682 - **Breakout add:** Price breaks a clear structural level (range ceiling, swing high) with volume > 1.5× 20-day average. Example: ACB > 25,500 with vol > 40M.6836843. **Never add at market price without a structural reason.** "Momentum is strong" is not a reason — waiting for a pullback to a predefined zone is.6856864. **Add-size check before every suggestion:**687688 | Question | Pass/Fail |689 |---|---|690 | Is the original Wyckoff thesis still intact? | |691 | Is price at a predefined add zone (not no-man's land)? | |692 | Does volume confirm? (pullback = low/declining, breakout = high/surge) | |693 | Is the position NOT testing its SL? | |694 | Would this add lot have R:R ≥ 1:1 as an independent trade? | |695696 If all pass → propose the add. If any fail → hold only, no add.6976985. **Max 2 adds per position.** After reaching max size, just hold and let the trend run. No further pyramiding.699700---701702## Precheck Mandatory — Safety Gate Before Every Entry Decision703704**Symptom:** Analyzing entry on low timeframe (15m/1h) without checking higher timeframe structure — missing historical supply zones (Buying Climax, UTAD) that invalidate the thesis.705706**Rule:** Before proposing ANY entry, trade decision, or price target, you MUST run:707708```bash709# 1. Daily 60 — detect BC/UTAD/historical structure710aipa get-ohlcv-data TICKER --limit 60 --no-ma711712# 2. Weekly 52 — confirm overall trend direction713aipa get-ohlcv-data TICKER --interval 1W --limit 52 --no-ma714715# 3. Volume Profile 30+ days — identify key price levels716aipa volume-profile TICKER --start-date [30+ days ago] --end-date [today]717```718719This is a **safety gate**, not analysis. The purpose is to detect structural red flags before spending tokens on deeper analysis:720721| Detection | Meaning | Action |722|---|---|---|723| **Buying Climax (BC)** at current price zone | Historical volume peak = large supply | DO NOT enter here. Lower entry zone or cancel. |724| **Upthrust After Distribution (UTAD)** | False breakout, bull trap | Cancel entry. Wait for return to range. |725| **Weekly trend bearish** (price below MA20/50 weekly) | Overall trend is down | DO NOT go long. Wait for weekly reversal. |726| **SOS confirmed + weekly up** | Genuine breakout | ✅ Proceed with entry analysis. |727| **Spring at POC + weekly support** | Successful bottom test | ✅ Entry is valid. |728729**Preflight checklist before every entry:**730731```732□ Daily 60 — no BC/UTAD at current price zone733□ Weekly 52 — trend aligned with entry direction734□ VP 30d — TP anchored to swing high/VAH (not round number)735□ SL below POC/VAH/MA20736□ R:R ≥ 1:2 after precheck737```738739> **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.740741---742743## Calculate Metrics with Python — No Hallucinated Numbers744745**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.746747**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.748749### Volume vs 20-day Average (the most common mistake)750751```bash752uvx aipa-cli get-ohlcv-data TICKER --limit 50 --no-ma --no-system-prompt 2>/dev/null | python3 -c "753import sys754from collections import defaultdict755data = defaultdict(list)756for line in sys.stdin:757 parts = line.split()758 if len(parts) >= 7 and parts[0] != 'time':759 data[parts[-1]].append((parts[0], int(float(parts[5]))))760for sym, rows in data.items():761 if len(rows) >= 21:762 avg20 = sum(r[1] for r in rows[-21:-1]) / 20763 last_vol = rows[-1][1]764 print(f'{sym} {rows[-1][0]}: vol={last_vol/1e6:.1f}M | avg20d={avg20/1e6:.1f}M | ratio={last_vol/avg20:.1f}x')765"766```767768**Anti-pattern:** NEVER do this:769- `volume_changed` is +557% → write "vol 5x TB" ❌ (557% ≠ 5x, and it's vs yesterday, not vs 20d avg)770- `volume_changed` is +216% → write "vol 2x TB" ❌ (same mistake)771772**Correct pattern:**773- `volume_changed` +557% means today's volume is 6.57× yesterday's volume (1 + 5.57)774- To get vs-20d-average multiplier, you MUST compute: `today_vol / average(last_20_days_vol)`775776### Batch Volume Verification (multiple tickers + specific dates)777778```bash779uvx aipa-cli get-ohlcv-data VCB TCB MBB --limit 50 --no-ma --no-system-prompt 2>/dev/null | python3 -c "780import sys781from collections import defaultdict782data = defaultdict(list)783for line in sys.stdin:784 parts = line.split()785 if len(parts) >= 7 and parts[0] != 'time':786 data[parts[-1]].append((parts[0], int(float(parts[5]))))787checks = [788 ('VCB', '2026-06-10', 20),789 ('TCB', '2026-06-10', 20),790 ('MBB', '2026-06-10', 20),791]792for sym, date, ndays in checks:793 for i, (d, v) in enumerate(data.get(sym, [])):794 if d == date:795 start = max(0, i - ndays)796 avg = su797798…(truncated)