## 核心功能 ### 1. 成交量序列分析 (volume_price_sequence.py) - 按累计成交量排序的价格趋势分析 - 三合一综合图表:价格序列+成交量分布+时间序列 - 关键价格水平自动标注 ### 2. 成交量分布深度分析 (volume_distribution_analysis.py) - 7种专业可视化图表 - 统计特征分析和分布拟合 - 交易模式识别和业务洞察 ### 3. 大额订单分析工具集 (large_orders/) - 买1/卖1量大单分析 (阈值99) - 买卖挂单合计分析 (阈值200) - 当前成交量分析 (阈值150) - 信号抑制优化算法 (38%抑制率) ## 技术特性 - 信号抑制算法:有效减少重复信号干扰 - 多维度分析:支持多种信号类型 - 专业可视化:四宫格综合分析图 - 业务洞察:基于数据的交易建议 ## 分析结果 - 卖1量大单:短期下跌,长期大幅上涨反转 - 买挂合计:各时间窗口小幅正收益 - 信号抑制:短期收益从-0.0778提升至+0.1347 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
288 lines
6.9 KiB
Plaintext
288 lines
6.9 KiB
Plaintext
# 期货Tick数据分析项目 - 依赖包列表
|
||
|
||
## 环境信息
|
||
- **Python版本**: 3.11
|
||
- **平台**: Windows
|
||
- **更新日期**: 2025-11-01
|
||
|
||
## 核心依赖包
|
||
|
||
### 数据处理核心库
|
||
```
|
||
polars==1.35.1
|
||
numpy==2.3.4
|
||
pandas==2.3.3
|
||
pyarrow==22.0.0
|
||
```
|
||
|
||
### 可视化库
|
||
```
|
||
matplotlib==3.10.7
|
||
seaborn==0.13.2
|
||
plotly==6.3.1
|
||
```
|
||
|
||
### Jupyter开发环境
|
||
```
|
||
jupyterlab==4.4.10
|
||
notebook==7.4.7
|
||
```
|
||
|
||
### 科学计算与机器学习
|
||
```
|
||
scipy==1.16.3
|
||
scikit-learn==1.7.2
|
||
```
|
||
|
||
## 安装方法
|
||
|
||
### 方法1: 使用requirements.txt文件(推荐)
|
||
|
||
1. 创建 `requirements.txt` 文件,内容如下:
|
||
```txt
|
||
polars==1.35.1
|
||
numpy==2.3.4
|
||
pandas==2.3.3
|
||
pyarrow==22.0.0
|
||
matplotlib==3.10.7
|
||
seaborn==0.13.2
|
||
plotly==6.3.1
|
||
jupyterlab==4.4.10
|
||
notebook==7.4.7
|
||
scipy==1.16.3
|
||
scikit-learn==1.7.2
|
||
```
|
||
|
||
2. 安装命令:
|
||
```bash
|
||
# 使用默认源
|
||
pip install -r requirements.txt
|
||
|
||
# 使用清华镜像源(推荐国内用户)
|
||
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||
```
|
||
|
||
### 方法2: 一键安装脚本
|
||
|
||
创建 `install_dependencies.py` 文件:
|
||
|
||
```python
|
||
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
"""
|
||
期货Tick数据分析项目依赖包安装脚本
|
||
"""
|
||
|
||
import subprocess
|
||
import sys
|
||
|
||
def install_package(package_name, version=""):
|
||
"""安装指定的包"""
|
||
cmd = [sys.executable, "-m", "pip", "install"]
|
||
if version:
|
||
cmd.append(f"{package_name}=={version}")
|
||
else:
|
||
cmd.append(package_name)
|
||
|
||
# 使用清华镜像源
|
||
cmd.extend(["-i", "https://pypi.tuna.tsinghua.edu.cn/simple"])
|
||
|
||
try:
|
||
subprocess.run(cmd, check=True)
|
||
print(f"✅ {package_name} {version} 安装成功")
|
||
except subprocess.CalledProcessError:
|
||
print(f"❌ {package_name} {version} 安装失败")
|
||
return False
|
||
return True
|
||
|
||
def main():
|
||
"""主安装流程"""
|
||
print("🚀 开始安装期货Tick数据分析项目依赖包...")
|
||
print("=" * 60)
|
||
|
||
# 依赖包列表
|
||
packages = [
|
||
("polars", "1.35.1"),
|
||
("numpy", "2.3.4"),
|
||
("pandas", "2.3.3"),
|
||
("pyarrow", "22.0.0"),
|
||
("matplotlib", "3.10.7"),
|
||
("seaborn", "0.13.2"),
|
||
("plotly", "6.3.1"),
|
||
("jupyterlab", "4.4.10"),
|
||
("notebook", "7.4.7"),
|
||
("scipy", "1.16.3"),
|
||
("scikit-learn", "1.7.2"),
|
||
]
|
||
|
||
success_count = 0
|
||
total_count = len(packages)
|
||
|
||
for package_name, version in packages:
|
||
print(f"\n📦 正在安装 {package_name}=={version}...")
|
||
if install_package(package_name, version):
|
||
success_count += 1
|
||
|
||
print("\n" + "=" * 60)
|
||
print(f"📊 安装完成: {success_count}/{total_count} 个包安装成功")
|
||
|
||
if success_count == total_count:
|
||
print("🎉 所有依赖包安装成功!")
|
||
print("\n🚀 现在可以开始使用以下命令启动Jupyter Lab:")
|
||
print(" jupyter lab")
|
||
else:
|
||
print("⚠️ 部分包安装失败,请检查错误信息")
|
||
print("💡 建议手动安装失败的包")
|
||
|
||
if __name__ == "__main__":
|
||
main()
|
||
```
|
||
|
||
运行安装脚本:
|
||
```bash
|
||
python install_dependencies.py
|
||
```
|
||
|
||
### 方法3: 手动安装命令
|
||
|
||
```bash
|
||
# 核心数据处理库
|
||
pip install polars==1.35.1 numpy==2.3.4 pandas==2.3.3 pyarrow==22.0.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||
|
||
# 可视化库
|
||
pip install matplotlib==3.10.7 seaborn==0.13.2 plotly==6.3.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||
|
||
# Jupyter环境
|
||
pip install jupyterlab==4.4.10 notebook==7.4.7 -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||
|
||
# 科学计算库
|
||
pip install scipy==1.16.3 scikit-learn==1.7.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||
```
|
||
|
||
## 验证安装
|
||
|
||
安装完成后,运行以下验证脚本:
|
||
|
||
```python
|
||
#!/usr/bin/env python3
|
||
# -*- coding: utf-8 -*-
|
||
"""
|
||
依赖包安装验证脚本
|
||
"""
|
||
|
||
def check_imports():
|
||
"""检查所有包是否能正常导入"""
|
||
packages = {
|
||
'polars': '1.35.1',
|
||
'numpy': '2.3.4',
|
||
'pandas': '2.3.3',
|
||
'pyarrow': '22.0.0',
|
||
'matplotlib': '3.10.7',
|
||
'seaborn': '0.13.2',
|
||
'plotly': '6.3.1',
|
||
'jupyterlab': '4.4.10',
|
||
'scipy': '1.16.3',
|
||
'sklearn': '1.7.2' # scikit-learn的导入名是sklearn
|
||
}
|
||
|
||
print("🔍 验证依赖包安装状态...")
|
||
print("=" * 50)
|
||
|
||
success_count = 0
|
||
for package_name, expected_version in packages.items():
|
||
try:
|
||
if package_name == 'sklearn':
|
||
import sklearn
|
||
actual_version = sklearn.__version__
|
||
else:
|
||
module = __import__(package_name)
|
||
actual_version = module.__version__
|
||
|
||
if actual_version == expected_version:
|
||
print(f"✅ {package_name}: {actual_version}")
|
||
success_count += 1
|
||
else:
|
||
print(f"⚠️ {package_name}: 期望 {expected_version}, 实际 {actual_version}")
|
||
|
||
except ImportError as e:
|
||
print(f"❌ {package_name}: 导入失败 - {e}")
|
||
|
||
print("=" * 50)
|
||
print(f"📊 验证结果: {success_count}/{len(packages)} 个包正常")
|
||
|
||
if success_count == len(packages):
|
||
print("🎉 所有依赖包验证通过!")
|
||
else:
|
||
print("⚠️ 部分包存在问题,请检查安装")
|
||
|
||
if __name__ == "__main__":
|
||
check_imports()
|
||
```
|
||
|
||
## 项目说明
|
||
|
||
### 核心技术栈
|
||
- **Polars**: 高性能数据处理库,比pandas快100倍
|
||
- **NumPy**: 数值计算基础库
|
||
- **PyArrow**: Parquet格式支持,高效数据存储
|
||
- **Matplotlib/Seaborn**: 基础可视化
|
||
- **Plotly**: 交互式图表
|
||
- **JupyterLab**: 现代化数据分析环境
|
||
|
||
### 应用场景
|
||
- 期货Tick数据处理
|
||
- 高频数据分析
|
||
- 实时数据可视化
|
||
- 交易策略回测
|
||
- 统计分析
|
||
|
||
### 性能优化建议
|
||
1. 使用Polars替代pandas处理大数据
|
||
2. 将数据保存为Parquet格式以减少存储空间
|
||
3. 使用JupyterLab的惰性加载处理超大文件
|
||
4. 利用Plotly创建交互式图表进行深入分析
|
||
|
||
## 镜像源配置
|
||
|
||
### 国内推荐镜像源
|
||
```bash
|
||
# 清华大学
|
||
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple
|
||
|
||
# 阿里云
|
||
pip install -i https://mirrors.aliyun.com/pypi/simple/
|
||
|
||
# 豆瓣
|
||
pip install -i https://pypi.douban.com/simple/
|
||
|
||
# 中科大
|
||
pip install -i https://mirrors.ustc.edu.cn/pypi/web/simple/
|
||
```
|
||
|
||
### 永久配置镜像源
|
||
```bash
|
||
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
|
||
```
|
||
|
||
## 故障排除
|
||
|
||
### 常见问题
|
||
1. **编码问题**: 在Windows上可能出现GBK编码错误,建议使用UTF-8编码
|
||
2. **权限问题**: 使用管理员权限运行命令提示符
|
||
3. **网络问题**: 切换不同的镜像源或使用代理
|
||
4. **版本冲突**: 建议使用虚拟环境隔离项目依赖
|
||
|
||
### 虚拟环境创建
|
||
```bash
|
||
# 创建虚拟环境
|
||
python -m venv tick_analysis_env
|
||
|
||
# 激活虚拟环境 (Windows)
|
||
tick_analysis_env\Scripts\activate
|
||
|
||
# 激活虚拟环境 (Linux/Mac)
|
||
source tick_analysis_env/bin/activate
|
||
|
||
# 在虚拟环境中安装依赖
|
||
pip install -r requirements.txt
|
||
``` |