Content
# Tool List
# Eastmoney Quant MCP Server
[](https://www.npmjs.com/package/eastmoney-quant-mcp)
[](https://pypi.org/project/eastmoney-quant-mcp/)
[](LICENSE)
A-share quantitative analysis MCP server powered by **Eastmoney** (eastmoney.com) public APIs. Provides professional stock data analysis for Claude Desktop / Claude Code / Codex / opencode.
## Core Capabilities
| Capability | Details |
|------------|---------|
| Market Data | 5530+ A-shares real-time: price / change% / PE / PB / market cap / volume ratio / turnover |
| K-lines | Daily OHLCV with forward/backward/no adjustment |
| Indicators | MA(5~200) / RSI(6/14/24) / MACD / BOLL / KDJ / ATR / VOL_MA |
| Popularity | Eastmoney real-time sentiment rankings + historical trends |
| Sectors | ~400 concepts + ~80 industries with capital flow (super-large/large/medium/small net) |
| Screening | 18 composable conditions: price range / PE / PB / cap / change% / volume / turnover / sector filter |
| Reports | Full technical analysis: trend / support & resistance / risk assessment / stop-loss & position advice |
All data sourced from **Eastmoney** (eastmoney.com) public APIs.
---
## Quick Install
```bash
# Claude Code (recommended)
claude mcp add eastmoney-quant -- npx eastmoney-quant-mcp
# or npm global
npm install -g eastmoney-quant-mcp
# or pip
pip install eastmoney-quant-mcp
```
**Requirements**: Python >= 3.10 | Node.js >= 18
---
## Data Details
### Stock Market Data
| Category | Fields |
|----------|--------|
| Basics | Latest price, open, previous close, high, low |
| Change | Change%, change amount, amplitude, velocity |
| Volume | Volume, turnover amount |
| Activity | Volume ratio, turnover rate |
| Valuation | Dynamic PE, PB, TTM PE |
| Market Cap | Total market cap, circulating market cap |
| Trend | 60-day change%, YTD change% |
| Fund Flow | Net major capital inflow |
### K-line Data
| Category | Details |
|----------|---------|
| Daily K-line | Open, high, low, close, volume, amount |
| Adjustment | Forward (qfq) / backward (hfq) / none |
| Extra Fields | Change%, turnover rate, amplitude |
### Technical Indicators (auto-calculated)
| Category | Indicators |
|----------|------------|
| Moving Avg | MA5, MA10, MA20, MA30, MA60, MA100, MA200 |
| RSI | RSI6, RSI14, RSI24 |
| MACD | DIF, DEA, MACD histogram |
| Bollinger | Upper, middle, lower bands |
| KDJ | K, D, J values |
| Volatility | ATR14 |
| Volume | VOL_MA5, VOL_MA10 |
### Popularity Rankings
| Category | Details |
|----------|---------|
| Rankings | Eastmoney real-time popularity list (rank / price / change% / volume ratio / turnover) |
| Trends | Historical ranking trend for any stock over N days |
### Sector Data
| Category | Details |
|----------|---------|
| Sector List | ~400 concept sectors + ~80 industry sectors |
| Sector Quotes | Sector index, change% |
| Capital Flow | Major net inflow, super-large/large/medium/small net inflow (with % share) |
| Leading Stocks | Top stocks in each sector |
| Sector K-line | Historical sector index trends |
| Sector Members | Individual stock quotes / turnover / volume ratio / PE / PB |
### Analysis Reports
| Module | Content |
|--------|---------|
| Basics | Price, change%, PE, PB, market cap, volume ratio, turnover |
| Trend | MA alignment, 5/10/20/60-day change%, direction assessment |
| Indicators | RSI state, MACD golden/death cross, KDJ overbought/oversold, BOLL position, ATR volatility |
| Support/Resistance | MA support/resistance + BOLL bands, sorted by strength |
| Risk | Overbought/oversold, volatility, valuation, liquidity, trend breakdown risks |
| Position | Stop-loss, take-profit, risk/reward ratio, position sizing advice |
---
## MCP Tools (9)
| Tool | Purpose |
|------|---------|
| `init_full_data` | One-time full download: stocks + sectors to local SQLite |
| `update_daily_data` | Daily incremental refresh (quotes / rankings / sectors) |
| `get_data_status` | View local DB status (record count / last update / storage path) |
| `screen_stocks` | Universal multi-condition screening (18 conditions + sector filter + name search + sort) |
| `get_kline_local_or_net` | K-line with auto-cached technical indicators (local first, network fallback) |
| `get_rank_trend_data` | Historical popularity ranking trend for any stock |
| `get_sector_list` | Browse concept/industry sectors with capital flow data |
| `get_stock_belong_sectors` | Reverse lookup: which sectors a stock belongs to |
| `generate_stock_report` | Full analysis report: trend / support-resistance / risk / position |
Plus 3 Claude Skills that teach the AI how to compose these tools for complex workflows.
---
## Local Database
Data is stored in local SQLite databases. After initial setup, queries are extremely fast with no network needed:
| Database | Default Path | Content |
|----------|-------------|---------|
| Stock DB | `~/Desktop/stock_data/stock_data.db` | 5530 stocks: quotes + K-lines + rankings + indicators |
| Sector DB | `~/Desktop/sector_data/sector_data.db` | 480+ sectors: quotes + capital flow + K-lines + members |
Customize paths via `EASTMONEY_STOCK_DATA_DIR` and `EASTMONEY_SECTOR_DATA_DIR` env vars.
---
## Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `EASTMONEY_PYTHON` | `python` | Python interpreter path |
| `EASTMONEY_STOCK_DATA_DIR` | `~/Desktop/股票信息` | Stock database directory |
| `EASTMONEY_SECTOR_DATA_DIR` | `~/Desktop/分析板块` | Sector database directory |
| `EASTMONEY_COOKIE` | Auto-extract from Edge | Eastmoney API cookies (improves request success rate) |
---
## Client Configuration
### Claude Desktop / Claude Code
```bash
claude mcp add eastmoney-quant -- npx eastmoney-quant-mcp
```
Or manually edit `claude_desktop_config.json`:
```json
{
"mcpServers": {
"eastmoney-quant": {
"command": "npx",
"args": ["eastmoney-quant-mcp"]
}
}
}
```
### Codex / opencode
```json
{
"mcpServers": {
"eastmoney-quant": {
"command": "npx",
"args": ["eastmoney-quant-mcp"]
}
}
}
```
### Direct Python
```json
{
"mcpServers": {
"eastmoney-quant": {
"command": "python",
"args": ["-m", "eastmoney_quant_mcp.server"]
}
}
}
```
---
## Usage Examples
```python
# 1. First-time init (~10 min, one-time only)
init_full_data(include_sector_members=True)
# 2. Daily update after market close (~2 min)
update_daily_data()
# 3. Screen: stocks with change% >3%, PE<30, volume ratio >1.5
screen_stocks({"min_change_pct":3, "max_pe":30, "min_volume_ratio":1.5})
# 4. Screen: semiconductor sector, PE<50, sorted by popularity
screen_stocks({"max_pe":50}, sector_code="BK1090", sort_by="popularity_rank")
# 5. Screen: search stocks with "bank" in name
screen_stocks(name_keyword="bank")
# 6. Get Ping An Bank K-line with cached indicators
get_kline_local_or_net("000001", days=250)
# 7. Ping An Bank 30-day popularity trend
get_rank_trend_data("000001", days=30)
# 8. Generate full analysis report
generate_stock_report("000001")
# Returns: trend / support-resistance / risk level / position advice
```
---
## Development
```bash
git clone https://github.com/lalal-zzz/eastmoney-quant-mcp.git
cd eastmoney-quant-mcp
pip install -e ".[dev]"
pytest
```
## License
MIT License
### Stock K-Line Data
| Data Item | Description |
|--------|------|
| Daily K-Line | Open price, highest price, lowest price, closing price, trading volume, trading amount |
| Adjustment Method | Forward adjustment (qfq) / Backward adjustment (hfq) / No adjustment |
| Additional Fields | Price change rate, turnover rate, amplitude |
### Technical Indicators (Automatically Calculated)
| Category | Indicators |
|------|------|
| Moving Averages | MA5, MA10, MA20, MA30, MA60, MA100, MA200 |
| Relative Strength | RSI6, RSI14, RSI24 |
| MACD | DIF, DEA, MACD column |
| Bollinger Bands | Upper track, middle track, lower track (BOLL) |
| KDJ | K, D, J values |
| Volatility | ATR14 (Average True Range) |
| Trading Volume | VOL_MA5, VOL_MA10 |
### Popularity Ranking Data
| Data Item | Description |
|--------|------|
| Popularity Ranking | East Fortune real-time popularity list (ranking/price/price change rate/volume ratio/turnover rate) |
| Historical Trend | Supports querying any stock's popularity ranking changes within N days |
### Sector Data
| Data Item | Description |
|--------|------|
| Sector List | Concept sectors (~400) + Industry sectors (~80) |
| Sector Market | Sector index, price change rate |
| Capital Flow | Main net inflow, super large order net inflow, large order net inflow, medium order net inflow, small order net inflow (including proportion%) |
| Leading Stock | Sector leading stock |
| Sector K-Line | Sector historical index trend |
| Sector Constituent Stocks | Each constituent stock's market/trade rate/volume ratio/PE/PB |
### Analysis Report
| Module | Content |
|------|------|
| Basic Information | Price, price change rate, PE, PB, market value, volume ratio, turnover rate |
| Trend Analysis | Moving average arrangement status, 5/10/20/60-day price change rate, direction judgment |
| Technical Indicators | RSI status, MACD golden cross/death cross, KDJ overbought/oversold, BOLL position, ATR amplitude |
| Support and Resistance | Moving average support/resistance + BOLL upper/lower track, sorted by intensity |
| Risk Assessment | Overbought/oversold risk, volatility risk, valuation risk, liquidity risk, trend break risk |
| Position Management | Stop loss position, take profit position, risk-reward ratio, position proportion suggestion |
## MCP Server (9)
| Tool | Function |
|------|------|
| `init_full_data` | Initial full download of stock + sector data to local SQLite database |
| `update_daily_data` | Incremental daily refresh (market/ranking/sector) |
| `get_data_status` | View local database status (data volume/update time/storage path) |
| `screen_stocks` | Universal multi-condition stock screening: 18 conditions free combination (price/PE/PB/market value/price change rate/volume ratio/turnover rate/amplitude), supports sector limitation, name search, multi-field sorting |
| `get_kline_local_or_net` | Get individual stock historical K-line (local priority, insufficient automatic download and cache technical indicators) |
| `get_rank_trend_data` | Query individual stock's popularity ranking historical trend within N days |
| `get_sector_list` | Get concept/industry sector list and market data |
| `get_stock_belong_sectors` | Reverse query: which sectors a stock belongs to |
| `generate_stock_report` | Generate individual stock comprehensive analysis report (trend/support resistance/risk level/position suggestion) |
Accompanied by 3 Claude Skills, teaching AI how to combine these tools to complete complex stock screening and report workflow.
## Local Database
Data stored in local SQLite database, query speed is extremely fast after initial initialization, no need for network connection:
| Database | Default Path | Content |
|--------|----------|------|
| Stock Database | `~/Desktop/股票信息/stock_data.db` | 5530 stocks market + K-line + popularity ranking + technical indicators |
| Sector Database | `~/Desktop/分析板块/sector_data.db` | 480+ sector market + capital flow + K-line + constituent stocks |
Can customize path through environment variables `EASTMONEY_STOCK_DATA_DIR` and `EASTMONEY_SECTOR_DATA_DIR`.
## Environment Variables
| Variable | Default Value | Description |
|------|--------|------|
| `EASTMONEY_PYTHON` | `python` | Python interpreter path |
| `EASTMONEY_STOCK_DATA_DIR` | `~/Desktop/股票信息` | Stock database directory |
| `EASTMONEY_SECTOR_DATA_DIR` | `~/Desktop/分析板块` | Sector database directory |
| `EASTMONEY_COOKIE` | Automatically extracted from Edge | East Fortune API Cookie (improve request success rate) |
## Client Configuration
### Claude Desktop / Claude Code
```bash
claude mcp add eastmoney-quant -- npx eastmoney-quant-mcp
```
Or manually edit `claude_desktop_config.json`:
```json
{
"mcpServers": {
"eastmoney-quant": {
"command": "npx",
"args": ["eastmoney-quant-mcp"]
}
}
}
```
### Codex / opencode
```json
{
"mcpServers": {
"eastmoney-quant": {
"command": "npx",
"args": ["eastmoney-quant-mcp"]
}
}
}
```
### Direct Python Run
```json
{
"mcpServers": {
"eastmoney-quant": {
"command": "python",
"args": ["-m", "eastmoney_quant_mcp.server"]
}
}
}
```
## Usage Example
```python
# 1. Initial database (about 10 minutes, only once)
init_full_data(include_sector_members=True)
# 2. Daily update after closing (about 2 minutes)
update_daily_data()
# 3. Stock screening: find stocks with price change rate > 3%, PE < 30, volume ratio > 1.5
screen_stocks({"min_change_pct":3, "max_pe":30, "min_volume_ratio":1.5})
# 4. Stock screening: chip sector stocks with PE < 50, sorted by popularity ranking
screen_stocks({"max_pe":50}, sector_code="BK1090", sort_by="popularity_rank")
# 5. Stock screening: search stocks with name containing "bank"
screen_stocks(name_keyword="bank")
# 6. Get Ping An Bank K-line and cache technical indicators
get_kline_local_or_net("000001", days=250)
# 7. View Ping An Bank's popularity changes within 30 days
get_rank_trend_data("000001", days=30)
# 8. Generate Ping An Bank comprehensive analysis report
generate_stock_report("000001")
# Return: trend/support resistance/risk level/position suggestion
```
## Development
```bash
git clone https://github.com/lalal-zzz/eastmoney-quant-mcp.git
cd eastmoney-quant-mcp
pip install -e ".[dev]"
pytest
```
## License
MIT License
MCP Config
Below is the configuration for this MCP Server. You can copy it directly to Cursor or other MCP clients.
mcp.json
Connection Info
You Might Also Like
No recommendations available