Based on the Nexus-caiwu-agent project, an intelligent financial analysis skill for the A-share market.
Metadata
- GitHub: https://github.com/hhhh124hhhh/Nexus-caiwu-agent.git
- Commit Hash: c6252038986d6f77bfed2b3401c9783712079e38
- Version: 0.1.0
Core Scripts
scripts/fetch_data.py (recommended)
A standalone data acquisition script, no need to clone the original project.
Automatic environment detection: automatically detects the Python environment and installs missing dependencies on first run.
Network mode support:
auto- Automatic network status detection (default)direct- Domestic direct connection modeproxy- Proxy mode (supports HTTP/HTTPS/SOCKS5)
# 检查环境状态
python scripts/fetch_data.py --check
# 自动安装依赖
python scripts/fetch_data.py --install
# 检测网络模式
python scripts/fetch_data.py --detect-network
# 获取财务数据(自动模式)
python scripts/fetch_data.py 600519 贵州茅台
# 指定网络模式
python scripts/fetch_data.py 600519 --mode direct
python scripts/fetch_data.py 600519 --mode proxy --proxy http://127.0.0.1:7890
# 获取数据并分析
python scripts/fetch_data.py 600519 贵州茅台 --analyze --save
Output Examples:
{
"stock_code": "600519",
"stock_name": "贵州茅台",
"key_metrics": {
"revenue_billion": 1275.5,
"net_profit_billion": 653.8,
"net_profit_margin": 51.26,
"debt_ratio": 21.5
},
"health_score": 60,
"risk_level": "低风险"
}
scripts/wrapper.py
Full version wrapper, requires cloning the original project first. Suitable for scenarios requiring full functionality.
scripts/comparison_template.py [NEW]
Multi-company comparative analysis report template, generates a fully offline comparative analysis HTML report.
from scripts.comparison_template import generate_comparison_html_report
# 准备对比数据
companies = [
{
"stock_code": "601668",
"stock_name": "中国建筑",
"key_metrics": {
"revenue_billion": 15582.20,
"net_profit_billion": 493.42,
"roe": 6.04,
...
}
},
...
]
# 可选的行业和宏观数据
industry_data = {"total_output": "32万亿", ...}
macro_data = {"gdp": "140.19万亿", ...}
# 生成对比报告
html = generate_comparison_html_report(
companies,
industry_data=industry_data,
macro_data=macro_data
)
# 保存报告
with open("comparison_report.html", "w", encoding="utf-8") as f:
f.write(html)
Features:
- Fully offline (no external CDN dependencies)
- A-share color convention (red for gains, green for losses)
- Responsive design (phone/tablet/computer)
- Charts: revenue comparison, profit comparison, ROE ranking, cash distribution
Core Capabilities
- Financial ratio calculation: profitability, solvency, operational efficiency, growth capability, cash flow quality
- DuPont analysis: ROE decomposition (net profit margin × turnover ratio × leverage)
- Cash flow analysis: operating cash flow quality, free cash flow assessment
- Health assessment: five-dimension comprehensive score, risk level
- Trend analysis: multi-year trend analysis, CAGR calculation
- Report generation: D3.js interactive HTML report
- Data persistence: stored in JSON format, supports subsequent analysis
Supported Markets
- Shanghai Main Board (600xxx, 601xxx, 602xxx, 603xxx, 605xxx)
- Shenzhen Main Board (000xxx, 001xxx)
- ChiNext (300xxx)
- STAR Market (688xxx)
- Beijing Stock Exchange (8xxx, 43xxx)
Usage
Method 1: Standalone script (recommended)
# 检查环境(可选)
python scripts/fetch_data.py --check
# 自动安装依赖(或首次运行时自动安装)
python scripts/fetch_data.py --install
# 分析股票
python scripts/fetch_data.py 600519 贵州茅台 --analyze
Features:
- Automatically detects Python version (requires 3.8+)
- Automatically detects and installs missing dependency packages (akshare, pandas)
- No manual environment configuration required
Method 2: Direct conversation
帮我分析贵州茅台(600519)的财务状况
分析 600248 陕西建工的投资价值
Analysis Framework
Five-dimension health assessment (100-point scale)
| Dimension | Weight | Core Indicators | Full-score Conditions |
|---|---|---|---|
| Profitability | 25% | ROE | > 15% |
| Solvency | 25% | Debt-to-asset ratio | < 40% |
| Operational efficiency | 20% | Asset turnover ratio | > 1.0 |
| Growth capability | 15% | Revenue growth rate | > 20% |
| Cash flow quality | 15% | Cash Flow/Net Profit | > 1.2 |
Risk Level
| Score | Risk Level | Investment Recommendation |
|---|---|---|
| 80-100 | Low Risk ✅ | Consider allocating |
| 60-79 | Medium-Low Risk | Moderate allocation |
| 40-59 | Medium Risk ⚠️ | Allocate with caution |
| 20-39 | Medium-High Risk | Not recommended for heavy positions |
| 0-19 | High Risk ❌ | Avoid |
DuPont Analysis
ROE = 净利率 × 总资产周转率 × 权益乘数
分析维度:
- 净利率 → 盈利能力
- 资产周转率 → 运营效率
- 权益乘数 → 财务杠杆
Output Files
| File | Description |
|---|---|
data/[代码]_[名称].json |
Financial Data JSON |
reports/[代码]_financial_report.html |
D3.js Interactive Report |