94ab679a75
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>
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""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
|
|
portfolio — Build tradable positions and simulate execution
|
|
"""
|
|
|
|
import logging
|
|
|
|
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
|
|
|
|
|
|
@click.group()
|
|
@click.option(
|
|
"--log-level", default="INFO",
|
|
type=click.Choice(["DEBUG", "INFO", "WARNING", "ERROR"], case_sensitive=False),
|
|
help="Logging verbosity (default INFO shows download/compute progress)",
|
|
)
|
|
def cli(log_level):
|
|
"""Chinese Equity Quant Pipeline.
|
|
|
|
Each phase is independent: read from parquet, write to parquet.
|
|
"""
|
|
logging.basicConfig(
|
|
level=getattr(logging, log_level.upper()),
|
|
format="%(asctime)s %(levelname)s %(name)s: %(message)s",
|
|
datefmt="%H:%M:%S",
|
|
)
|
|
|
|
|
|
cli.add_command(data)
|
|
cli.add_command(alpha)
|
|
cli.add_command(combo)
|
|
cli.add_command(portfolio)
|
|
cli.add_command(pqcat)
|
|
cli.add_command(alphaview)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
cli()
|