hamuna-quant-cli 0.1.0.dev93__py3-none-any.whl

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.
@@ -0,0 +1,154 @@
1
+ Metadata-Version: 2.4
2
+ Name: hamuna-quant-cli
3
+ Version: 0.1.0.dev93
4
+ Summary: Hamuna A 股回测 + 实盘统一 CLI (akquant 0.3.x). 替代 v1 自建 driver + QMT-style 策略规范.
5
+ Author-email: Hamuna Team <team@hamuna.example>
6
+ License: MIT
7
+ Project-URL: Homepage, https://hamuna.example
8
+ Project-URL: Bug Tracker, https://github.com/hamuna/hamuna-strategy-platform/issues
9
+ Keywords: quant,backtest,akquant,A-share,QMT,hamuna
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Financial and Insurance Industry
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Classifier: Operating System :: POSIX :: Linux
18
+ Classifier: Operating System :: MacOS
19
+ Classifier: Topic :: Office/Business :: Financial :: Investment
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: akquant<0.4,>=0.3.41
23
+ Requires-Dist: pandas>=1.5
24
+ Requires-Dist: numpy>=1.23
25
+ Requires-Dist: pyarrow>=10
26
+ Requires-Dist: pyyaml>=6
27
+ Requires-Dist: requests>=2.28
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7; extra == "dev"
30
+ Requires-Dist: pytest-cov>=4; extra == "dev"
31
+ Requires-Dist: ruff>=0.1; extra == "dev"
32
+ Provides-Extra: polars
33
+ Requires-Dist: polars>=0.20; extra == "polars"
34
+ Provides-Extra: backtest-extra
35
+ Requires-Dist: matplotlib>=3.7; extra == "backtest-extra"
36
+ Requires-Dist: plotly>=5.15; extra == "backtest-extra"
37
+
38
+ # hamuna-quant-cli
39
+
40
+ A 股回测 + 实盘统一 CLI (akquant 0.3.x).
41
+
42
+ 替代 v1 自建 driver (`hamuna-strategy`) + QMT-style (`init/handlebar/passorder`).
43
+ **同一份策略代码天然兼容回测与实盘** (akquant `Strategy` 双引擎一等公民).
44
+
45
+ ## 安装
46
+
47
+ ```bash
48
+ pip install hamuna-quant-cli
49
+ # 或本地源码装
50
+ pip install -e /path/to/hamuna-strategy-platform
51
+ # 或本地 wheel
52
+ pip install /path/to/hamuna_quant_cli-*.whl
53
+ ```
54
+
55
+ **Windows / macOS / Linux 全支持** (Python ≥3.10).
56
+
57
+ 依赖: `akquant>=0.3.41,<0.4` (Rust + Python 混合引擎).
58
+
59
+ ## 构建 (版本号自动更新)
60
+
61
+ 每次构建版本号自动 +1 (基于 git 提交数):
62
+
63
+ ```bash
64
+ # 一键: 先 bump 版本 → 再 build wheel + sdist
65
+ bash scripts/build_python.sh
66
+
67
+ # 或手动两步 (效果相同)
68
+ python3 scripts/bump_version.py --python
69
+ python3 -m build
70
+ ```
71
+
72
+ 产物在 `dist/`。版本格式 `0.1.0.dev<git提交数>` (PEP 440),同一 commit 版本可重现。
73
+
74
+ ## 子命令一览
75
+
76
+ | 命令 | 用途 |
77
+ |---|---|
78
+ | `hamuna_quant_cli run <strategy.py> --config cfg.json` | 跑 akquant backtest → result.json |
79
+ | `hamuna_quant_cli check <strategy.py> --config cfg.json` | 8 条纪律静态审查 (不回测) |
80
+ | `hamuna_quant_cli upload <strategy_id> --result result.json` | PUT metrics → server |
81
+ | `hamuna_quant_cli create --name ... --config ...` | 新建 strategy 拿 strategy_id |
82
+ | `hamuna_quant_cli parity` | 5 内置 strategy × 1 universe parity test |
83
+ | `hamuna_quant_cli qmt-translate <strategy.py> cfg.json` | akquant → QMT body 翻译 (本地 stub) |
84
+ | `hamuna_quant_cli commit <strategy_id>` | 5 步打包上传 (translate + bundle + PUT + POST + export) |
85
+ | `hamuna_quant_cli dataset {list\|fetch\|manifest}` | prebuilt 数据集管理 |
86
+ | `hamuna_quant_cli live run <strategy.py>` | **实盘 / 仿真运行** (包装 akquant.run_live) |
87
+
88
+ ## 端到端回测 (10 行)
89
+
90
+ ```bash
91
+ # 0) 安装
92
+ pip install hamuna-quant-cli
93
+
94
+ # 1) 写策略
95
+ cat > /tmp/s.py <<'EOF'
96
+ # coding: utf-8
97
+ from akquant import Strategy
98
+ class S(Strategy):
99
+ warmup_period = 1
100
+ def on_bar(self, bar):
101
+ if self.get_position(bar.symbol) == 0:
102
+ self.buy(bar.symbol, 100)
103
+ EOF
104
+
105
+ # 2) 写 cfg
106
+ cat > /tmp/c.json <<'EOF'
107
+ {
108
+ "backtest_start": "20240701",
109
+ "backtest_end": "20241231",
110
+ "pool": {"hs300": {"codes": ["600000.SH", "600036.SH"]}},
111
+ "init_capital": 1000000.0
112
+ }
113
+ EOF
114
+
115
+ # 3) 静态审查
116
+ hamuna_quant_cli check /tmp/s.py --config /tmp/c.json
117
+ # 期望 stderr: "纪律 self-check 通过 (0 条)"
118
+
119
+ # 4) 跑回测
120
+ hamuna_quant_cli run /tmp/s.py --config /tmp/c.json --output /tmp/r.json
121
+
122
+ # 5) 上传 (auto-create strategy)
123
+ hamuna_quant_cli upload --name "v2_smoke" --config /tmp/c.json --code /tmp/s.py --result /tmp/r.json
124
+ ```
125
+
126
+ ## 实盘 (5 行)
127
+
128
+ ```bash
129
+ # 1) 写策略 (同上)
130
+
131
+ # 2) paper 模式 (smoke, 不连真实 broker)
132
+ hamuna_quant_cli live run /tmp/s.py \
133
+ --mode paper --broker replay --symbols sh600000,sz600036 --duration 30s
134
+
135
+ # 3) qmt 实盘 (需配 broker=qmt + market_broker=qmt_market + gateway_options)
136
+ hamuna_quant_cli live run /tmp/s.py \
137
+ --mode broker_live --broker qmt --market-broker qmt_market \
138
+ --symbols sh600000,sz600036 \
139
+ --gateway-options "qmt_account_id=8888888888,qmt_base_url=http://127.0.0.1:9000"
140
+ ```
141
+
142
+ ## 不在 hamuna-quant-cli 范畴
143
+
144
+ - ❌ 5m / tick / 多周期 (akquant 0.3.x Phase B 锁日线)
145
+ - ❌ ETF / 期权 / 期货 (akquant 仅股票)
146
+ - ❌ 自建回测引擎 / 私有 IR / DSL (ADR-001/002 禁止)
147
+ - ❌ realtime dashboard / live trading 控制台 (v2 是离线回测 + 一次性实盘 run)
148
+
149
+ ## 关联文档
150
+
151
+ - 项目根: `../CLAUDE.md`
152
+ - v2 skill (skill 文档, 不再含代码): `../skills/hamuna-strategy-v2/SKILL.md`
153
+ - AKQuant Guide (引擎手册): `../docs/AKQUANT_GUIDE.md`
154
+ - v1 skill (旧, QMT-style 不变): `../skills/hamuna-strategy/`
@@ -0,0 +1,32 @@
1
+ hamuna_quant_cli/README.md,sha256=t26oxjhNZcKwipQtN-rooF-VRsPIwKyC0-AWKKFJLtE,3799
2
+ hamuna_quant_cli/__init__.py,sha256=JuTSl2q0HIJK7GyUzY1FQQ_uHE1nCdRR2Oe34VvDATk,694
3
+ hamuna_quant_cli/__main__.py,sha256=kLiaxSeo_uRV2WRtNSddIqz6vI4tLr_OFjEpJa-mJOw,40698
4
+ hamuna_quant_cli/_market_fallback.py,sha256=purbbV-SiwMEbxiB7mvf9G8kOfyAbl25kakKILCazJE,3288
5
+ hamuna_quant_cli/_metrics_15.py,sha256=33yuRC1hq9miJy_Suw-9LxheRbjpkFeJmALmX_jLj8w,12635
6
+ hamuna_quant_cli/_test_akquant_parity.py,sha256=TmNiVFT7EpbrQjHDxt6J_uon2Ma5fTiWlNi-vrL8eWw,20241
7
+ hamuna_quant_cli/akquant_data_adapter.py,sha256=rJUvpmoOM5IdtEwpCA10eaBzw6at0QywzFOp5XSYsxI,14386
8
+ hamuna_quant_cli/akquant_runner.py,sha256=VfyzCuIEa2k68d_KBTkYEiRt04pbSWXqhnOvSZZ4dxw,28483
9
+ hamuna_quant_cli/akquant_schema_adapter.py,sha256=lDCEXcvZouvN5Kt2bLaF2r-fkHmY_1-Z_dWtHKqnzbw,17852
10
+ hamuna_quant_cli/base_strategy.py,sha256=Lgfiwv44OiyUosuwW9WVaou81apwTR6wKH47O3QHT5g,3634
11
+ hamuna_quant_cli/cross_sectional_helpers.py,sha256=zuzWtgK5rhG61YXTg0LCOmh7LRPpCyz1wUB5HmACQMY,5044
12
+ hamuna_quant_cli/prebuilt_downloader.py,sha256=DOhkZ-gGs5ZSyL62IVMpYKJpkAScSLtr0udF9SMXQMM,10949
13
+ hamuna_quant_cli/prebuilt_resolver.py,sha256=jHqDNohvZNMPBejkRPU1joq6mRKbK-yfyWGqOKRyNK8,20286
14
+ hamuna_quant_cli/qmt_translator.py,sha256=L9BVf0GV42up0EavPSjwdn-YKAmypM_oX9yjkQPZ67E,25675
15
+ hamuna_quant_cli/live/__init__.py,sha256=tKv9ZcWuNW-_VCMElNTcxDHlAX4Hs4Aw2W6pKnd7l2k,467
16
+ hamuna_quant_cli/live/loader.py,sha256=P5M0odql0ULiBG6XwcbqncX3b6DrpqA_AUsaBjmYnkg,5212
17
+ hamuna_quant_cli/live/qmt_broker.py,sha256=1CEoJWZgcq0MdV-gW-uxKOXPU_FSzn-QpR29r4hjP6Q,29763
18
+ hamuna_quant_cli/live/qmt_market.py,sha256=qjnAN5TFhLTWz3WlRQV_SssRF97f0BOicvwR4biVCBk,20523
19
+ hamuna_quant_cli/live/runner.py,sha256=sq_8q35TrS0QdmeG-XBcouEWVZfhcOHL0in_PK219gU,20278
20
+ hamuna_quant_cli/runtime/__init__.py,sha256=fPi5Rw7S2X9FDU_8WxBqwV-O_2Ru2v4wYu1AqI5Lfq4,165
21
+ hamuna_quant_cli/runtime/backtest.py,sha256=JXJTeUUXWLc7SzgGbN8EvHdTay1GxSgtkiGk6ZIopHE,1654
22
+ hamuna_quant_cli/runtime/cache.py,sha256=uQvrdNKbQveu5IU6XTg8HaVQfZmyGMRFw5lkPej6rE4,10596
23
+ hamuna_quant_cli/runtime/discipline.py,sha256=DigmUUhbpzkTf9MgPumbWU82UDfbcn1nlUjNGllxXAM,15849
24
+ hamuna_quant_cli/runtime/http_client.py,sha256=JOusl1eaop_EqApn4cY5KJEBulpa_cIZOarbh2-Bgn8,8315
25
+ hamuna_quant_cli/runtime/s3client.py,sha256=Ykd7KPXYX1psbrE85Uu49Ky3VRmvR3_IUg0pY0aOO0k,4725
26
+ hamuna_quant_cli/runtime/server_client.py,sha256=3AnWf90LT6GatAcmO-IwPWo8edNQ1BDyGzjjRvCEbh4,12000
27
+ hamuna_quant_cli/scripts/server.json,sha256=5Kb1Y7GojlhzKLEx8R34V63ueOc9HvKzs41bFoBcApg,399
28
+ hamuna_quant_cli-0.1.0.dev93.dist-info/METADATA,sha256=8sSmQmRi_paA2MiSIivvB7ZhdagNyTPj9W-1Ar_l-7Y,5337
29
+ hamuna_quant_cli-0.1.0.dev93.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
30
+ hamuna_quant_cli-0.1.0.dev93.dist-info/entry_points.txt,sha256=VSWGGz5aVmyj1c6XfJmlxzOYSpyO30G2xk7xjnW0vQU,68
31
+ hamuna_quant_cli-0.1.0.dev93.dist-info/top_level.txt,sha256=jKQNVzQFwGfhe8XpQPQzTqCm55LFB59VeKfQcxEPZW4,17
32
+ hamuna_quant_cli-0.1.0.dev93.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ hamuna_quant_cli = hamuna_quant_cli.__main__:main
@@ -0,0 +1 @@
1
+ hamuna_quant_cli