waditu/czsc
FinanceA Python toolkit that automates Chan Theory market structure analysis and signal-based backtesting for stocks, futures, and crypto.
czsc is a quantitative research library focused on Chan Theory (缠论) technical analysis. It turns OHLC bars into fractals, strokes (bi), and central zones (zs), then builds signals, events, and positions on top of that structure for backtesting and strategy research. It is aimed at people who already work with Chan Theory or want its rules expressed as code, not at general retail investors looking for ready-made trading advice.
What changes in the workflow
The core work happens in a few steps: convert a DataFrame into standardized bars, run CZSC to get the structural objects, configure signal functions, then run a weight backtest or strategy research. A BarGenerator combines lower-frequency bars into multiple timeframes, and CzscTrader supports multi-level decision logic. Backtesting output can be rendered as a self-contained offline HTML report through the separate wbt package, and Chan structures can be exported as interactive charts.
How the pieces fit
Since 1.0, the Chan core algorithms are written in Rust and exposed to Python through a PyO3 extension at czsc._native. The README describes 220+ signal functions implemented in Rust and organized in seven Python submodules, combinable with signals_all/signals_any/signals_not. Data connectors are provided for TQSDK (futures), Tushare (A-shares), and CCXT (crypto exchanges), plus a local cached-data reader. Weight backtesting, mock data, and the HTML backtest report come from the separate wbt project, which the README calls a hard dependency; the optional wmr project handles persisting position weights, and talib-rs is used only in tests for numerical parity checks. The homepage also promotes a separate hosted LLM-assisted strategy research platform, which is a product promotion rather than part of the library itself.
Requirements and caveats
- Python 3.10 or newer is required. Installing from PyPI is the recommended path; building from source needs a Rust toolchain and maturin, and the build will fail early if the default Python is older than 3.10.
- The 1.0.x release is explicitly incompatible with 0.9.x, and old code must be migrated to the new API. The older Python implementation remains available only in the 0.9.69 tag.
- Behavioral parameters such as minimum stroke length, maximum stroke count, and log verbosity are controlled by environment variables.
- The README states the project is open-sourced for technical exchange only; it is not a trading recommendation system, and the documentation does not provide performance or accuracy validation for the signal functions.
HotRepo's take
The repository was recorded on the daily trending board once, on 2026-10-31, at 6,518 stars with a +30 gain that day. The available board history is too thin to indicate any trend.
Written by AI from the project's README, updated October 31, 2026. The project's own docs are the source of truth.