Four-layer architecture: watchlist monitoring, financial report reminders, in-depth research (4 AI analysts in parallel), automatic stock screening. Data is obtained from public information via WebSearch, and analysis results are stored in DingTalk aitable.
Trigger method
"股票分析" "自选股" "研究XX股票" "持仓快照" "财报分析" "选股" "持仓"
Four-layer architecture
| Layer | Function | Data source | Trigger method |
|---|---|---|---|
| First layer | Watchlist monitoring, target price reached notification | WebSearch + aitable | Manual + scheduled |
| Second layer | Financial report schedule reminders, automatic financial report analysis | WebSearch + aitable | Scheduled |
| Third layer | 4 AI analysts conducting in-depth research in parallel | WebSearch + aitable | Manual |
| Fourth layer | Automatic stock screening by conditions | WebSearch | Manual |
Data initialization
On first use, automatically create aitable data tables:
# 创建 Base
dws aitable base create --name "股票研究助手" --yes -f json
# 返回 baseId,记为 <sa-base-id>
# 创建 4 张表
dws aitable table create --base-id <sa-base-id> --name "自选股" --yes -f json
# 返回 tableId,记为 <watchlist-table-id>
dws aitable table create --base-id <sa-base-id> --name "持仓" --yes -f json
# 返回 tableId,记为 <portfolio-table-id>
dws aitable table create --base-id <sa-base-id> --name "分析记录" --yes -f json
# 返回 tableId,记为 <analysis-table-id>
dws aitable table create --base-id <sa-base-id> --name "财报日程" --yes -f json
# 返回 tableId,记为 <earnings-table-id>
# 添加业务字段(表创建后自动带一个"标题"primaryDoc字段,需额外添加业务字段)
dws aitable field create --base-id <sa-base-id> --table-id <watchlist-table-id> --fields '[{"fieldName":"股票代码","type":"text"},{"fieldName":"股票名称","type":"text"},{"fieldName":"市场","type":"text"},{"fieldName":"目标价","type":"number"},{"fieldName":"目标方向","type":"text"},{"fieldName":"当前价","type":"number"},{"fieldName":"备注","type":"text"}]' --yes -f json
dws aitable field create --base-id <sa-base-id> --table-id <portfolio-table-id> --fields '[{"fieldName":"股票代码","type":"text"},{"fieldName":"买入价","type":"number"},{"fieldName":"持仓量","type":"number"},{"fieldName":"买入日期","type":"date"},{"fieldName":"当前价","type":"number"},{"fieldName":"市值","type":"number"},{"fieldName":"盈亏金额","type":"number"},{"fieldName":"盈亏比例","type":"number"}]' --yes -f json
dws aitable field create --base-id <sa-base-id> --table-id <analysis-table-id> --fields '[{"fieldName":"股票代码","type":"text"},{"fieldName":"分析日期","type":"date"},{"fieldName":"分析类型","type":"text"},{"fieldName":"结论摘要","type":"text"},{"fieldName":"信心评分","type":"number"},{"fieldName":"建议","type":"text"}]' --yes -f json
dws aitable field create --base-id <sa-base-id> --table-id <earnings-table-id> --fields '[{"fieldName":"股票代码","type":"text"},{"fieldName":"财报日期","type":"date"},{"fieldName":"财报类型","type":"text"},{"fieldName":"状态","type":"text"}]' --yes -f json
Table 1: Watchlist (watchlist)
| Field name | Type | Description |
|---|---|---|
| Stock code | Text | AAPL / 600519.SH / HK0700 |
| Stock name | Text | Apple / Kweichow Moutai / Tencent Holdings |
| Market | Text | US stocks/A-shares/Hong Kong stocks |
| Target price | Number | Set target price level |
| Target direction | Text | Bullish/Bearish |
| Current price | Number | Latest price (manual/search update) |
| Notes | Text | Reason for following |
Table 2: Portfolio (portfolio)
| Field name | Type | Description |
|---|---|---|
| Stock code | Text | Linked watchlist stock |
| Buy price | Number | Cost price |
| Position size | Number | Quantity held (shares) |
| Buy date | Date | Position establishment time |
| Current price | Number | Latest price |
| Market value | Number | Current price × Position size |
| Profit/loss amount | Number | (Current price - Buy price) × Position size |
| Profit/loss ratio | Number | (Current price - Buy price) / Buy price × 100% |
Table 3: Analysis records (analysis_records)
| Field name | Type | Description |
|---|---|---|
| Stock code | Text | Linked watchlist stock |
| Analysis date | Date | Analysis time |
| Analysis Type | Text | Snapshot/Deep Research/Earnings Analysis/Stock Picking |
| Conclusion Summary | Text | Core Conclusion |
| Confidence Score | Number | 1-10 |
| Recommendation | Text | Buy/Hold/Sell/Watch |
Table 4: Earnings Calendar (earnings_calendar)
| Field Name | Type | Description |
|---|---|---|
| Stock Ticker | Text | Linked from Watchlist |
| Earnings Date | Date | Expected Release Date |
| Earnings Type | Text | Quarterly Report/Annual Report |
| Status | Text | Pending/Analyzed |
Working Modes
Mode 1: Watchlist Management
Trigger: "Add AAPL to watchlist, target price 200" / "What's in my watchlist" / "Delete XXX"
Workflow:
Step 1: 添加自选股
└── dws aitable record create --base-id <sa-base-id> --table-id <watchlist-table-id> --records '[{"cells":{"标题":"AAPL-Apple","股票代码":"AAPL","股票名称":"Apple","市场":"美股","目标价":200,"目标方向":"看涨"}}]' --yes -f json
Step 2: 更新价格(手动告知或 WebSearch)
└── dws aitable record update --records '[...]' --yes -f json
Step 3: 查看自选股列表
└── dws aitable record query --base-id <sa-base-id> --table-id <watchlist-table-id> --limit 50 --yes -f json
Mode 2: Portfolio Snapshot
Trigger: "Generate portfolio snapshot" / "Show me my portfolio" / "Portfolio profit and loss"
Workflow:
Step 1: 查询持仓表
└── dws aitable record query --base-id <sa-base-id> --table-id <portfolio-table-id> --limit 50 --yes -f json
Step 2: WebSearch 获取最新价格(或用户手动告知)
└── WebSearch → "AAPL stock price today" 等
Step 3: AI 计算市值和盈亏
├── 市值 = 当前价 × 持仓量
├── 盈亏金额 = (当前价 - 买入价) × 持仓量
└── 盈亏比例 = (当前价 - 买入价) / 买入价 × 100%
Step 4: 更新持仓表并输出报告
└── dws aitable record update --records '[...]' --yes -f json
Output Format:
## 持仓快照(2026-04-06)
| 股票 | 买入价 | 现价 | 持仓量 | 市值 | 盈亏 |
|------|--------|------|--------|------|------|
| AAPL | $170 | $185 | 10 | $1,850 | +$150 (+8.8%) |
| 600519.SH | ¥1800 | ¥1750 | 5 | ¥8,750 | -¥250 (-2.8%) |
| **合计** | | | | **$10,600** | **-$100** |
最佳:AAPL (+8.8%)
最差:600519.SH (-2.8%)
Mode 3: Deep Research (4 AI Analysts in Parallel)
Trigger: "Do a deep analysis of NVDA for me" / "Research Kweichow Moutai"
Workflow:
Step 1: WebSearch 获取最新数据
├── 搜索公司基本面信息(营收、利润、增长趋势)
├── 搜索行业和竞争信息
├── 搜索最新新闻和分析师观点
└── 搜索估值数据(P/E、P/B、EPS 等)
Step 2: 4 个 AI 分析师并行研究(使用 Agent Tool 并行)
├── 分析师1: 基本面分析 — 收入、利润、增长趋势
├── 分析师2: 护城河分析 — 竞争优势、技术壁垒
├── 分析师3: 估值分析 — P/E、DCF、同类对比
└── 分析师4: 风险分析 — 行业风险、公司风险、宏观风险
Step 3: AI 汇总
├── 综合评分(1-10)
├── 看多理由列表
├── 看空理由列表
├── 信心评分
└── 建议(买入/持有/卖出/观望)
Step 4: 保存分析记录
└── dws aitable record create --base-id <sa-base-id> --table-id <analysis-table-id> --records '[...]' --yes -f json
Output Format:
## NVIDIA (NVDA) 深度研究报告
### 总览
| 维度 | 评分(1-10) | 摘要 |
|------|-----------|------|
| 基本面 | 9 | 营收同比增长 122%,GPU 需求持续强劲 |
| 护城河 | 9 | CUDA 生态壁垒极高 |
| 估值 | 6 | P/E 65x 高于历史均值 |
| 风险 | 5 | 依赖 AI 投资周期,客户集中度高 |
### 看多理由
1. 数据中心收入持续爆发
2. CUDA 软件生态构成极深护城河
3. Blackwell 架构量产在即
### 看空理由
1. 估值已充分反映增长
2. 大客户自研芯片可能减少依赖
3. 出口管制风险
### 信心评分:7.5/10
### 建议:当前持仓可继续持有,不宜追高加仓。
Mode 4: Earnings Reminder and Analysis
Trigger: "What earnings reports are there this week" / "Analyze XXX's earnings report" / Scheduled automatic execution
Workflow:
Step 1: 查询财报日程表
└── dws aitable record query --base-id <sa-base-id> --table-id <earnings-table-id> --yes -f json
Step 2: 对"待发布"状态的财报
├── WebSearch 检查是否已发布
└── 如已发布 → WebSearch 抓取财报数据
Step 3: AI 分析财报
├── 核心数据(营收、利润、EPS)
├── 管理层要点
├── 市场反应
└── 与预期对比
Step 4: 更新状态并通知
├── dws aitable record update → 状态改为"已分析"
└── dws ding message send → 财报摘要通知
Mode 5: Automatic Stock Picking
Trigger: "Help me find companies with ROE greater than 15%" / "Screen low-valuation blue-chip stocks"
Workflow:
Step 1: 解析筛选条件
Step 2: WebSearch 获取符合条件的数据
├── 搜索股票筛选器/财务数据
└── 整理符合条件的股票列表
Step 3: AI 分析和排序
├── 按条件匹配度排序
├── 为每只股票简要说明
└── 推荐前 N 只
Step 4: 输出选股结果
dws CLI Command Reference
Create Stock Assistant
dws aitable base create --name "股票研究助手" --yes -f json
dws aitable table create --base-id <sa-base-id> --name "自选股" --yes -f json
dws aitable table create --base-id <sa-base-id> --name "持仓" --yes -f json
dws aitable table create --base-id <sa-base-id> --name "分析记录" --yes -f json
dws aitable table create --base-id <sa-base-id> --name "财报日程" --yes -f json
Watchlist Operations
# 添加自选股
dws aitable record create --base-id <sa-base-id> --table-id <watchlist-table-id> --records '[{"cells":{"标题":"AAPL-Apple","股票代码":"AAPL","股票名称":"Apple","市场":"美股","目标价":200,"目标方向":"看涨"}}]' --yes -f json
# 查询自选股
dws aitable record query --base-id <sa-base-id> --table-id <watchlist-table-id> --limit 50 --yes -f json
Portfolio Operations
# 添加持仓
dws aitable record create --base-id <sa-base-id> --table-id <portfolio-table-id> --records '[{"cells":{"标题":"AAPL持仓","股票代码":"AAPL","买入价":170,"持仓量":10,"买入日期":"2026-01-15"}}]' --yes -f json
# 更新价格和盈亏
dws aitable record update --base-id <sa-base-id> --table-id <portfolio-table-id> --records '[{"recordId":"rec_xxx","cells":{"当前价":185,"市值":1850,"盈亏金额":150,"盈亏比例":8.8}}]' --yes -f json
Save Analysis Records
dws aitable record create --base-id <sa-base-id> --table-id <analysis-table-id> --records '[{"cells":{"标题":"NVDA深度研究","股票代码":"NVDA","分析日期":"2026-04-06","分析类型":"深度研究","结论摘要":"基本面强劲,估值偏高","信心评分":7.5,"建议":"持有"}}]' --yes -f json
Earnings Calendar
dws aitable record create --base-id <sa-base-id> --table-id <earnings-table-id> --records '[{"cells":{"标题":"AAPL-Q2季报","股票代码":"AAPL","财报日期":"2026-04-25","财报类型":"季报","状态":"待发布"}}]' --yes -f json
DING Notifications (Target Price Reached/Earnings Release)
dws ding message send --robot-code "bot_code" --users "manager6950" --content "AAPL 已到达目标价 $200" --type "1" --yes
Scheduled Tasks
| Task | Cron | Description |
|---|---|---|
| Portfolio Snapshot | 0 9 * * 1-5 |
After market open on weekdays |
| Earnings Check | 0 9 * * 1 |
Check this week's earnings calendar every Monday |
| Target Price Monitoring | 30 16 * * 1-5 |
After market close on weekdays |
Linked Skills
| Linked Skill | Data Interaction | Description |
|---|---|---|
| business-advisor | Provide investment data | Advisory team financial analysis |
| morning-brief | Provide portfolio changes | Add portfolio snapshot to morning briefing |
Notes
- All
dwscommands must include the--yesflag - Stock data is obtained via WebSearch and may be delayed; it is recommended to manually confirm key data
- Portfolio profit and loss require AI to calculate and update after querying (aitable has no formula fields)
- The 4 analysts in deep research execute in parallel using the Agent Tool, taking about 1-3 minutes
- Supports A-shares (code format such as 600519.SH), US stocks (AAPL), and Hong Kong stocks (HK0700)
- DING messages are only used for important notifications (target price reached, major financial reports), to avoid frequent interruptions
aitable template searchCan be used to find preset table templates, returns templateId which can be used foraitable base create --template-idaitable base listCan view all created Bases, including baseId and baseName
Known Issues
- No known issues, all core commands (aitable CRUD, query, template search, base list) have passed testing