Content
# Tushare MCP Server
Tushare financial data server based on MCP (Model Context Protocol), providing 52 professional financial data analysis tools.
## 🎯 Project Features
- ✅ **52 professional tools** - Covering 10 categories including stocks, futures, foreign exchange, and finance
- ✅ **Dual mode support** - stdio mode and HTTP SSE mode
- ✅ **Intelligent caching** - Automatic cache management to improve query efficiency
- ✅ **Permission management** - Supports different Tushare permission levels
- ✅ **Out-of-the-box** - Automatic tool discovery and registration
## 📦 Quick Start
### 1. Install Dependencies
```bash
pip install -r requirements.txt
```
### 2. Configure Tushare Token
Create a `.env` file in the project root directory:
```env
TUSHARE_TOKEN=your_token_here
```
Get Token: [https://tushare.pro/user/token](https://tushare.pro/user/token)
### 3. Select a Running Mode
#### Option A: stdio Mode (Recommended for Claude Desktop)
**Configuration File**: `%APPDATA%\Claude\claude_desktop_config.json` (Windows) or `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
```json
{
"mcpServers": {
"tushare": {
"command": "python",
"args": ["D:/AI/tushare_MCP/server.py"]
}
}
}
```
**Startup**: Restart Claude Desktop to start automatically
#### Option B: Streamable HTTP Mode (Recommended for Debugging and Remote Access)
**Start Server**:
```bash
# Windows
start_http_server.bat
# Linux/macOS
chmod +x start_http_server.sh
./start_http_server.sh
```
**Configuration File**: Same as above Claude Desktop configuration file
```json
{
"mcpServers": {
"tushare-http": {
"url": "http://127.0.0.1:8000/mcp"
}
}
}
```
## 🛠️ Mode Comparison
| Feature | stdio Mode | Streamable HTTP Mode |
|------|-----------|--------------|
| **Communication Method** | Standard Input/Output | HTTP JSON-RPC |
| **Network Access** | ❌ Local Process Only | ✅ Supports Network Access |
| **Concurrent Connections** | ❌ Single Client | ✅ Multiple Clients |
| **Debugging Difficulty** | 🔴 Difficult | 🟢 Easy (Can be tested with curl) |
| **Applicable Scenarios** | Local Single User | Development Debugging, Multi-User, Remote Access |
| **Configuration Method** | `command` + `args` | `url` |
## 📊 Tool Categories
Tushare MCP Tool List
This document lists all supported MCP tools, a total of 52 tools, divided into 10 categories.
📊 I. Alpha Strategy Analysis Tools (6 tools)
Industry Alpha Analysis
analyze_sector_alpha_strategy
Function: Analyze the relative strength Alpha of a single sector, and calculate the 2-day and 5-day Alpha returns
Parameters: sector_code (sector code, required), benchmark_code (benchmark index, default 000300.SH), end_date (end date, YYYYMMDD format, default today)
Description: Calculate the interval returns for 2 days and 5 days, calculate the excess return Alpha = sector return - benchmark return, comprehensive score = Alpha_2 × 60% + Alpha_5 × 40%
rank_sectors_by_alpha
Function: Shenwan Level 1 industry Alpha ranking, showing the top N strong sectors
Parameters: benchmark_code (benchmark index, default 000300.SH), end_date (end date, YYYYMMDD format, default today), top_n (display the top N, default 10)
Description: Automatically analyzes all 31 Shenwan Level 1 industries, sorted in descending order by comprehensive score
rank_l2_sectors_by_alpha
Function: Shenwan Level 2 industry Alpha ranking, showing the top N strong sectors
Parameters: benchmark_code (benchmark index, default 000300.SH), end_date (end date, YYYYMMDD format, default today), top_n (display the top N, default 20)
Description: Automatically analyzes all published index Shenwan Level 2 industries, sorted in descending order by comprehensive score
rank_l1_sectors_alpha_full
Function: Shenwan Level 1 industry Alpha comprehensive score full ranking (all 31 industries)
Parameters: benchmark_code (benchmark index, default 000300.SH), end_date (end date, YYYYMMDD format, default today)
Description: Displays the complete ranking of all Shenwan Level 1 industries
rank_l1_sectors_alpha_velocity
Function: Shenwan Level 1 industry Alpha ranking increase speed analysis
Parameters: benchmark_code (benchmark index, default 000300.SH), end_date (end date, YYYYMMDD format, default today)
Description: Calculate the ranking increase speed (the ranking change of the day compared with the previous day and the previous two days), positive numbers indicate ranking increase, and negative numbers indicate ranking decrease
rank_l2_sectors_alpha_velocity
Function: Shenwan Level 2 industry Alpha ranking increase speed analysis
Parameters: benchmark_code (benchmark index, default 000300.SH), end_date (end date, YYYYMMDD format, default today), top_n (display the top N, default 20)
Description: Calculate the ranking increase speed, including the ranking of the number of places increased in one day and the ranking of the number of places increased in two days
📈 II. Stock Market Tools (22 tools)
Stock Basic Information
get_stock_basic_info
Function: Get stock basic information (code, name, listing date, industry, etc.)
Parameters: ts_code (stock code, such as: 000001.SZ) or name (stock name, such as: Ping An Bank)
Description: Support query by code or name
search_stocks
Function: Search stocks, support fuzzy matching of code or name
Parameters: keyword (keyword, required, can be part of the stock code or part of the stock name)
Description: Support fuzzy search, return a list of matching stocks
Stock Market Data
get_stock_daily
Function: Get A-share daily market (opening, closing, highest, lowest, volume, etc.)
Parameters: ts_code (stock code, support multiple, separated by commas), trade_date (trading date, YYYYMMDD format), start_date/end_date (date range, YYYYMMDD format)
Description: Support single stock or batch query, support single day or date range query, the database is updated between 15:00 and 16:00 every trading day, this interface is unadjusted market
get_stock_weekly
Function: Get A-share weekly market, support single stock or batch query
Parameters: ts_code (stock code, required, support multiple, separated by commas), trade_date (trading date, YYYYMMDD format), start_date/end_date (date range, YYYYMMDD format)
Description: trade_date is the last trading day of the week (usually Friday), weekly data is updated once a week, this interface is unadjusted market
get_stock_min
Function: Get A-share real-time minute market data
Parameters: ts_code (stock code, required, such as: 600000.SH, support multiple stocks, separated by commas), freq (minute frequency, required, default 1MIN: 1MIN/5MIN/15MIN/30MIN/60MIN), date_str (playback date, optional, format: YYYY-MM-DD, default is the trading day, support backtracking one day)
Description: Data source Tushare rt_min interface (real-time) or rt_min_daily interface (historical playback), support 1min/5min/15min/30min/60min market, display opening, highest, lowest, closing, volume, turnover and other data, need to open permission separately, the maximum number of data per time is 1000 lines, support multiple stocks to extract at the same time, note: rt_min_daily interface only supports single stock extraction
get_stock_rt_k
Function: Get Shanghai, Shenzhen and Beijing real-time daily market data
Parameters: ts_code (stock code, required, support wildcard mode: single stock such as 600000.SH, 000001.SZ, 430047.BJ, wildcard such as 6*.SH, 301*.SZ, 0*.SZ, 9*.BJ, multiple stocks or wildcards such as 600000.SH,000001.SZ, the code must have .SH/.SZ/.BJ suffix)
Description: Data source Tushare rt_k interface, get real-time daily k-line market, support one-time extraction of all stock real-time daily k-line market by stock code and stock code wildcard, display opening, highest, lowest, closing (latest price), volume, turnover, number of transactions, entrusted buying and selling orders and other data, this interface is a separate permission data, the maximum number of data that can be extracted at one time is 6000, which is equivalent to extracting the entire market at one time, note: it is not recommended to extract the entire market at one time, it is better to extract in batches
ETF Fund
get_etf_daily
Function: Get ETF daily market data, support single ETF or batch query
Parameters: ts_code (ETF fund code, support multiple, separated by commas), trade_date (trading date, YYYYMMDD format), start_date/end_date (date range, YYYYMMDD format)
Description: Common ETF codes: 510330.SH (Huaxxia CSI 300 ETF), 510300.SH (CSI 300 ETF), 159919.SZ (CSI 300ETF), get ETF market transaction data after the daily close, history over 10 years, the maximum number of records per time is 2000
A-share Index
get_index_daily
Function: Get A-share index daily market (CSI 300, Shanghai Composite Index, Shenzhen Component Index, etc.)
Parameters: ts_code (index code, support multiple, separated by commas), trade_date (trading date, YYYYMMDD format), start_date/end_date (date range, YYYYMMDD format)
Description: Common index codes: 000300.SH (CSI 300), 000001.SH (Shanghai Composite Index), 399001.SZ (Shenzhen Component Index), 399006.SZ (ChiNext Index), the database is updated between 15:00 and 16:00 every trading day, this interface is unadjusted market
Restricted Stock Lifting Data
get_share_float
Function: Get restricted stock lifting data
Parameters: ts_code (stock code, such as: 000998.SZ, optional), ann_date (announcement date, YYYYMMDD format, optional), float_date (lifting date, YYYYMMDD format, optional), start_date/end_date (lifting date range, YYYYMMDD format, optional)
Description: Data source Tushare share_float interface, support filtering by stock code, announcement date, lifting date, date range, display lifting date, circulating shares, the ratio of circulating shares to total share capital, shareholder name, share type and other information, need 2000 points permission
Stock Repurchase Data
get_stock_repurchase
Function: Get listed company stock repurchase data
Parameters: ann_date (announcement date, YYYYMMDD format, such as: 20181010, optional), start_date/end_date (announcement date range, YYYYMMDD format, optional)
Description: Data source Tushare repurchase interface, support filtering by announcement date, date range, display announcement date, deadline, progress, expiration date, repurchase quantity, repurchase amount, repurchase maximum price, repurchase minimum price and other information, need 600 points permission, note: if no parameters are filled in, the default return is 2000 data at a time
Equity Pledge Data
get_pledge_detail
Function: Get stock equity pledge details data
Parameters: ts_code (stock code, required, such as: 000014.SZ)
Description: Data source Tushare pledge_detail interface, display stock pledge details data, including announcement date, shareholder name, pledge quantity, pledge start/end date, whether it has been unpledged, unpledged date, pledge party, total number of shares held, total number of pledges, pledge ratio and other information, need 500 points permission, the maximum number of data that can be called at one time is 1000
Block Trade Data
get_block_trade
Function: Get block trade data
Parameters: ts_code (stock code, such as: 600436.SH, optional), trade_date (trading date, YYYYMMDD format, such as: 20181227, optional), start_date/end_date (date range, YYYYMMDD format, optional)
Description: Data source Tushare block_trade interface, support filtering by stock code, trading date, date range, display trading date, transaction price, transaction volume, transaction amount, buyer business department, seller business department and other information, please check the Tushare document for permission requirements
Announcement Signal Scanning
scan_announcement_signals
Function: Scan the titles of listed company announcements to capture [major positive] or [major negative] signals
Parameters: ts_code_list (stock code list, multiple codes are separated by commas, such as: 000001.SZ,600000.SH, optional, if empty, scan the entire market), check_date (announcement date, YYYYMMDD format, such as: 20230621, optional, default is today), start_date/end_date (date range, YYYYMMDD format, optional)
Description: Data source Tushare anns_d interface, automatically classified into: positive catalyst, negative warning, major events according to the announcement title keywords, support filtering by stock code list and date, permission requirements: this interface is a separate permission, please refer to Tushare permission description, limited: the maximum number of data per time is 2000, you can get the full amount by date cycle
Shareholder Data
get_stock_holder_trade
Function: Get listed company shareholder increase/decrease data
Parameters: ts_code (stock code, optional), ann_date (announcement date, YYYYMMDD format, optional), start_date/end_date (date range, YYYYMMDD format, optional), trade_type (transaction type: IN increase/DE decrease, optional), holder_type (shareholder type: C company/P individual/G executive, optional)
Description: The data comes from the listed company announcement, showing the increase/decrease quantity, the proportion of circulation, the average price and other information, at least one query condition needs to be provided
get_stock_holder_number
Function: Get listed company shareholder number data
Parameters: ts_code (stock code, optional), ann_date (announcement date, YYYYMMDD format, optional), enddate (deadline, YYYYMMDD format, optional), start_date/end_date (date range, YYYYMMDD format, optional)
Description: The data comes from the listed company's periodic report, which is announced irregularly. The change in the number of shareholders can reflect the change trend of the concentration of stocks. At least one query condition needs to be provided
Institutional Research Data
get_stock_survey
Function: Get listed company institutional research record data
Parameters: ts_code (stock code, optional), trade_date (research date, YYYYMMDD format, optional), start_date/end_date (date range, YYYYMMDD format, optional)
Description: The data comes from the institutional research records disclosed by the listed company, showing the institutional participants, reception location, reception method, reception company and other information, need 5000 points permission, the maximum number of data that can be obtained at one time is 100, at least one query condition needs to be provided
Chip Analysis Data
get_cyq_perf
Function: Get the average cost and winning rate of A-share daily chips
Parameters: ts_code (stock code, required), trade_date (trading date, YYYYMMDD format, optional), start_date/end_date (date range, YYYYMMDD format, optional)
Description: The data is updated around 17~18 o'clock every day, starting from 2018, the chip concentration is automatically calculated, need 5000 points permission, the maximum number of data per time is 5000, chip concentration calculation formula: concentration = (cost_95pct - cost_5pct) / (cost_95pct + cost_5pct), the smaller the concentration, the more concentrated the chips; the larger the concentration, the more dispersed the chips
Margin Trading Data
get_margin
Function: Get daily summary data of margin trading (by exchange)
Parameters: trade_date (trading date, YYYYMMDD format, optional), start_date/end_date (date range, YYYYMMDD format, optional), exchange_id (exchange code: SSE Shanghai Stock Exchange/SZSE Shenzhen Stock Exchange/BSE Beijing Stock Exchange, optional)
Description: The data comes from the website of the stock exchange, providing summary data such as margin balance, margin buying amount, margin repayment amount, and securities lending balance, need 2000 points permission, the maximum number of data returned per request is 4000 lines
get_margin_detail
Function: Get margin trading details data (by stock code)
Parameters: ts_code (stock code, support multiple, separated by commas, optional), trade_date (trading date, YYYYMMDD format, optional), start_date/end_date (date range, YYYYMMDD format, optional)
Description: The data comes from the margin trading balance data reported by the securities company, providing the margin trading details data of each stock, need 2000 points permission, the maximum number of data returned per request is 4000 lines, at least one query condition needs to be provided
Capital Flow Data
get_stock_moneyflow_dc
Function: Get Dongfang Fortune individual stock capital flow data
Parameters: ts_code (stock code, leave blank to query all stocks, optional), trade_date (trading date, YYYYMMDD format, optional), start_date/end_date (date range, YYYYMMDD format, optional)
Description: Data source Dongfang Fortune, updated after the daily market, the data starts from 20230911, showing the net inflow of main funds, the net inflow and proportion of super large/large/medium/small orders, need 5000 points permission, the maximum number of data that can be obtained at one time is 6000, at least one query condition needs to be provided
Daily Indicator Data
get_daily_basic
Function: Get daily indicator data (valuation indicators, turnover rate, volume ratio, market value, etc.)
Parameters: ts_code (stock code, support multiple, separated by commas, optional), trade_date (trading date, YYYYMMDD format, optional), start_date/end_date (date range, YYYYMMDD format, optional)
Description: Including valuation indicators (PE, PB, PS), turnover rate, volume ratio, total market value, circulating market value, etc., support query by stock code, trading date, date range, at least one query condition needs to be provided
Top List Data
get_top_list
Function: Get daily transaction details data of the top list
Parameters: trade_date (trading date, required, YYYYMMDD format), ts_code (stock code, optional)
Description: Data source Tushare top_list interface, data history from 2005 to now, showing closing price, increase/decrease, turnover rate, total turnover, buying/selling amount of the top list, net buying amount, reasons for being on the list, etc., need 2000 points permission, the maximum number of data per time is 10000 lines
get_top_inst
Function: Get institutional transaction details data of the top list
Parameters: trade_date (trading date, required, YYYYMMDD format), ts_code (stock code, optional)
Description: Data source Tushare top_inst interface, showing business department name, buying and selling type (0 the top 5 with the largest buying amount/1 the top 5 with the largest selling amount), buying amount, selling amount, net transaction amount, buying/selling ratio, reasons for being on the list, etc., need 5000 points permission, the maximum number of data per time is 10000 lines
📊 III. Index Market Tools (4 tools)
International Index
get_global_index
Function: Get the market of major international indexes (Dow Jones, S&P 500, Nasdaq, etc.)
Parameters: index_code (index code, such as: XIN9, HSI, DJI, SPX, IXIC, etc., optional), index_name (index name, optional), trade_date (trading date, YYYYMMDD format, optional), start_date/end_date (date range, YYYYMMDD format, optional)
Description: Support more than 20 major international indexes, including FTSE China A50, Hang Seng Index, Dow Jones, S&P 500, Nasdaq, Nikkei 225, etc., at least one query condition needs to be provided
search_global_indexes
Function: Search for available international indexes, support keyword filtering
Parameters: keyword (search keyword, optional, leave blank to display all available indexes)
Description: Return a list of all supported international indexes, or filter by keyword
Industry Index
get_sw_industry_daily
Function: Get Shenwan industry index daily market (level 1, level 2, level 3 industries)
Parameters: ts_code (index code, optional), trade_date (trading date, YYYYMMDD format, optional), start_date/end_date (date range, YYYYMMDD format, optional), level (industry classification: L1/L2/L3, default L1)
Description: L1 is the level 1 industry (such as: mining, chemical, steel, etc.), L2 is the level 2 industry, L3 is the level 3 industry, the database is updated between 15:00 and 16:00 every trading day, this interface is unadjusted market, at least one query condition needs to be provided
get_industry_index_codes
Function: Get Shenwan industry classification index code list (L1/L2/L3)
Parameters: level (industry classification: L1/L2/L3, default L1), src (index source: SW2014/SW2021, default SW2021)
Description: Return the index code list of Shenwan industry classification, including index code, industry name, industry code and other information
💱 IV. Foreign Exchange Tools (1 tool)
get_fx_daily
Function: Get foreign exchange daily market (US dollar RMB, Euro US dollar and other trading pairs)
Parameters: ts_code (trading pair code, support multiple, separated by commas, optional), trade_date (trading date, YYYYMMDD format, optional), start_date/end_date (date range, YYYYMMDD format, optional)
Description: Common trading pair codes: USDCNH.FXCM (US dollar RMB), EURUSD.FXCM (Euro US dollar), GBPUSD.FXCM (British pound US dollar), USDJPY.FXCM (US dollar Japanese yen), at least one of the trading pair code (ts_code) or trading date (trade_date) needs to be provided
📈 V. Futures Tools (5 tools)
get_fut_basic
Function: Get basic information of futures contracts
Parameters: exchange (exchange code, required: CFFEX China Financial Futures Exchange/DCE Dalian Commodity Exchange/CZCE Zhengzhou Commodity Exchange/SHFE Shanghai Futures Exchange/INE Shanghai International Energy Exchange/GFEX Guangzhou Futures Exchange), fut_type (contract type: 1 ordinary contract/2 main and continuous contract, optional), fut_code (standard contract code, such as: AG, AP, etc., optional), list_date (listing start date, YYYYMMDD format, optional)
Description: Display contract code, transaction identification, transaction market, Chinese abbreviation, contract product code, contract multiplier, transaction unit, quotation unit, listing date, last trading date, delivery month, last delivery date and other information
get_nh_index
Function: Get Nanhua Futures Index daily market data
Parameters: ts_code (index code, support multiple, separated by commas, optional), trade_date (trading date, YYYYMMDD format, optional), start_date/end_date (date range, YYYYMMDD format, optional)
Description: Data source Tushare index_daily interface, showing opening, highest, lowest, closing, increase/decrease points, increase/decrease, volume, turnover and other market data, need 2000 points permission, common indexes: NHCI.NH (Nanhua Commodity Index), NHAI.NH (Nanhua Agricultural Products Index), CU.NH (Nanhua Shanghai Copper Index), AU.NH (Nanhua Shanghai Gold Index), etc., at least one query condition needs to be provided
get_fut_holding
Function: Get futures daily position ranking data
Parameters: trade_date (trading date, YYYYMMDD format, optional), symbol (contract or product code, such as: C1905, C, etc., optional), start_date/end_date (date range, YYYYMMDD format, optional), exchange (exchange code, optional: CFFEX/DCE/CZCE/SHFE/INE/GFEX)
Description: Data source Tushare fut_holding interface, showing the transaction volume, transaction volume change, long position, long position change, short position, short position change and other data of futures company members, need 2000 points permission, the maximum number of data that can be called at one time is 5000, at least one of the trading date (trade_date) or date range (start_date/end_date) needs to be provided
get_fut_wsr
Function: Get futures warehouse receipt daily report data
Parameters: trade_date (trading date, YYYYMMDD format, optional), symbol (product code, such as: ZN zinc, CU copper, etc., optional), start_date/end_date (date range, YYYYMMDD format, optional), exchange (exchange code, optional: CFFEX/DCE/CZCE/SHFE/INE/GFEX)
Description: Data source Tushare fut_wsr interface, showing the warehouse receipt changes of each warehouse/factory warehouse, including yesterday's warehouse receipt quantity, today's warehouse receipt quantity, increase/decrease quantity and other information, need 2000 points permission, the maximum number of data that can be called at one time is 1000, at least one of the trading date (trade_date) or date range (start_date/end_date) needs to be provided
get_fut_min
功能:获取期货实时分钟行情数据
参数:ts_code(期货合约代码,必填,如:CU2501.SHF,支持多个合约,逗号分隔)、freq(分钟频度,必填,默认1MIN:1MIN/5MIN/15MIN/30MIN/60MIN)、date_str(回放日期,可选,格式:YYYY-MM-DD,默认为交易当日,支持回溯一天)
说明:数据来源Tushare rt_fut_min接口(实时)或rt_fut_min_daily接口(历史回放),支持1min/5min/15min/30min/60min行情,显示开盘、最高、最低、收盘、成交量、成交金额、持仓量等数据,需单独开权限,每分钟可以请求500次,支持多个合约同时提取
📋 六、财务报表工具 (2个)
get_income_statement
功能:获取利润表数据,支持合并报表和母公司报表
参数:ts_code(股票代码,必填)、start_date(开始日期,YYYYMMDD格式,可选)、end_date(结束日期,YYYYMMDD格式,可选)、report_type(报告类型,默认1合并报表,可选值:1-12)
说明:支持12种报告类型,包括合并报表、单季合并、母公司报表等
get_fina_indicator
功能:获取财务指标数据(盈利能力、成长能力、运营能力、偿债能力等)
参数:ts_code(股票代码,可选)、ann_date(公告日期,YYYYMMDD格式,可选)、start_date/end_date(报告期日期范围,YYYYMMDD格式,可选)、period(报告期,可选)
说明:数据来源于上市公司定期报告,每年发布4次(一季报、半年报、三季报、年报),包含ROE、ROA、毛利率、净利率、资产负债率、周转率等各类财务指标,至少需要提供一个查询条件
📊 七、概念板块工具 (8个)
概念板块数据
get_eastmoney_concept_board
功能:获取东方财富概念板块行情数据
参数:ts_code(指数代码,支持多个,逗号分隔,如:BK1186.DC,BK1185.DC,可选)、name(板块名称,例如:人形机器人,可选)、trade_date(交易日期,YYYYMMDD格式,可选)、start_date/end_date(日期范围,YYYYMMDD格式,可选)
说明:需要6000积分权限,返回概念代码、概念名称、涨跌幅、领涨股票、总市值、换手率等,单次最大可获取5000条数据,至少需要提供一个查询条件
get_eastmoney_concept_member
功能:获取东方财富板块每日成分数据
参数:ts_code(板块指数代码,如:BK1184.DC人形机器人,可选)、con_code(成分股票代码,如:002117.SZ,可选)、trade_date(交易日期,YYYYMMDD格式,可选)
说明:可以根据概念板块代码和交易日期,获取历史成分;也可以查询某只股票属于哪些概念板块,需要6000积分权限,单次最大获取5000条数据,至少需要提供一个查询条件
get_eastmoney_concept_daily
功能:获取东财概念板块、行业指数板块、地域板块行情数据
参数:ts_code(板块代码,格式:xxxxx.DC,如:BK1184.DC,可选)、trade_date(交易日期,YYYYMMDD格式,可选)、start_date/end_date(日期范围,YYYYMMDD格式,可选)、idx_type(板块类型:概念板块/行业板块/地域板块,可选)
说明:历史数据开始于2020年,单次最大2000条数据,需要6000积分权限,至少需要提供一个查询条件
概念板块Alpha分析
analyze_concept_alpha_strategy
功能:分析单个东财概念板块的相对强度Alpha
参数:concept_code(概念板块代码,必填,如:BK1184.DC人形机器人、BK1186.DC首发经济等)、benchmark_code(基准指数,默认000300.SH)、end_date(结束日期,YYYYMMDD格式,默认今天)
说明:计算2天和5天的区间收益率,计算超额收益Alpha,综合得分 = Alpha_2 × 60% + Alpha_5 × 40%
rank_concepts_by_alpha
功能:概念板块Alpha排名,计算相对沪深300的超额收益
参数:benchmark_code(基准指数,默认000300.SH)、end_date(结束日期,YYYYMMDD格式,默认今天)、top_n(显示前N名,默认20)、hot_limit(筛选的热门概念板块数量,默认80,根据成交额和换手率筛选)
说明:自动获取指定日期的热门概念板块(根据成交额和换手率筛选),按综合得分降序排列,显示前N名强势板块,仅分析热门板块以减少计算量,提高响应速度
rank_concepts_alpha_velocity
功能:概念板块Alpha排名上升速度,识别快速上升概念
参数:benchmark_code(基准指数,默认000300.SH)、end_date(结束日期,YYYYMMDD格式,默认今天)
说明:计算排名上升速度(当天对比前一天和前两天的排名变化),正数表示排名上升,负数表示排名下降
板块资金流向
get_concept_moneyflow_dc
功能:获取东方财富板块资金流向数据(概念、行业、地域)
参数:ts_code(板块代码,如:BK1184.DC,留空则查询所有板块,可选)、trade_date(交易日期,YYYYMMDD格式,可选)、start_date/end_date(日期范围,YYYYMMDD格式,可选)、content_type(资金类型:行业/概念/地域,留空则查询所有类型,可选)
说明:数据来源东方财富,每天盘后更新,显示主力净流入额、超大单/大单/中单/小单的净流入额和占比、主力净流入最大股、排名等信息,需要5000积分权限,单次最大可调取5000条数据,至少需要提供一个查询条件
概念板块成交量异动
scan_concepts_volume_anomaly
功能:分析东财概念板块成交量异动
参数:end_date(结束日期,YYYYMMDD格式,默认今天,可选)、vol_ratio_threshold(成交量比率阈值,默认1.15,即MA3/MA10 > 1.15,资金进场)、price_change_5d_min(5日涨幅最小值,默认0.02,即2%,右侧启动)、price_change_5d_max(5日涨幅最大值,默认0.08,即8%,拒绝左侧死鱼)、hot_limit(扫描的热门概念板块数量,默认160,根据成交额和换手率筛选)
说明:扫描热门东财概念板块(根据成交额和换手率筛选),计算指标:Volume_Ratio = MA3_Vol / MA10_Vol、Price_Change_5d(5日涨幅)、Turnover_Rate(换手率),筛选逻辑:Volume_Ratio > vol_ratio_threshold(资金进场)且 price_change_5d_min < Price_Change_5d < price_change_5d_max(右侧启动),返回JSON格式字符串
📊 八、成交量异动分析工具 (1个)
scan_l2_volume_anomaly
功能:扫描申万二级行业成交量异动,识别量价背离信号
参数:end_date(结束日期,YYYYMMDD格式,默认今天,可选)、vol_ma_short(成交量短期MA天数,默认3,即MA3,可设置为1、3、5等)、vol_ma_long(成交量长期MA天数,默认10,即MA10,可设置为3、5、10、20等)、vol_ratio_threshold(成交量比率阈值,默认1.5,即MA短/MA长 > 1.5)、price_change_5d_threshold(5日涨幅阈值,默认0.03,即3%)
说明:筛选条件:(成交量MA短/成交量MA长) > 阈值 且 近5日涨幅 < 阈值,根据价格位置判断信号类型(高位>70%分位:出货信号Distribution,低位<30%分位或均线之上:潜伏信号Accumulation,其他:待确认Uncertain),返回JSON格式字符串
🗄️ 九、缓存管理工具 (1个)
get_cache_stats
功能:获取缓存统计信息(缓存数量、访问次数等)
参数:无
说明:显示所有缓存类型的统计信息,包括缓存数量和访问次数
📝 使用说明
日期格式
所有日期参数格式:YYYYMMDD(如:20250102)
如果未提供日期,默认使用今天
回放日期格式:YYYY-MM-DD(如:2025-01-02)
基准指数
Alpha分析默认基准指数:000300.SH(沪深300)
可以自定义基准指数代码
数据来源
概念板块数据:东方财富(需要6000积分权限)
行业数据:Tushare(申万行业分类)
股票数据:Tushare
国际指数:Tushare
期货数据:Tushare
缓存机制
所有工具支持缓存,提高查询效率
缓存数据永久保留,过期后标记状态
可以使用 get_cache_stats 查看缓存统计
权限要求
大部分工具需要基础Tushare权限
2000积分权限工具:
get_nh_index(南华期货指数)
get_margin(融资融券汇总)
get_margin_detail(融资融券明细)
get_top_list(龙虎榜每日明细)
get_fut_holding(期货持仓排名)
get_fut_wsr(期货仓单日报)
get_share_float(限售股解禁)
5000积分权限工具:
get_stock_survey(机构调研)
get_cyq_perf(筹码分析)
get_stock_moneyflow_dc(个股资金流向)
get_concept_moneyflow_dc(板块资金流向)
get_top_inst(龙虎榜机构明细)
6000积分权限工具:
get_eastmoney_concept_board(东财概念板块)
get_eastmoney_concept_daily(东财概念行情)
get_eastmoney_concept_member(东财概念成分)
单独权限工具(需单独申请):
get_stock_min(A股实时分钟行情)
get_stock_rt_k(沪深京实时日线)
get_fut_min(期货实时分钟行情)
scan_announcement_signals(公告信号扫描)
📊 工具统计
总工具数:52个
Alpha策略分析:6个
股票行情工具:22个
指数行情工具:4个
外汇工具:1个
期货工具:5个
财务报表工具:2个
概念板块工具:8个
成交量异动分析:1个
缓存管理工具:1个
统计分时线的脚本
python g:\AICode\tocker-mcp\tushare_MCP\scripts\realtime_collector.py
统计板块强度的脚本
python g:\AICode\tocker-mcp\tushare_MCP\scripts\sector_strength_collector.py
analyze_sector_health: Added a sector health analysis tool. It calculates the trend slope (Slope) by performing a linear regression on the sector's score over the past hour, and combines it with the coherence of trading volume and endogenous breadth (percentage of rises) to rate the sustainability of the sector's trend as A/B/C.
get_index_rt_k: Implemented based on the rt_k API documentation you provided. Specifically used to obtain real-time daily candlestick snapshots of indices (such as the 000001.SH Shanghai Composite Index), making it convenient as a benchmark for relative strength.
scan_realtime_strong_sectors: Optimized the real-time strength scanning logic, now automatically captures the entire market (6-series, 0-series, 3-series, Beijing Stock Exchange, etc. wildcards), and more accurately compares with the trading volume at the same time yesterday.
Connection Info
You Might Also Like
valuecell
Valuecell is a Python project for efficient data management.
hexstrike-ai
HexStrike AI is an AI-powered MCP cybersecurity automation platform with 150+ tools.
AP2
AP2 provides code samples and demos for the Agent Payments Protocol.
YC-Killer
YC-Killer is an AI agents library by Singularity Research, open-sourcing...
solana-agent-kit
An open-source toolkit for AI agents to interact with Solana protocols.
mcp-server
MCP Server provides access to stock market data and financial statements.