feat: add portfolio phase — discretize alpha weights into tradable positions

Adds a fourth pipeline phase modeling A-share microstructure: lot sizes,
the 2023-08-10 Main Board increment change, STAR 200-share minimum/odd-lot
rules, limit-up/down, suspensions, volume caps, costs, and slippage.

Two layers: research (continuous weights → return/Sharpe/turnover/Fitness,
no IC per repo convention) and execution (state-dependent lot rounding +
two-stage greedy exposure repair + next-open reference simulator).

Wires `portfolio build/simulate/eval` into the CLI and adds the
POSITION/FILL/PNL schema contracts. Covered by tests/test_portfolio.py.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Yuxuan Yan
2026-06-10 11:23:04 +08:00
parent 7faeb77c50
commit 94ab679a75
12 changed files with 1734 additions and 3 deletions
+6 -3
View File
@@ -2,9 +2,10 @@
"""Chinese Equity Quant Pipeline — decoupled phase CLI.
Phases:
data — Download daily bars to parquet
alpha — Compute alpha weights from data
combo — Combine alphas into a single weight
data — Download daily bars to parquet
alpha — Compute alpha weights from data
combo — Combine alphas into a single weight
portfolio — Build tradable positions and simulate execution
"""
import logging
@@ -14,6 +15,7 @@ import click
from pipeline.data.cli import data
from pipeline.alpha.cli import alpha
from pipeline.combo.cli import combo
from pipeline.portfolio.cli import portfolio
from tools.pqcat import pqcat
from tools.alphaview import alphaview
@@ -39,6 +41,7 @@ def cli(log_level):
cli.add_command(data)
cli.add_command(alpha)
cli.add_command(combo)
cli.add_command(portfolio)
cli.add_command(pqcat)
cli.add_command(alphaview)