Content
# Index Valuation Query Service
Based on the Snowball API's index valuation query MCP Server, providing index valuation data.
## Features
- **Authoritative Data**: Call Snowball Fund's [Index Valuation](https://danjuanfunds.com/rn/value-center) data API to obtain valuations
- **63 Indices**: Covering industry, broad-based, strategy, and other types of indices
- **Latest Query**: Support fuzzy matching, batch query, valuation screening
- **Historical Valuation**: Query historical data, analyze valuation trends
- **MCP Protocol**: Can be integrated into AI tools like Claude Code, Cursor
- **Automatic Caching**: 1-hour automatic refresh, reducing API calls
## Quick Start
### 1. Install Dependencies
```bash
cd /YOUR-PATH-TO/index_valuation
uv venv
source .venv/bin/activate
uv pip install mcp requests
```
### 2. Test Service Status
```bash
source .venv/bin/activate
python3 tests/test_mcp_server.py
```
### 3. Configure MCP
Edit Claude Code configuration file `~/.claude/settings.json`:
```json
{
"mcpServers": {
"index-valuation": {
"command": "/YOUR-PATH-TO/index_valuation/.venv/bin/python",
"args": ["/YOUR-PATH-TO/index_valuation/mcp_server.py"],
"env": {
"PYTHONUNBUFFERED": "1",
"PYTHONPATH": "/YOUR-PATH-TO/index_valuation"
},
"description": "Index Valuation Query Service (Supports Latest + Historical Queries)"
}
}
}
```
### 4. Restart Claude Code
After configuration, restart Claude Code.
## Getting Started
### Available Tools
| Tool | Description | Use Case |
|------|------------|----------|
| `get_index_valuation` | Query single index valuation (latest) | "How is the CSI 300 valuation?" |
| `get_batch_indices` | Batch query multiple index valuations | "Query CSI 300, China Securities Dividend" |
| `search_indices` | Search indices (support name/code) | "Search China Securities Bank" |
| `filter_by_valuation` | Screen indices by valuation status | "Find undervalued indices" |
| `fetch_latest_data` | Refresh latest valuation data | "Refresh latest valuation" |
| `get_index_history` | Query single index's historical valuation data | "CSI 300 historical data for the last 7 days" |
| `get_trend_analysis` | Analyze index valuation trend | "Analyze CSI 300 valuation trend" |
| `get_history_summary` | Get historical data summary | "View historical data volume" |
### Examples
Direct dialogue in Claude Code:
#### Example 1: Query Single Index
```
Help me query the CSI 300 valuation
```
#### Example 2: Find Undervalued Indices
```
List all undervalued indices
```
#### Example 3: Batch Query
```
Query CSI 300, China Securities Dividend, and China Securities Liquor valuations
```
#### Example 4: Search Index
```
Help me find the China Securities Bank valuation
```
#### Example 5: Query Historical Data
```
Help me query the CSI 300 historical valuation data for the last 7 days
```
#### Example 6: Analyze Valuation Trend
```
Analyze the CSI 300 valuation trend
```
## Historical Valuation Query Function
MCP Server supports querying historical valuation data and analyzing trends:
### Collect Historical Data
```bash
# 1. Crawl today's data (create data/history_data.csv)
source .venv/bin/activate
python3 archive/history_data_manager.py
# 2. View data summary
python3 archive/history_data_manager.py --list
# 3. Configure scheduled task (daily automatic crawl)
# Refer to HISTORY_README.md
```
> **Tip**: Historical data needs to be manually crawled daily, and it is recommended to configure a scheduled task for automatic collection.
For more details: [HISTORY_README.md](HISTORY_README.md)
## Data Source
- **Data Source**: [Snowball Fund](https://danjuanfunds.com/rn/value-center?channel=1300100141)
- **Update Frequency**: 1-hour cache + manual refresh. Actual data update once a day
- **Data Volume**: Currently includes 63 indices
- **Included Fields**:
- Index name, code, type
- PE, PE percentile, PB, PB percentile
- Dividend yield, ROE, predicted PEG
- Valuation status (undervalued/neutral/overvalued)
[Index Valuation Usage Instructions](https://danjuanfunds.com/activity/warband-team/zsgzsms)