# backtest **Repository Path**: aiopenseekdeep/backtest ## Basic Information - **Project Name**: backtest - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-07-10 - **Last Updated**: 2026-07-10 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Backtest Research Platform A modular, web-deployed research and backtesting foundation for China A-shares and Chinese futures. - **Research service:** Python/FastAPI, safe formula factors, internal HTTP data adaptation and a Qlib-compatible boundary. - **Execution engine:** C++17 daily-bar matching and accounting exposed through HTTP. - **Web console:** browser workflow for health checks, factor experiments and backtest requests. Phase 1 deliberately provides a deterministic vertical slice. It is not production brokerage or exchange simulation. See `.planning/ROADMAP.md` for the staged plan. ## Architecture ```mermaid flowchart LR API[Internal market-data HTTP API] --> Research[Research API] Research --> Factor[Factor registry and evaluator] Factor --> Engine[C++ backtest engine] Engine --> Research Web[Web console] --> Research Web --> Engine ``` ## Quick Start ```bash cp .env.example .env docker compose up --build ``` Open `http://localhost:8088`. Service endpoints: - Research API: `http://localhost:8000/docs` - Backtest engine: `http://localhost:8080/health` - Web console: `http://localhost:8088` ## Internal Data API Configure the research service through `.env`: ```dotenv MARKET_DATA_BASE_URL=http://192.168.239.171 MARKET_DATA_BARS_PATH=/replace-with-verified-bars-path ``` The documentation page contains endpoints whose details may be inferred or incomplete. Verify each path, request body and response schema before production ingestion. Keep the adapter mapping isolated rather than coupling factor code to source fields. ## Qlib Strategy Phase 1 does not install Qlib in the default image. It establishes a stable research boundary so a later phase can add: - Qlib dataset/provider exports; - Alpha158/Alpha360-compatible definitions; - model workflows and recorders; - IC, RankIC, neutralization and factor decay; - symbolic, genetic and model-driven factor mining. The C++ engine remains replaceable and independent, so high-frequency replay and China-specific trading rules can evolve without rewriting the research layer. ## Development ```bash python -m pytest services/research/tests docker build -f engine/Dockerfile --target test . docker compose config ``` ## Phase 1 Limitations - Daily-bar same-close execution only. - No A-share T+1, board-lot, suspension or price-limit enforcement. - No full futures margin, settlement, night-session or close-today accounting. - No tick/L2 order book. - In-memory factor registry and synchronous jobs. These limitations are explicit roadmap items, not hidden assumptions. ## Security Scope The Compose file publishes research and engine ports for local development and has no authentication. Do not expose it directly to an untrusted network. Production deployment requires an authenticated gateway, TLS, job quotas and persistent audit storage.