Install
openclaw skills install stockbuddyMulti-market stock analysis and portfolio execution assistant for CN, HK, and US equities. Provides technical + basic valuation analysis, portfolio review, account-aware position tracking, cash balances by market/currency, and execution-aware suggestions that respect lot size, odd-lot support, and trading constraints. Use when the user asks for stock analysis, portfolio analysis, buy/sell advice, watchlist management, position management, account cash tracking, rebalancing, or practical trading actions for a stock code or company name.
openclaw skills install stockbuddyStockBuddy is a stock analysis and portfolio execution support skill for A-share, Hong Kong, and US equities. It outputs quantified scores and clear action labels (Strong Buy / Buy / Hold / Sell / Strong Sell). By default, responses are decision-first: give the concise conclusion, score/confidence, event-adjusted second-pass suggestion, and practical order ideas before expanding into a long-form report.
Core rule: separate durable facts from derived values.
Five core scenarios:
Before giving execution-ready trading advice, confirm whether the durable constraints are sufficient.
Required durable facts for execution-aware advice:
If these are incomplete:
Special rule for buy advice:
Special rule for sell/trim advice:
Only install dependencies when they are actually missing, or when a script fails with a missing-package error:
bash {{SKILL_DIR}}/scripts/install_deps.sh
Required dependencies: numpy, pandas, built-in Python sqlite3.
No yfinance dependency is required; the current implementation mainly uses Tencent Finance data.
Trigger examples: "analyze Tencent", "can I buy this stock", "look at BYD", "analyze this ticker"
Steps:
Normalize the stock code
XXXX.HKSH600519 / SZ000001AAPL / TSLARun the analysis script
python3 {{SKILL_DIR}}/scripts/analyze_stock.py <CODE> --period 6mo
Optional period values: 1mo / 3mo / 6mo (default) / 1y / 2y / 5y
Data and caching behavior:
~/.stockbuddy/stockbuddy.db (SQLite)watchlist_id--no-cache--clear-cacheInterpret and present the result
references/output_templates.mdTrigger examples: "analyze my portfolio", "look at my holdings", "how are my positions doing"
Default output should still be decision-first: for each position, give the action label, score/confidence, important events, event-adjusted second suggestion, and a compact practical order version. Do not expand every holding into a full long report unless the user explicitly wants a detailed version.
Steps:
Check portfolio data
python3 {{SKILL_DIR}}/scripts/portfolio_manager.py list
Portfolio data is stored in the positions table in ~/.stockbuddy/stockbuddy.db.
If the portfolio is empty → guide the user to add positions first (see Scenario 3)
Run batch analysis
python3 {{SKILL_DIR}}/scripts/portfolio_manager.py analyze
Interpret and present the result
references/output_templates.mdTrigger examples: "add a Tencent position", "I bought 100 shares of BYD", "remove Alibaba from my holdings"
| Action | Command |
|---|---|
| Add position | python3 {{SKILL_DIR}}/scripts/portfolio_manager.py add <CODE> --price <BUY_PRICE> --shares <SHARES> [--date <DATE>] [--note <NOTE>] [--account <ACCOUNT_NAME_OR_ID>] |
| List positions | python3 {{SKILL_DIR}}/scripts/portfolio_manager.py list |
| Update position | python3 {{SKILL_DIR}}/scripts/portfolio_manager.py update <CODE> [--price <PRICE>] [--shares <SHARES>] [--note <NOTE>] [--account <ACCOUNT_NAME_OR_ID>] |
| Remove position | python3 {{SKILL_DIR}}/scripts/portfolio_manager.py remove <CODE> |
| List accounts | python3 {{SKILL_DIR}}/scripts/portfolio_manager.py account-list |
| Create/update account | python3 {{SKILL_DIR}}/scripts/portfolio_manager.py account-upsert <ACCOUNT_NAME> [--market <MARKET>] [--currency <CURRENCY>] [--cash <TOTAL_CASH>] [--available-cash <AVAILABLE_CASH>] [--note <NOTE>] |
| Set trading rule | python3 {{SKILL_DIR}}/scripts/portfolio_manager.py rule-set <CODE> [--lot-size <LOT_SIZE>] [--tick-size <TICK_SIZE>] [--odd-lot] |
When adding a position, ensure the stock exists in the watchlist and is linked through positions.watchlist_id -> watchlist.id. If the user does not provide a date, default to the current date. If the user provides natural-language trade info such as "I bought 100 shares of Tencent last week at 350", extract price, share count, date, and account info where possible, then execute the appropriate command.
After the first successful position record, proactively guide the user to fill the missing durable facts needed for execution-aware advice. Do not stop at only code / shares / cost if important constraints are still unknown.
Ask for or help the user confirm these fields, in this priority order:
If some fields are already known, only ask for the missing ones. Keep the follow-up compact: confirm what was captured, state what is still missing, and ask for the missing durable facts in one short message.
If the user gives only partial follow-up info, update what is available and continue asking only for the remaining missing fields. Once enough execution constraints are known, stop prompting and proceed normally.
Trigger examples: "my HK account has 3000 HKD cash", "track available cash", "record this under my US account", "how concentrated is my portfolio"
Rules:
Trigger examples: "watch Tencent", "add Apple to my watchlist", "remove Moutai from watchlist"
| Action | Command |
|---|---|
| List watchlist | python3 {{SKILL_DIR}}/scripts/portfolio_manager.py watch-list |
| Add watch item | python3 {{SKILL_DIR}}/scripts/portfolio_manager.py watch-add <CODE> |
| Remove watch item | python3 {{SKILL_DIR}}/scripts/portfolio_manager.py watch-remove <CODE> |
The scoring system combines technicals (roughly 60% weight) and basic valuation (roughly 40% weight). Final score range is approximately -10 to +10:
| Score Range | Recommendation |
|---|---|
| ≥ 5 | 🟢🟢 Strong Buy |
| 2 ~ 4 | 🟢 Buy |
| -1 ~ 1 | 🟡 Hold / Watch |
| -4 ~ -2 | 🔴 Sell |
| ≤ -5 | 🔴🔴 Strong Sell |
Only read references/technical_indicators.md when the user asks for detailed scoring logic, indicator interpretation, or when you need help calibrating a more detailed explanation.
When deciding the final output format, choosing between default query vs full report, or generating practical order suggestions, prefer references/output_templates.md. It defines the default query template, atomic templates, full-report composition rules, and the conservative / balanced / aggressive order-price generation rules (balanced is the default).
| File | Purpose |
|---|---|
scripts/analyze_stock.py | Core analysis script for market data retrieval, technical indicators, and valuation scoring |
scripts/portfolio_manager.py | Portfolio/account/watchlist management and batch analysis entry point |
scripts/install_deps.sh | Dependency installation script |
references/technical_indicators.md | Detailed technical indicator and scoring reference |
references/output_templates.md | Output template controller: default query template, atomic templates, full-report rules, and practical order generation rules |
references/data-source-roadmap.md | Data-source roadmap for primary/fallback/event-layer evolution; read only when extending data sources or event coverage |