A Python package for technical analysis of financial markets
Project description
技术指标分析工具
该工具提供mcp服务器用于分析ETF和股票的技术指标。它使用akshare库获取历史数据,并计算RSI、布林带和移动平均线等技术指标。该工具支持ETF和股票历史数据分析。
API文档
mcp服务器提供的接口:
analyze_etf_technical
@mcp.tool()
def analyze_etf_technical(etf_code='510300', with_market_style=False):
"""
ETF技术指标分析工具
:param etf_code: ETF代码 (例如'510300')
:param with_market_style: 是否包含市场风格分类 (True/False)
:param base_date: 基准日期,格式为YYYYMMDD (可选)
:return: 包含技术指标的Markdown表格(最后5条记录)
"""
新增字段说明:
参数:
etf_code: ETF代码,默认为'510300'(沪深300ETF)
返回值:
- 包含以下技术指标的Markdown表格:
- 价格数据
- RSI指标
- 布林带
- 移动平均线
atr: 平均真实波幅(10日),衡量价格波动性的指标,数值越大表示波动越大mkt_style: 市场风格分类结果
示例:
result = analyze_etf_technical('510300')
print(result)
analyze_stock_hist_technical
@mcp.tool()
def analyze_stock_hist_technical(stock_code='000001'):
"""
股票历史数据技术指标分析工具
:param stock_code: 股票代码 (例如'000001')
:param base_date: 基准日期,格式为YYYYMMDD (可选)
:return: 包含技术指标的Markdown表格(最后5条记录)
"""
参数:
stock_code: 股票代码,默认为'000001'(平安银行)
返回值:
- 包含以下技术指标的Markdown表格:
- 价格数据
- RSI指标
- 布林带
- 移动平均线
atr: 平均真实波幅(10日),衡量价格波动性的指标,数值越大表示波动越大mkt_style: 市场风格分类结果
示例:
result = analyze_stock_hist_technical('000001')
print(result)
安装与配置
安装
pip install technical-analysis-mcp
配置
- 确保已安装Python 3.8+版本
- 需要配置akshare数据源(可选)
- 运行MCP服务器:
technical-analysis-mcp
市场风格分类示例
# 获取带市场风格分类的ETF技术指标
result = analyze_etf_technical('510300', with_market_style=True)
print(result)
# 获取带市场风格分类的股票技术指标
result = analyze_stock_hist_technical('000001', with_market_style=True)
print(result)
MCP配置示例
{
"mcpServers": {
"technical-analysis-mcp": {
"command": "uvx",
"args": ["technical-analysis-mcp"]
}
}
}
Restful API
使用uvicorn启动FastAPI应用:
uvicorn technical_analysis.http:app --reload --port 8000
应用启动后,可以通过以下地址访问API文档: http://localhost:8000/docs
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file technical_analysis_mcp-0.1.9.tar.gz.
File metadata
- Download URL: technical_analysis_mcp-0.1.9.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30abfe6dc56cc64e9435f2208abf9e1a53fc991ca059f9fdafbf7c0aafc4cc06
|
|
| MD5 |
6bf8095b4d21d81f2bf4d50a1a420f6c
|
|
| BLAKE2b-256 |
02aaf929bcbe17f5df73a2615aa375b0693bac5db0951215d72379a5cbd30b64
|
File details
Details for the file technical_analysis_mcp-0.1.9-py3-none-any.whl.
File metadata
- Download URL: technical_analysis_mcp-0.1.9-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
11f104c739ad51d1f7e8f3919a98dd654214bb7db260c08536d93a5fa237e647
|
|
| MD5 |
47a9bacb70c5b81b655cd409331e6e13
|
|
| BLAKE2b-256 |
30ecabd13a542f0df3f19b9acd342ea9803807c527fd669e8e53a7f11de97332
|