Deprecated: Function get_magic_quotes_gpc() is deprecated in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 99

Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 619

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1169

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176

Warning: Cannot modify header information - headers already sent by (output started at /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php:99) in /hermes/walnacweb04/walnacweb04ab/b2791/pow.jasaeld/htdocs/De1337/nothing/index.php on line 1176
8000 Claude/quant system architecture 011 cu kqu6ma7m t suf vz vd5 zy by weiben1989 · Pull Request #6642 · akfamily/akshare · GitHub
Nothing Special   »   [go: up one dir, main page]

Skip to content

Conversation

weiben1989
Copy link

No description provided.

claude added 11 commits October 21, 2025 06:19
基于周期理论的量化投资系统,融合周金涛周期嵌套理论和霍华德·马克斯钟摆理论。

主要功能:
- 周期识别引擎:基钦周期、朱格拉周期、市场情绪分析
- 数据获取层:AKShare API封装
- 配置管理:灵活的配置系统
- 工具模块:数据处理、日志管理、绩效计算
- 主程序:生成每日市场分析报告
- 示例程序:详细的使用示例

系统特色:
1. 三层周期嵌套分析(朱格拉、基钦、情绪)
2. 动态行业轮动建议
3. 多维度市场情绪量化
4. 智能仓位管理建议

模块结构:
- data/: 数据获取和存储
- analysis/cycle/: 周期分析引擎
- strategy/: 策略模块(规划中)
- risk/: 风控模块(规划中)
- backtest/: 回测引擎(规划中)
- config/: 系统配置
- utils/: 工具函数

文档:
- README.md: 系统介绍和使用指南
- INSTALL.md: 安装说明
- examples/basic_usage.py: 详细示例

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
为零基础用户提供详细的安装和使用指南

新增文件:
- 新手使用指南.md: 超详细的零基础教程
  - 环境准备和Python安装
  - 代码下载和依赖安装
  - 测试运行步骤
  - 常见问题排查
  - 云服务器部署指南(可选)

- test_simple.py: 快速测试脚本
  - 6个测试步骤
  - 清晰的成功/失败提示
  - 详细的错误信息
  - 一键验证系统是否正常

适用人群:
- Python初学者
- 量化投资新手
- 不熟悉命令行的用户

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
为Mac用户打造完整的使用体验,包括Web界面、数据缓存和一键启动

新增功能:

1. 📊 Web可视化界面 (web_app.py)
   - 使用Streamlit构建交互式Dashboard
   - 实时显示市场周期分析
   - 可视化图表(周期趋势、情绪温度、行业轮动)
   - 投资建议和关键要点展示
   - 一键下载报告

2. 💾 数据下载和缓存 (scripts/download_data.py)
   - 一次性下载历史数据(宏观、市场、行业、估值、资金)
   - 本地缓存,避免重复下载
   - 数据新鲜度检查
   - 支持自定义下载年限

3. 🚀 一键启动脚本 (start.sh)
   - Mac/Linux友好的交互式菜单
   - 6种启动模式(测试/报告/Web/下载/示例/全部)
   - 自动环境检查
   - 彩色界面提示

4. 📖 Mac用户指南
   - Mac一步步操作指南.md:超详细的Mac专属教程
   - 快速开始.md:5分钟快速上手
   - 每一步都有具体命令,可直接复制粘贴

5. 📦 依赖更新
   - requirements.txt 添加 streamlit
   - 支持国内镜像加速安装

特色:
- ✅ 傻瓜式操作,零基础可用
- ✅ Web界面美观,支持实时刷新
- ✅ 数据缓存,大幅提升速度
- ✅ 一键启动,省去手动输入命令
- ✅ Mac适配,完美支持macOS

使用方法:
```bash
# 安装依赖
pip3 install -r requirements.txt

# 方法1:一键启动(推荐)
./start.sh

# 方法2:直接启动Web
streamlit run web_app.py

# 方法3:下载历史数据
python3 scripts/download_data.py
```

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
解决ImportError: attempted relative import beyond top-level package

修改内容:
- 将所有相对导入改为绝对导入
- 在每个模块添加项目根目录到sys.path
- 确保可以作为独立脚本运行

修改文件:
- data/fetcher/akshare_api.py
- analysis/cycle/kitchin.py
- analysis/cycle/juglar.py
- analysis/cycle/marks_pendulum.py

现在可以正常运行:
- python3 main.py
- streamlit run web_app.py
- python3 scripts/download_data.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
新增内容:
- 数据说明.md: 详细说明当前使用模拟数据的原因和如何切换到真实数据
- data/data_loader.py: 统一数据加载接口,支持缓存和降级
- strategy/allocation/all_weather.py: 桥水全天候策略实现

说明:
- 系统当前使用模拟数据用于演示
- 运行 python3 scripts/download_data.py 可下载真实数据
- 下载后会自动使用缓存的真实数据

下一步:
- 完善真实数据下载和集成
- 创建Apple风格的Web界面
- 展示详细分析过程

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
详细记录了用户的所有需求和实现计划:
- 使用真实数据(从akshare下载)
- Apple风格Web界面
- 展示斯文森和全天候策略
- 详细分析过程展示
- 数据更新按钮

下次会话将实现:
1. 改进的真实数据下载器
2. Apple风格新界面(web_app_v2.py)
3. 完整的斯文森策略
4. 详细分析页面
5. 数据管理功能

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
## 🎉 重大更新

### 1. 真实数据集成 ✅
- 替换所有模拟数据为真实AKShare数据
- 基钦周期:使用真实PMI数据计算需求和库存增速
- 朱格拉周期:使用真实GDP、PPI、M2数据
- 马克斯钟摆:使用真实M2数据计算流动性
- 数据缓存机制:刷新页面数据不再变化

### 2. 斯文森策略完整实现 🎓
- 新增 strategy/allocation/swensen.py
- 耶鲁捐赠基金资产配置模型
- 三种风险等级:保守型、稳健型、激进型
- 智能再平衡建议和优先级判断
- 中国市场产品实施指南
- 投资哲学和历史业绩展示

### 3. Apple风格Web界面 🍎
- 新增 web_app_v2.py
- 纯白背景、大字体、充足留白
- 卡片式布局、渐变色、柔和阴影
- 详细分析过程展示(不只给结论)
- 数据来源透明标注
- 四大功能页面:市场概览、周期分析、资产配置、数据管理

### 4. 数据更新功能 🔄
- Web界面一键更新数据按钮
- 数据状态实时监控
- 缓存新鲜度检查
- 自动降级到模拟数据

## 📝 文件变更

### 新增文件
- web_app_v2.py - Apple风格Web界面
- strategy/allocation/swensen.py - 斯文森策略
- 使用说明_V2.md - 完整使用指南

### 修改文件
- analysis/cycle/kitchin.py - 集成真实PMI数据
- analysis/cycle/juglar.py - 集成真实GDP/PPI/M2数据
- analysis/cycle/marks_pendulum.py - 集成真实M2数据

## 🎯 解决的问题
- ❌ 数据每次刷新都变化 → ✅ 使用缓存的真实数据
- ❌ 缺少斯文森策略 → ✅ 完整实现并展示
- ❌ 界面简陋 → ✅ Apple风格精美界面
- ❌ 只给结论 → ✅ 展示详细分析过程
- ❌ 数据来源不透明 → ✅ 标注所有数据来源

## 🚀 使用方法
streamlit run web_app_v2.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
## 🐛 问题修复

1. **KeyError: 'kitchin_timing'**
   - 修复:直接调用 quant.kitchin_cycle.get_timing_signal()
   - 原因:analyze_market_cycle() 不返回 timing 和 rotation 数据

2. **白色字体问题**
   - 所有文字颜色改为 #1d1d1f (深灰)
   - 确保在白色背景上可读

## ✨ 重大改进

### 1. 市场概览页面 - 新增A股复盘功能
- ✅ 新增"今日市场复盘"标题和日期
- ✅ 显示4大指数(上证、深证、创业板、沪深300)
- ✅ 显示涨跌家数统计(上涨/下跌/平盘/涨停/跌停)
- ✅ 显示成交金额统计(沪市/深市/两市合计)
- ✅ 相当于每日盘后复盘工具

### 2. 周期分析页面 - 展示数据而非代码
**基钦周期**
- 左侧:📊 原始数据(PMI新订单、PMI库存、PPI环比)
- 右侧:🧮 计算过程(步骤1/2/3、四象限判断、周期信息)
- 展示实际数值和计算逻辑,不展示代码

**朱格拉周期**
- 左侧:📊 原始数据(产能利用率、投资增速、PPI、M2、ROE)
- 右侧:🧮 综合判断(五维度评分、判断逻辑、周期信息)
- 展示每个指标的实际值

**市场情绪**
- 左侧:雷达图 + 情绪温度
- 右侧:四维度得分明细(估值/情绪/流动性/宽度)
- 展示计算公式和结果

### 3. 用户体验改进
- ❌ 移除所有代码展示
- ✅ 展示原始数据、中间计算、最终结论
- ✅ 数据来源透明标注
- ✅ 符合"复盘工具"定位

## 📊 界面结构

### 市场概览页
```
今日市场复盘 (2025年X月X日)
├── A股市场数据
│   ├── 上证指数 / 深证成指 / 创业板指 / 沪深300
│   └── 涨跌幅、涨跌点数
├── 市场统计
│   ├── 涨跌家数统计(上涨/下跌/平盘/涨停/跌停)
│   └── 成交金额统计(沪市/深市/两市合计)
├── 三大周期状态
└── 投资建议 + 行业配置
```

### 周期分析页
```
基钦周期
├── 原始数据(PMI新订单、库存、PPI)
└── 计算过程(步骤化展示)

朱格拉周期
├── 原始数据(5个指标)
└── 综合判断(评分 + 逻辑)

市场情绪
├── 雷达图
└── 四维度明细
```

## 🎯 解决的用户反馈
- ✅ 修复 KeyError
- ✅ 修复白色字体看不见问题
- ✅ 不展示代码,展示数据
- ✅ 新增A股市场数据(复盘功能)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
详细说明所有修复的问题和新功能

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
## 🎉 新增模块:review_engine

按照详细PRD实现A股日度复盘引擎,当前完成基础架构(30%)

### ✅ 已完成

#### 1. 项目架构
- 模块化设计:providers/core/reporting/integrations
- 完整目录结构
- 数据持久化设计(SQLite + Parquet)

#### 2. 配置系统
- **config.yaml**:
  - 多周期窗口(5/10/30)
  - 四维评分权重(Macro/Liquidity/Risk-on/Momentum)
  - 资产配置规则(4个分段)
  - ETF分组配置(5个bucket)
  - 行业轮动矩阵配置
  - 数据校验配置

- **.env.example**:
  - DeepSeek API配置
  - AkShare超时与重试
  - 网络代理

#### 3. 数据层(providers/akshare_provider.py)
- **AkShareProvider类**:
  - ✅ 严禁虚拟数据(PRD硬性要求)
  - ✅ 数据校验机制(字段、空值、单位)
  - ✅ 错误处理与重试(指数退避)
  - ✅ SQLite持久化(9张表)
  - ✅ 幂等upsert

- **已实现接口**:
  - ✅ 指数数据(上证/深成/创业板/沪深300)
  - ✅ 成交额计算
  - ✅ 市场广度(涨跌家数、涨跌停、连板高度)
  - ✅ 北向资金

- **待实现接口**(下次会话):
  - 🚧 ETF流向(5个分组)
  - 🚧 融资融券余额
  - 🚧 行业数据聚合
  - 🚧 宏观数据(PMI/PPI/大宗商品)
  - 🚧 Parquet持久化
  - 🚧 连板持续率

#### 4. 文档
- **README.md**:完整的项目说明、已完成/待完成清单
- **下次会话任务.md**:详细的实施计划与代码示例

### 🚧 待实现(下次会话优先级)

1. **完善数据接口**(优先级1)
   - ETF流向
   - 融资融券
   - 行业聚合
   - 宏观数据

2. **因子计算**(优先级2)
   - core/factors.py
   - 多周期EMA/斜率/z-score
   - 趋势标签

3. **评分系统**(优先级3)
   - core/scoring.py
   - 四维评分逻辑

4. **配置决策**(优先级4)
   - core/allocation.py
   - 行业轮动矩阵
   - 仓位/风格映射

5. **报告生成**(优先级5)
   - reporting/renderer.py
   - Markdown + JSON
   - 三段式收束

6. **主程序**(优先级6)
   - run_daily.py
   - 完整流程编排

7. **验收测试**(优先级7)
   - tests/test_pipeline.py

### 📊 设计亮点

1. **数据真实性保障**
   - 所有数据必须来自AkShare
   - 数据校验:字段完整性、空值容忍度
   - 失败可追溯:清晰错误信息

2. **多周期趋势**
   - 5/10/30日窗口
   - EMA + 线性斜率 + z-score
   - 趋势标签(共振上行/分化震荡等)

3. **四维评分体系**
   - Macro(25%): 基钦周期+PPI+大宗
   - Liquidity(35%): 成交额+北向+ETF+融资
   - Risk-on(20%): 连板+涨跌停比+持续率
   - Momentum(20%): 指数动量+量能趋势

4. **行业轮动矩阵**
   - 强度 = 收益分位 × 0.6 + 净流分位 × 0.4
   - 拥挤度 = 换手分位 × 0.6 + 涨停分位 × 0.4
   - 四象限:首选/追高/潜伏/回避

5. **配置化设计**
   - 权重可调
   - 规则可扩展
   - 开关控制(金融占星/DeepSeek)

### 📁 目录结构

```
review_engine/
├── config/
│   ├── config.yaml          ✅ 完整配置
│   └── .env.example         ✅ 环境变量
├── providers/
│   └── akshare_provider.py  ✅ 数据提供者(基础)
├── core/                    🚧 待实现
│   ├── factors.py
│   ├── scoring.py
│   └── allocation.py
├── reporting/               🚧 待实现
│   └── renderer.py
├── integrations/            🚧 待实现
│   └── deepseek.py
├── data/
│   ├── review.sqlite        ✅ 数据库设计
│   └── parquet/
├── README.md                ✅ 项目说明
└── 下次会话任务.md          ✅ 实施计划
```

### 🎯 当前进度

- ✅ 架构设计(100%)
- ✅ 配置系统(100%)
- ✅ 数据层基础(40%)
- 🚧 因子计算(0%)
- 🚧 评分系统(0%)
- 🚧 配置决策(0%)
- 🚧 报告生成(0%)
- 🚧 主程序(0%)

**总体进度:30%**

下次会话将继续完成核心计算模块,目标达到70%以上。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
详细说明当前进度(30%)和下一步计划

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0