File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [main]
6+ pull_request :
7+
8+ permissions :
9+ contents : read
10+
11+ jobs :
12+ test :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - uses : actions/checkout@v6
16+ - uses : actions/setup-python@v6
17+ with :
18+ python-version : " 3.11"
19+ - run : python -m pip install --upgrade pip
20+ - run : python -m pip install -e ".[dev]"
21+ - run : ruff check .
22+ - run : pytest -q
Original file line number Diff line number Diff line change 1+ __pycache__ /
2+ * .py [cod ]
3+ .pytest_cache /
4+ .venv /
5+ build /
6+ dist /
7+ * .egg-info /
Original file line number Diff line number Diff line change 11# AlpacaPlatform
2+
3+ QuantStrategyLab 的 Alpaca 执行边界。它分为两个互不混用的阶段:
4+
5+ - P5 ` SHADOW ` :只生成虚拟账本回执,不连接券商、不读取凭据、不提交订单。
6+ - P4 ` PAPER_DRY_RUN ` :未来只会使用独立 paper endpoint 与独立 paper 凭据;不能从 P5 或市场数据配置推断资格。
7+
8+ 当前实现仅包含 P5 的 ` qsl.tqqq_shadow_cycle_input.v1 ` 和
9+ ` qsl.tqqq_shadow_ledger_receipt.v1 ` 。每个输入固定候选、策略 revision、P1/P2/P3
10+ 摘要、风险控制摘要与目标权重(basis points);输出记录相对上一回执的** 虚拟** 权重变化。
11+ 它不保存市场数据、价格、金额、账户、订单、broker URL 或任何凭据。
12+
13+ P5 receipt 不是 P4/P6 权限。实际调度器只能消费已验签且未过期的独立 P5 policy;P6
14+ 仍由所有者明确决定。
15+
16+ ``` bash
17+ python -m alpaca_platform.shadow_ledger --input cycle.json --output receipt.json
18+ ```
19+
20+ 输出采用 create-only 写入,避免无意覆盖已有 receipt。运行测试:
21+
22+ ``` bash
23+ python -m pytest -q
24+ ```
225Bounded Alpaca paper and shadow execution gateway for QuantStrategyLab
Original file line number Diff line number Diff line change 1+ [build-system ]
2+ requires = [" setuptools>=69" , " wheel" ]
3+ build-backend = " setuptools.build_meta"
4+
5+ [project ]
6+ name = " alpaca-platform"
7+ version = " 0.1.0"
8+ description = " Bounded Alpaca paper and shadow execution gateway for QuantStrategyLab"
9+ readme = " README.md"
10+ requires-python = " >=3.11"
11+
12+ [project .optional-dependencies ]
13+ dev = [" pytest>=8" , " ruff>=0.8" ]
14+
15+ [tool .setuptools ]
16+ package-dir = {"" = " src" }
17+
18+ [tool .setuptools .packages .find ]
19+ where = [" src" ]
20+
21+ [tool .ruff ]
22+ target-version = " py311"
23+ line-length = 120
Original file line number Diff line number Diff line change 1+ """Bounded P4/P5 execution gateway primitives."""
2+
3+ from .shadow_ledger import (
4+ ShadowLedgerError ,
5+ build_shadow_ledger_receipt ,
6+ validate_shadow_cycle_input ,
7+ validate_shadow_ledger_receipt ,
8+ )
9+
10+ __all__ = [
11+ "ShadowLedgerError" ,
12+ "build_shadow_ledger_receipt" ,
13+ "validate_shadow_cycle_input" ,
14+ "validate_shadow_ledger_receipt" ,
15+ ]
You can’t perform that action at this time.
0 commit comments