quantcli 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- quantcli-0.1.2/LICENSE +21 -0
- quantcli-0.1.2/PKG-INFO +199 -0
- quantcli-0.1.2/README.md +170 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/pyproject.toml +4 -3
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/cli.py +538 -77
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/core/backtest.py +393 -1
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/datasources/__init__.py +16 -5
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/datasources/base.py +1 -0
- quantcli-0.1.2/quantcli/datasources/mysql.py +654 -0
- quantcli-0.1.2/quantcli/datasources/sync/__init__.py +14 -0
- quantcli-0.1.2/quantcli/datasources/sync/akshare.py +404 -0
- quantcli-0.1.2/quantcli/datasources/sync/base.py +179 -0
- quantcli-0.1.2/quantcli/datasources/sync/gm.py +510 -0
- quantcli-0.1.2/quantcli/factors/base.py +366 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/factors/loader.py +19 -3
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/parser/constants.py +7 -2
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/parser/formula.py +96 -2
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/utils/__init__.py +2 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/utils/path.py +25 -0
- quantcli-0.1.2/quantcli.egg-info/PKG-INFO +199 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli.egg-info/SOURCES.txt +7 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli.egg-info/requires.txt +1 -0
- quantcli-0.1.2/tests/test_builtin_factors.py +799 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/tests/test_cli.py +14 -31
- {quantcli-0.1.0 → quantcli-0.1.2}/tests/test_factors.py +166 -0
- quantcli-0.1.0/PKG-INFO +0 -79
- quantcli-0.1.0/README.md +0 -53
- quantcli-0.1.0/quantcli/factors/base.py +0 -163
- quantcli-0.1.0/quantcli.egg-info/PKG-INFO +0 -79
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/core/__init__.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/core/data.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/core/factor.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/datasources/akshare.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/datasources/baostock.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/datasources/cache.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/datasources/mixed.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/factors/__init__.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/factors/compute.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/factors/pipeline.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/factors/ranking.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/factors/screening.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/parser/__init__.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/utils/logger.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/utils/time.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli/utils/validate.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli.egg-info/dependency_links.txt +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli.egg-info/entry_points.txt +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/quantcli.egg-info/top_level.txt +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/setup.cfg +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/tests/test_akshare_integration.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/tests/test_datasources.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/tests/test_mixed_datasource.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/tests/test_multi_factor.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/tests/test_pipeline_integration.py +0 -0
- {quantcli-0.1.0 → quantcli-0.1.2}/tests/test_time.py +0 -0
quantcli-0.1.2/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [year] [fullname]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
quantcli-0.1.2/PKG-INFO
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: quantcli
|
|
3
|
+
Version: 0.1.2
|
|
4
|
+
Summary: 面向AI的多因子量化选股策略挖掘工具,AI Agent 友好 CLI
|
|
5
|
+
Author-email: QuantCLI Team <quantcli@example.com>
|
|
6
|
+
Project-URL: repository, https://github.com/wumu2013/quantcli
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Requires-Python: >=3.9
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: click>=8.0
|
|
18
|
+
Requires-Dist: pandas>=2.0
|
|
19
|
+
Requires-Dist: numpy>=1.24
|
|
20
|
+
Requires-Dist: pyarrow>=12.0
|
|
21
|
+
Requires-Dist: backtrader>=1.9
|
|
22
|
+
Requires-Dist: tabulate>=0.9
|
|
23
|
+
Requires-Dist: pyyaml>=6.0
|
|
24
|
+
Requires-Dist: pymysql>=1.1
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# QuantCLI
|
|
31
|
+
|
|
32
|
+
**QuantCLI** 是一款专注于**多因子选股**的命令行工具,为个人量化研究者提供轻量、高效、可复现的研究环境。
|
|
33
|
+
|
|
34
|
+
**AI Agent 友好**: QuantCLI 专为 AI Agent 优化,支持结构化输出、幂等性设计和 Skill 集成。
|
|
35
|
+
|
|
36
|
+
## 核心功能
|
|
37
|
+
|
|
38
|
+
- **多因子筛选**: 多阶段因子筛选、权重融合、条件过滤、加分项评分
|
|
39
|
+
- **因子计算**: 40+ 内置函数,支持表达式解析
|
|
40
|
+
- **IC/IR 分析**: 因子有效性评估,批量扫描高有效性因子
|
|
41
|
+
- **回测引擎**: 基于 Backtrader,支持单股票/多因子回测
|
|
42
|
+
- **多数据源**: AKShare、Baostock、MySQL
|
|
43
|
+
- **AI 友好**: JSON 输出、Skill 集成、Claude Code 支持
|
|
44
|
+
- **内置因子库**: 40 个 Alpha101 因子,即点即用
|
|
45
|
+
|
|
46
|
+
## 安装
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install quantcli
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## 快速开始
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# 查看帮助
|
|
56
|
+
quantcli --help
|
|
57
|
+
|
|
58
|
+
# 多因子筛选 (推荐)
|
|
59
|
+
quantcli filter run -f examples/strategies/pe_roe_ma10.yaml --top 30
|
|
60
|
+
|
|
61
|
+
# 查看所有内置因子
|
|
62
|
+
quantcli factors list
|
|
63
|
+
|
|
64
|
+
# IC/IR 因子有效性分析
|
|
65
|
+
quantcli analyze ic -e "(close / delay(close, 20)) - 1" -n "20日动量" --json
|
|
66
|
+
|
|
67
|
+
# 批量分析因子库
|
|
68
|
+
quantcli analyze batch -d examples/alpha101/alpha/ --top 10
|
|
69
|
+
|
|
70
|
+
# 获取数据
|
|
71
|
+
quantcli data fetch 600519 --start 2020-01-01 --end 2024-01-01
|
|
72
|
+
|
|
73
|
+
# 运行因子
|
|
74
|
+
quantcli factor run -n momentum -e "(close / delay(close, 20)) - 1"
|
|
75
|
+
|
|
76
|
+
# 回测策略
|
|
77
|
+
quantcli backtest run -s ma_cross --start 2020-01-01
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## AI Agent 使用
|
|
81
|
+
|
|
82
|
+
### JSON 输出模式
|
|
83
|
+
|
|
84
|
+
所有命令支持 `--json` 参数,以机器可解析的格式输出:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# IC/IR 分析
|
|
88
|
+
quantcli analyze ic -e "(close/delay(close,20))-1" --json
|
|
89
|
+
# {"status": "success", "ic_mean": 0.0285, "ir": 0.47, ...}
|
|
90
|
+
|
|
91
|
+
# 批量因子分析
|
|
92
|
+
quantcli analyze batch -d examples/alpha101/alpha/ --json
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### IC/IR 评估标准
|
|
96
|
+
|
|
97
|
+
| 指标 | 含义 | 阈值 |
|
|
98
|
+
|------|------|------|
|
|
99
|
+
| **IC** | 因子与未来收益的秩相关 | \|IC\| > 0.05 有效 |
|
|
100
|
+
| **IR** | IC 均值/标准差(年化) | IR > 0.5 稳定 |
|
|
101
|
+
|
|
102
|
+
### Alpha101 内置因子库
|
|
103
|
+
|
|
104
|
+
内置 **40 个 WorldQuant Alpha101 因子**,可直接引用:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# 查看所有内置因子
|
|
108
|
+
quantcli factors list
|
|
109
|
+
|
|
110
|
+
# 运行 Alpha101 复合策略
|
|
111
|
+
quantcli filter run -f examples/alpha101/alpha101_composite.yaml --top 30
|
|
112
|
+
|
|
113
|
+
# 批量分析因子有效性
|
|
114
|
+
quantcli analyze batch -d examples/alpha101/alpha/ --top 10
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**使用内置因子:**
|
|
118
|
+
```yaml
|
|
119
|
+
factors:
|
|
120
|
+
- alpha101/alpha_001 # 20日创新高后转跌
|
|
121
|
+
- alpha101/alpha_008 # 资金流入
|
|
122
|
+
- alpha101/alpha_029 # 5日动量
|
|
123
|
+
|
|
124
|
+
ranking:
|
|
125
|
+
weights:
|
|
126
|
+
alpha101/alpha_001: 0.4
|
|
127
|
+
alpha101/alpha_008: 0.3
|
|
128
|
+
alpha101/alpha_029: 0.3
|
|
129
|
+
normalize: zscore
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Claude Code Skill
|
|
133
|
+
|
|
134
|
+
```markdown
|
|
135
|
+
/skill multi-factor-strategy --goal "低估+高ROE" --output strategy.yaml
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## 多因子筛选示例
|
|
139
|
+
|
|
140
|
+
创建策略文件 `strategy.yaml`:
|
|
141
|
+
|
|
142
|
+
```yaml
|
|
143
|
+
name: PE-ROE-MA10 选股策略
|
|
144
|
+
version: 1.0.0
|
|
145
|
+
|
|
146
|
+
screening:
|
|
147
|
+
fundamental_conditions:
|
|
148
|
+
- "pe_ttm < 20"
|
|
149
|
+
- "pe_ttm > 0"
|
|
150
|
+
- "roe > 0.1"
|
|
151
|
+
daily_conditions:
|
|
152
|
+
- "close > ma10"
|
|
153
|
+
|
|
154
|
+
ranking:
|
|
155
|
+
weights:
|
|
156
|
+
pe_ttm: -0.3 # 负权重: 低估值
|
|
157
|
+
roe: 0.5 # 正权重: 高ROE
|
|
158
|
+
ma10_deviation: 0.2
|
|
159
|
+
normalize: zscore
|
|
160
|
+
|
|
161
|
+
output:
|
|
162
|
+
limit: 50
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
运行筛选:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
quantcli filter run -f strategy.yaml --top 50
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## 命令
|
|
172
|
+
|
|
173
|
+
| 命令 | 功能 |
|
|
174
|
+
|------|------|
|
|
175
|
+
| `quantcli analyze` | IC/IR 因子有效性分析 |
|
|
176
|
+
| `quantcli filter` | 多因子筛选 |
|
|
177
|
+
| `quantcli factor` | 因子计算与评估 |
|
|
178
|
+
| `quantcli factors` | 内置因子管理 |
|
|
179
|
+
| `quantcli data` | 数据获取与管理 |
|
|
180
|
+
| `quantcli backtest` | 回测引擎 |
|
|
181
|
+
| `quantcli config` | 配置管理 |
|
|
182
|
+
|
|
183
|
+
## AI Skill
|
|
184
|
+
|
|
185
|
+
`multi-factor-strategy` skill 用于**引导创建多因子选股策略**,生成可独立运行的 YAML 配置文件。
|
|
186
|
+
|
|
187
|
+
**目的**: 将因子研究、回测验证、策略执行整合为标准化流程,通过 YAML 配置实现:
|
|
188
|
+
- 多阶段筛选 (基本面 → 技术面 → 因子评分)
|
|
189
|
+
- 权重融合与条件过滤
|
|
190
|
+
- 策略可复现、可版本控制
|
|
191
|
+
- AI Agent 可直接调用
|
|
192
|
+
|
|
193
|
+
## 文档
|
|
194
|
+
|
|
195
|
+
详见 [docs/cli_guide.md](docs/cli_guide.md)
|
|
196
|
+
|
|
197
|
+
## 许可证
|
|
198
|
+
|
|
199
|
+
MIT License
|
quantcli-0.1.2/README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# QuantCLI
|
|
2
|
+
|
|
3
|
+
**QuantCLI** 是一款专注于**多因子选股**的命令行工具,为个人量化研究者提供轻量、高效、可复现的研究环境。
|
|
4
|
+
|
|
5
|
+
**AI Agent 友好**: QuantCLI 专为 AI Agent 优化,支持结构化输出、幂等性设计和 Skill 集成。
|
|
6
|
+
|
|
7
|
+
## 核心功能
|
|
8
|
+
|
|
9
|
+
- **多因子筛选**: 多阶段因子筛选、权重融合、条件过滤、加分项评分
|
|
10
|
+
- **因子计算**: 40+ 内置函数,支持表达式解析
|
|
11
|
+
- **IC/IR 分析**: 因子有效性评估,批量扫描高有效性因子
|
|
12
|
+
- **回测引擎**: 基于 Backtrader,支持单股票/多因子回测
|
|
13
|
+
- **多数据源**: AKShare、Baostock、MySQL
|
|
14
|
+
- **AI 友好**: JSON 输出、Skill 集成、Claude Code 支持
|
|
15
|
+
- **内置因子库**: 40 个 Alpha101 因子,即点即用
|
|
16
|
+
|
|
17
|
+
## 安装
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pip install quantcli
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 快速开始
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# 查看帮助
|
|
27
|
+
quantcli --help
|
|
28
|
+
|
|
29
|
+
# 多因子筛选 (推荐)
|
|
30
|
+
quantcli filter run -f examples/strategies/pe_roe_ma10.yaml --top 30
|
|
31
|
+
|
|
32
|
+
# 查看所有内置因子
|
|
33
|
+
quantcli factors list
|
|
34
|
+
|
|
35
|
+
# IC/IR 因子有效性分析
|
|
36
|
+
quantcli analyze ic -e "(close / delay(close, 20)) - 1" -n "20日动量" --json
|
|
37
|
+
|
|
38
|
+
# 批量分析因子库
|
|
39
|
+
quantcli analyze batch -d examples/alpha101/alpha/ --top 10
|
|
40
|
+
|
|
41
|
+
# 获取数据
|
|
42
|
+
quantcli data fetch 600519 --start 2020-01-01 --end 2024-01-01
|
|
43
|
+
|
|
44
|
+
# 运行因子
|
|
45
|
+
quantcli factor run -n momentum -e "(close / delay(close, 20)) - 1"
|
|
46
|
+
|
|
47
|
+
# 回测策略
|
|
48
|
+
quantcli backtest run -s ma_cross --start 2020-01-01
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## AI Agent 使用
|
|
52
|
+
|
|
53
|
+
### JSON 输出模式
|
|
54
|
+
|
|
55
|
+
所有命令支持 `--json` 参数,以机器可解析的格式输出:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
# IC/IR 分析
|
|
59
|
+
quantcli analyze ic -e "(close/delay(close,20))-1" --json
|
|
60
|
+
# {"status": "success", "ic_mean": 0.0285, "ir": 0.47, ...}
|
|
61
|
+
|
|
62
|
+
# 批量因子分析
|
|
63
|
+
quantcli analyze batch -d examples/alpha101/alpha/ --json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### IC/IR 评估标准
|
|
67
|
+
|
|
68
|
+
| 指标 | 含义 | 阈值 |
|
|
69
|
+
|------|------|------|
|
|
70
|
+
| **IC** | 因子与未来收益的秩相关 | \|IC\| > 0.05 有效 |
|
|
71
|
+
| **IR** | IC 均值/标准差(年化) | IR > 0.5 稳定 |
|
|
72
|
+
|
|
73
|
+
### Alpha101 内置因子库
|
|
74
|
+
|
|
75
|
+
内置 **40 个 WorldQuant Alpha101 因子**,可直接引用:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# 查看所有内置因子
|
|
79
|
+
quantcli factors list
|
|
80
|
+
|
|
81
|
+
# 运行 Alpha101 复合策略
|
|
82
|
+
quantcli filter run -f examples/alpha101/alpha101_composite.yaml --top 30
|
|
83
|
+
|
|
84
|
+
# 批量分析因子有效性
|
|
85
|
+
quantcli analyze batch -d examples/alpha101/alpha/ --top 10
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**使用内置因子:**
|
|
89
|
+
```yaml
|
|
90
|
+
factors:
|
|
91
|
+
- alpha101/alpha_001 # 20日创新高后转跌
|
|
92
|
+
- alpha101/alpha_008 # 资金流入
|
|
93
|
+
- alpha101/alpha_029 # 5日动量
|
|
94
|
+
|
|
95
|
+
ranking:
|
|
96
|
+
weights:
|
|
97
|
+
alpha101/alpha_001: 0.4
|
|
98
|
+
alpha101/alpha_008: 0.3
|
|
99
|
+
alpha101/alpha_029: 0.3
|
|
100
|
+
normalize: zscore
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Claude Code Skill
|
|
104
|
+
|
|
105
|
+
```markdown
|
|
106
|
+
/skill multi-factor-strategy --goal "低估+高ROE" --output strategy.yaml
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## 多因子筛选示例
|
|
110
|
+
|
|
111
|
+
创建策略文件 `strategy.yaml`:
|
|
112
|
+
|
|
113
|
+
```yaml
|
|
114
|
+
name: PE-ROE-MA10 选股策略
|
|
115
|
+
version: 1.0.0
|
|
116
|
+
|
|
117
|
+
screening:
|
|
118
|
+
fundamental_conditions:
|
|
119
|
+
- "pe_ttm < 20"
|
|
120
|
+
- "pe_ttm > 0"
|
|
121
|
+
- "roe > 0.1"
|
|
122
|
+
daily_conditions:
|
|
123
|
+
- "close > ma10"
|
|
124
|
+
|
|
125
|
+
ranking:
|
|
126
|
+
weights:
|
|
127
|
+
pe_ttm: -0.3 # 负权重: 低估值
|
|
128
|
+
roe: 0.5 # 正权重: 高ROE
|
|
129
|
+
ma10_deviation: 0.2
|
|
130
|
+
normalize: zscore
|
|
131
|
+
|
|
132
|
+
output:
|
|
133
|
+
limit: 50
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
运行筛选:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
quantcli filter run -f strategy.yaml --top 50
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## 命令
|
|
143
|
+
|
|
144
|
+
| 命令 | 功能 |
|
|
145
|
+
|------|------|
|
|
146
|
+
| `quantcli analyze` | IC/IR 因子有效性分析 |
|
|
147
|
+
| `quantcli filter` | 多因子筛选 |
|
|
148
|
+
| `quantcli factor` | 因子计算与评估 |
|
|
149
|
+
| `quantcli factors` | 内置因子管理 |
|
|
150
|
+
| `quantcli data` | 数据获取与管理 |
|
|
151
|
+
| `quantcli backtest` | 回测引擎 |
|
|
152
|
+
| `quantcli config` | 配置管理 |
|
|
153
|
+
|
|
154
|
+
## AI Skill
|
|
155
|
+
|
|
156
|
+
`multi-factor-strategy` skill 用于**引导创建多因子选股策略**,生成可独立运行的 YAML 配置文件。
|
|
157
|
+
|
|
158
|
+
**目的**: 将因子研究、回测验证、策略执行整合为标准化流程,通过 YAML 配置实现:
|
|
159
|
+
- 多阶段筛选 (基本面 → 技术面 → 因子评分)
|
|
160
|
+
- 权重融合与条件过滤
|
|
161
|
+
- 策略可复现、可版本控制
|
|
162
|
+
- AI Agent 可直接调用
|
|
163
|
+
|
|
164
|
+
## 文档
|
|
165
|
+
|
|
166
|
+
详见 [docs/cli_guide.md](docs/cli_guide.md)
|
|
167
|
+
|
|
168
|
+
## 许可证
|
|
169
|
+
|
|
170
|
+
MIT License
|
|
@@ -4,14 +4,14 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "quantcli"
|
|
7
|
-
version = "0.1.
|
|
8
|
-
description = "
|
|
7
|
+
version = "0.1.2"
|
|
8
|
+
description = "面向AI的多因子量化选股策略挖掘工具,AI Agent 友好 CLI"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
11
11
|
authors = [
|
|
12
12
|
{name = "QuantCLI Team", email = "quantcli@example.com"}
|
|
13
13
|
]
|
|
14
|
-
urls = {repository = "https://github.com/
|
|
14
|
+
urls = {repository = "https://github.com/wumu2013/quantcli"}
|
|
15
15
|
classifiers = [
|
|
16
16
|
"Development Status :: 3 - Alpha",
|
|
17
17
|
"Intended Audience :: Developers",
|
|
@@ -30,6 +30,7 @@ dependencies = [
|
|
|
30
30
|
"backtrader>=1.9",
|
|
31
31
|
"tabulate>=0.9",
|
|
32
32
|
"pyyaml>=6.0",
|
|
33
|
+
"pymysql>=1.1",
|
|
33
34
|
]
|
|
34
35
|
|
|
35
36
|
[project.optional-dependencies]
|