Files
finance-talk/AGENTS.md
T

35 lines
1.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AGENTS.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
AI 协助分析交易数据和回测的仓库。主要用来做策略回测、行情分析、期权定价、资产配置等量化相关操作。
## Python 执行环境
**仅允许使用 Docker 运行 Python**,严禁使用设备本地 Python
- **⚠️ 严禁直接 `docker run python:3.11-slim`**,必须先执行 `docker images` 确认本地已有镜像,优先复用
- 无可用镜像时才允许拉取,默认拉取 `python:3.11-slim`
- 示例: `docker images | grep python` 查看已有镜像,再用已有镜像执行
## Data Sources
按优先级排序:
1. **Tushare Pro** — 优先使用,数据最全(股票、期货、指数、期权等)
- Token: `76efd8465f9f2591aa42a385268e06acf6b80b7a15be2267ad2281b7`
- 用法: `import tushare as ts; ts.set_token('...'); pro = ts.pro_api()`
2. **akshare** — 备选,无需 token,覆盖面广
- A股指数: `ak.stock_zh_index_daily(symbol="sh000300")`
- 全球指数: `ak.index_global_hist_em(symbol="纳斯达克")`
- 个股: `ak.stock_zh_a_hist(symbol="600030", adjust="qfq")`
- 期货主连: `ak.futures_main_sina(symbol="FG0")`
3. **yfinance** — 海外市场(注意频次限制,需加 sleep)
## Conventions
- 期货主连代码格式: `FG0` (品种代码 + "0")
- A股个股复权方式: 前复权 (`adjust="qfq"`)