chanlun-pro: a Chan theory analysis tool for market data
基于缠中说禅所讲缠论理论,以便量化分析市场行情的工具
At a glance
- What is it?
- chanlun-pro is a Python web tool for analysing market quotes with Chan theory, computing fractals, strokes, segments, pivots, divergence and buy or sell points incrementally as each bar arrives, with the core engine shipped as an encrypted, key-locked module.
- Who is it for?
- chanlun-pro is a reasonable fit for a trader who already follows Chan theory and wants the structures computed for them, especially because the incremental process_klines approach is the right shape for live monitoring and backtesting, and because the project ships adapters for several Chinese and international data sources.
- Can I use it commercially?
- Yes. Apache-2.0 is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 3 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 7, 2026, and from our analysis. They are not legal advice.
Star history
- yijixiuxin/chanlun-pro1,086 ★ · +17
| Repository | 2026-10-21 | 2026-11-07 |
|---|---|---|
| yijixiuxin/chanlun-pro | 1.1k | 1.1k |
17 Stars in the last 17 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What Chan theory computes, and what the tool does with it
chanlun-pro is a market analysis tool built on the Chan theory described in Chinese technical analysis writing known as the Chan Zhong Shuo Chan school of writing. The project description calls it a tool for quantitative analysis of market quotes, and the README presents it as a web based Chan theory market analysis tool.
Chan theory is a structural approach: instead of predicting price, it describes how moves are composed of fractals, strokes and segments, and how those nest into pivots and trend segments, and then looks for divergence and the resulting buy or sell points. The tool's job is to do that arithmetic over real quote data, and the list of outputs in the README is exactly that vocabulary: merged Chan K-lines, then 分型 (fractals), 笔 (strokes), 线段 (segments), 中枢 (pivots), 走势段 (trend segments), 背驰 (divergence) and 买卖点 (buy and sell points).
The supported markets are broad: Shanghai and Shenzhen stocks, Hong Kong stocks, US stocks, domestic futures, New York futures, foreign exchange and digital currencies, with the note that any source with data can be connected. The feature list also covers quote data download, market monitoring for divergence and buy or sell points with Feishu or DingTalk message pushes, replay practice on local data, recursive computation from a small period up to a higher period chart, custom strategy backtesting, live strategy trading, VNPY strategy and live trading support, backtesting and simulation through the Juejin quant platform, and TradingView charts.
The intended user is a Chinese-market trader or researcher who already knows the theory and wants the structure computed rather than drawn by hand.
The Apache-2.0 licence does not cover the engine that does the work
The licensing section of the README is the most important thing to read before anything else, and it is unusual enough to quote precisely.
Copyright runs 2022 to 2026 Wang Xu. The Apache License 2.0 applies to the repository except for three things, which are not licensed under it and for which all rights are reserved: `src/chanlun/core`, described as the proprietary Chan Theory engine distributed only as platform-specific encrypted modules; the `src/pyarmor_runtime_*` directories, the PyArmor runtime and protection loader; and the `licenses` directory along with any licence key material.
Those components are not source-available. Running them requires a separately granted, machine-bound licence key. The README states plainly that no permission is granted to decrypt, reverse-engineer, reimplement, extract or redistribute them, in whole or in part.
So the honest picture is this. The surrounding application, the web layer, the data adapters, the scripts and the documentation are Apache-2.0, and the package metadata records `license = "Apache-2.0"` with the LICENSE file. The part that computes the Chan structures is closed, encrypted with PyArmor, and gated on a key tied to your machine.
That is a legitimate commercial arrangement, and it is also a dependency risk worth naming plainly. You cannot read the code that decides what a divergence is, you cannot fix a bug in it yourself, and a machine-bound key means the tool does not travel cleanly between machines or into a container that is rebuilt. For a research tool you use on one workstation that is a workable trade. For a product that embeds this engine, it is a different conversation.
Computation is incremental, bar by bar
The calculation method is the most interesting engineering decision in the project, and it is described in detail in the README.
The data is computed bar by bar. From the current bar, the program computes and merges the Chan K-lines, then computes fractals, strokes, segments, pivots, trend segments, divergence and the buy or sell point data. The next bar's data then updates all of that.
The critical property is stability: once a fractal, stroke, segment, pivot or trend segment has been formed and confirmed, it is not changed afterwards, unless something unusual happens. This is what makes the incremental approach possible at all, since a naive recompute-from-scratch would rewrite history on every bar and make backtesting meaningless.
The API follows from that. The `process_klines` method can be fed data continuously: the internals decide what has already been processed and do not recompute it, while a new bar triggers the same sequence of steps again.
The payoff is stated in the README as a large reduction in computation time during strategy backtesting, which improves backtest efficiency. For a strategy that re-evaluates thousands of bars across many parameter combinations, the difference between recomputing the whole structure each time and extending it incrementally is the difference between a slow script and a usable one.
The one thing the documentation is candid about is uncertainty. The program reports the current divergence or buy or sell point, and where the market goes next may confirm it or may let it continue, in which case the signal eventually disappears. The README says this is where other aids come in, such as moving averages or Bollinger bands, or looking at a lower level structure, to increase the odds. That is a fair description of what a signal from this family of methods is: a candidate that needs context, not a settled fact.
The backtest measures signals, not money
There is a line in the README about backtesting that any reader should sit with, because it defines what the numbers in the backtest charts mean.
The project states that its backtest has no capital or position management, and that each order places a fixed amount of 10W, mainly used to test the win rate and the profit and loss ratio of strategy signals.
That is an honest disclosure, and it is also a significant limitation. A backtest that places the same fixed amount on every signal cannot tell you whether a strategy is survivable in practice, because a real position has a size, a stop, and an interaction with the rest of the portfolio. What it can tell you is whether the signal sequence has a positive expectancy, and that is genuinely useful for research, provided you do not read it as a performance figure.
The workflow is documented with screenshots: backtesting through the Juejin quant platform, and backtesting through Jupyterlab where the results are charted, the backtest instrument's historical quotes are shown, and buy and sell orders are marked on the chart so the strategy can be refined. The charts also show that the interface supports switching between dark and light themes and between single and dual chart modes.
The online and local deployments differ here as well. The comparison table states that the online site does not support quantitative backtesting or live trading, while the local deployment supports both, and that the local deployment can also add your own data source.
The online service and the local install are two different products
The README puts the hosted service and the local deployment side by side in a table, and the differences are substantial enough to decide the question before you install anything.
The online site, at chanlun-trader.com, is aimed at light users, requires no skills, and offers limited functionality: charts, monitoring, stock selection and historical buy or sell points. It does not support quantitative backtesting or live trading. Its market coverage is Shanghai and Shenzhen stocks, domestic futures, New York futures and digital currencies, with a note that other markets can be added later. The period coverage is basic, such as 1m, 5m, 15m, 30m, 60m and daily, with 2000 to 2500 K-lines. Data delay is under one minute, with ten minutes for New York futures. It is priced as a time-limited subscription.
The local deployment is aimed at heavy Chan theory users, requires basic Python programming skills, gives all features with freedom to develop further, supports custom markets and more custom period data, has no K-line limit, and mostly uses real-time quotes with the option to add your own data source. It is priced as a one-off payment for permanent use.
For anyone who wants to run backtests or trade live, the choice is made for you: the hosted site cannot do either, so the local install is the only path. The local install also means a heavier dependency footprint, which is the subject of the next section.
A wide dependency surface with platform-specific wheels
The project is a substantial Python application, and the packaging metadata shows it. The project name is `chanlun-pro`, the version is 1.0.0, and the supported interpreter range is declared as:
[project]
name = "chanlun-pro"
version = "1.0.0"
requires-python = ">=3.11,<3.15"
license = "Apache-2.0"The dependency list is long and spans every layer of the product: market data through `akshare`, `baostock`, `ccxt`, `tqsdk`, `futu-api`, `alpaca-py`, `ib-insync` and `polygon-api-client`, the web layer through `flask`, `flask-login` and `sqlalchemy` with `redis` and `pymysql` for storage, scheduling through `apscheduler`, charting and analysis through `pyecharts`, `matplotlib`, `pyfolio-reloaded`, `dtaidistance` and `ta-lib`, messaging through `lark-oapi`, and automation through `playwright` and `pyautogui`.
One dependency needs special handling. `ta-lib` is a native library, so the project vendors platform-specific wheels under `package/` and points the build at them:
[tool.uv.sources]
ta-lib = [
# ---- Python 3.11 ----
{ marker = "python_full_version == '3.11.*' and sys_platform == 'win32' and platform_machine == 'amd64'", path = "package/ta_lib-0.8.0-cp311-cp311-win_amd64.whl" },There is a `uv.lock` and a `requirements.txt` that pins a smaller core subset for `pandas`, `numpy`, `requests`, `redis` and the rest, and the repository ships per-platform installers: `install_linux.sh`, `install_mac.sh`, `windows_install.bat` and `windows_run.bat`. A `.python-version` file pins the interpreter for the project. Expect to spend real time on the install, and note that `pyarmor` is itself a dependency, since the encrypted core needs its runtime loader present.
Documentation, community channels and the maintenance record
The project has a substantial documentation setup. The online documentation is hosted on Read the Docs, with a Chinese version at chanlun-pro.readthedocs.io/zh_CN/latest/ and a dedicated changelog page at the UPDATE path, which is where release notes live since the repository has no GitHub releases. The README points to a Bilibili video tutorial series, a Feishu group for the online site, a QQ group, and author contact details on WeChat.
The repository layout supports a documentation-as-code workflow: a `cookbook/` directory with images referenced from the README, a `notebook/` directory, a `web/` directory for the front end, `script/` for utility scripts, `joinquant/` for that platform integration, `tests/`, and `package/` for the vendored wheels. There is also a `CLAUDE.md` and a `requirements-gm.txt` for the Juejin platform.
The licensing terms and support are tied to the author rather than a company, and the README notes a 20 day trial authorisation for anyone who adds the author on WeChat, after reading the installation documentation. The `LICENSE` file, `MANIFEST.in`, `pyproject.toml` and `uv.lock` are all present at the root.
On maintenance, the repository is not archived and the last push was on 2026-10-15, so the work is current. There are no GitHub releases and the version in the metadata is 1.0.0, so the changelog on Read the Docs is where you check what changed. Given that the core engine is closed and encrypted, that changelog is also the only signal you get about changes in the part of the code that does the analysis.
Editorial conclusion
chanlun-pro is a reasonable fit for a trader who already follows Chan theory and wants the structures computed for them, especially because the incremental process_klines approach is the right shape for live monitoring and backtesting, and because the project ships adapters for several Chinese and international data sources. It is the wrong choice if you need the source of the analysis engine, because src/chanlun/core is not source-available and the licence section reserves all rights to it, and it is the wrong choice if you expect a backtest that models capital and position sizing, which the project says it does not. Before installing, read the installation documentation on Read the Docs, confirm the Python version in .python-version fits the 3.11 to 3.14 range the package metadata requires, and check what the licence key is bound to, since it is machine-bound. The last push was on 2026-10-15.
Frequently asked questions
Is the chanlun-pro source code fully open?
No. The Apache License 2.0 applies to the repository except for src/chanlun/core, the PyArmor runtime directories, and licence key material, which are distributed as encrypted modules and require a machine-bound licence key to run.
What Python version does chanlun-pro need?
The package metadata declares requires-python as >=3.11,<3.15, and the repository ships a .python-version file. The project also vendors platform-specific ta-lib wheels under package/ for use with uv.
Does the online chanlun-pro website support backtesting and live trading?
No. The comparison table in the README states that the online site does not support quantitative backtesting or live trading, and that the local deployment supports both, along with custom markets and more period data.
How does chanlun-pro handle the situation where a buy or sell point later disappears?
The README states that the program reports the current divergence or buy or sell point, that later price action may confirm it or let it continue and eventually remove it, and that other aids such as moving averages, Bollinger bands or a lower level structure are used to judge the situation.
Does the chanlun-pro backtest model capital and position sizing?
No. The README states that the backtest has no capital or position management and places a fixed amount of 10W per order, mainly to test the win rate and profit and loss ratio of strategy signals.
Official sources
Was this useful?