跳转至

2026-04-08 - Daily Log

Morning

  • 09:00 CT cron fired: HK market data update (ct-daily-data-hk)

Afternoon - CN Backtest Architecture

Python Environment Cleanup

  • Deleted clawtrading311-legacy environment
  • Now only clawtrading314 (Python 3.14) remains
  • Updated TOOLS.md

CN Backtest Fixes

  1. TuShare API caching: Added _CN_CONSTITUENTS_CACHE and preload_cn_constituents() to avoid rate limiting
  2. Month-end dates: Changed from freq="MS" to freq="ME" for index constituent queries
  3. Rebalance period: Changed from 20 to 21 days (align with US/HK)
  4. Index support: Added创业板指 (399006.SZ) to _CN_INDEX_MAP

Parallel Implementation

  • Created backtest/parallel_utils.py for ProcessPoolExecutor compatibility
  • Modified cli.py to support parallel strategy computation
  • --parallel now defaults to True

CN 2-Year Backtest Results

  • Strategy: ml_only_alpha500_cn
  • Period: 2024-04-03 → 2026-04-03
  • Total Return: +227.79%
  • Sharpe: 2.18
  • MDD: -16.19%

Fold-Level Parallelism Results

42.8x Speedup! 🚀

Mode Time Rebalances
Standard (compute_daily_schedule) 69.47s 18
Fold-Parallel (compute_schedule_parallel) 1.62s 22

Implementation: - compute_schedule_parallel() in backtest/scheduler.py - Two-phase architecture: - Phase 1: Pre-compute shared data (cov, mu_mean, ma60) - parallel - Phase 2: Optimize each fold - sequential (w_prev dependency) - CLI: --fold-parallel flag added - Auto-detection: Only enabled for features=['mean'] strategies

Limitations: - Fold-parallel uses fixed 20-day rebalance (simpler) - Standard path has dynamic monthly refresh + circuit breaker - ML strategies automatically fall back to standard path

Open Questions

  • None remaining - parallelization complete!