Content
# Finance-Agent
A multi-agent financial analysis project for A-share analysis scenarios, built based on `LangGraph + MCP Tools + OpenAI Compatible API`.
The current main process is located in `Financial-MCP-Agent`, supporting:
- Fundamental analysis
- Technical analysis
- Valuation analysis
- News analysis
- Report summarization
- Result evaluation and reflection re-planning (automatic secondary execution)
## Architecture Overview
Current main process (with evaluation and reflection loop integrated):
`start -> [fundamental, technical, value, news] -> summarizer -> evaluator -> (end | reflector -> re-analysis -> summarizer -> evaluator -> end)`
Description:
- `evaluator_agent`: Checks if the results meet the task goals, have logical issues, or are missing.
- `reflection_agent`: Generates re-planning instructions when evaluation fails, driving analysis agents to re-execute with new strategies.
## Directory Description
- `Financial-MCP-Agent/`: Main Agent framework and running entry
- `a-share-mcp-is-just-i-need/`: A-share data tools and MCP service implementation
- `self_write/`: Custom experimental code
- `train_qwen_*.py` / `test_*.py`: Training and testing scripts
## Environment Requirements
- Python 3.10+ (recommended 3.11/3.12)
- Windows / Linux / macOS
- Accessible OpenAI Compatible API
Install dependencies:
```bash
pip install -r requirements.txt
```
## Configuration
Copy and fill in environment variables:
```bash
cp Financial-MCP-Agent/.env.example Financial-MCP-Agent/.env
```
`.env` key items:
- `OPENAI_COMPATIBLE_API_KEY`
- `OPENAI_COMPATIBLE_BASE_URL`
- `OPENAI_COMPATIBLE_MODEL`
- `USE_LOCAL_MODEL` (default `api`)
## Running Methods
### 1) Direct Analysis via Command Line
```bash
python Financial-MCP-Agent/src/main.py --command "Analyze Guizhou茅台 (600519)"
```
### 2) Windows Encoding Compatibility (Recommended)
Some terminals default to `GBK`, recommend setting UTF-8:
```powershell
$env:PYTHONIOENCODING='utf-8'
python Financial-MCP-Agent/src/main.py --command "Analyze Guizhou茅台 (600519)"
```
## Output
- Report output: `Financial-MCP-Agent/reports/`
- Running logs: `logs/` and `Financial-MCP-Agent/logs/`
## Precautions
- The output of this project is only for research and learning, and does not constitute investment advice.
- `.gitignore` has excluded large models, logs, cache, and training products to avoid repository expansion.