PyAlgoEngine
High-Performance Algorithmic Trading Engine in Python, Cython, and C
PyAlgoEngine is a low-latency trading engine for HFT (High-Frequency Trading) systems. It provides C-level market data structures, shared-memory buffers, an event-driven engine architecture, backtesting with simulated order matching, exchange calendar profiles, and web-based visualization — all with Cython acceleration for latency-critical paths.
Features
| Category | Capabilities |
|---|---|
| Market Data | TickData, TickDataLite, BarData, DailyBar, OrderBook, TransactionData, OrderData, TradeData — all C-backed via Cython |
| Buffers | MarketDataBuffer, MarketDataRingBuffer, MarketDataConcurrentBuffer, MarketDataBufferCache |
| Engines | EVENT_ENGINE (pub/sub), MDS (Market Data Service), ALGO_ENGINE (algo lifecycle), trade engine (DMA, positions, risk) |
| Exchange Profiles | CN (A-share) and default global calendars, session phases, holidays via PROFILE, PROFILE_CN, PROFILE_DEFAULT |
| Backtesting | SimpleReplay, ProgressReplay, SimMatch (simulated matching), TradeMetrics |
| Strategy Framework | StrategyEngine, AlgoTemplate, global singletons (BALANCE, DMA, STRATEGY_ENGINE) |
| Web Apps | Flask + Bokeh dashboards, candlestick charts, strategy tester UI |
| Compile-Time Config | BOOK_SIZE, ID_SIZE, LONG_ID_SIZE, MD_BUF_PTR_DEFAULT_CAP, MD_BUF_DATA_DEFAULT_CAP via env vars |
Quick Install
git clone https://github.com/BolunHan/PyAlgoEngine.git
cd PyAlgoEngine
./build.sh -i
Requires Python 3.12+ and a C compiler (GCC, Clang, or MSVC). See the Setup Guide for detailed instructions, compile-time configuration, and optional dependencies.
Quick Verify
import algo_engine
print(algo_engine.__version__)
from algo_engine.base import CONFIG
print(CONFIG) # compile-time and runtime configuration
Documentation
Build locally:
cd docs && ./update_docs.sh
# open build/html/index.html
- Read the Docs: pyalgoengine.readthedocs.io
- GitHub Pages: bolunhan.github.io/PyAlgoEngine
Architecture
┌──────────────────────────────────────────────────────┐
│ apps/ Web visualization (Flask, Bokeh) │
├──────────────────────────────────────────────────────┤
│ strategy/ Strategy framework, global singletons│
├──────────────────────────────────────────────────────┤
│ engine/ Event, Market, Algo, Trade engines │
├──────────────────────────────────────────────────────┤
│ backtest/ Replay, SimMatch, Metrics │
├──────────────────────────────────────────────────────┤
│ base/ Market data types, buffers (Cython/C)│
├──────────────────────────────────────────────────────┤
│ exchange_profile/ Calendars, sessions (CN + global)│
├──────────────────────────────────────────────────────┤
│ monitor/ Synthetic order book, bar monitor │
├──────────────────────────────────────────────────────┤
│ utils/ Time-series indices, fake data │
└──────────────────────────────────────────────────────┘
Build System
| Command | Description |
|---|---|
./build.sh -i |
Clean, build Cython extensions in-place, install |
make build |
Clean and build extensions in-place |
make install |
Build + pip install |
./build.sh -l |
List all compile-time macros and defaults |
make list-args |
Same as above |
Override compile-time constants:
BOOK_SIZE=20 ./build.sh -i
Dependencies
- Runtime: numpy, pandas, exchange_calendars, PyCyBase, PyEventEngine, Cython
- Web (optional): flask, waitress, bokeh
- Docs (optional): sphinx, sphinx-rtd-theme
License
MIT — Han Bolun
Metadata
Release files for PyAlgoEngine 0.12.3.post1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
Total release size: 77.9 MB
Release files / pyalgoengine-0.12.3.post1-cp315-cp315t-win_amd64.whl
| Download URL | pyalgoengine-0.12.3.post1-cp315-cp315t-win_amd64.whl |
|---|---|
| Size | 4.5 MB |
| Tags | CPython 3.15 CPython 3.15 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
b011f7dea32ad955e1fb65b67395c94724e269e11e44cdb9553b59ac6d0763f2
|
|
BLAKE2b-256 checksum How to use checksums |
95b479af66ce7736aab5b4a00965f1fcee7218d9dfaacb45f36576d855d20644
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyalgoengine-0.12.3.post1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyalgoengine-0.12.3.post1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 8.6 MB |
| Tags | CPython 3.15 CPython 3.15 free-threading Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
683750900ba8a5254ca237a8c59a885d161ebaa1c9bfc958762fb1b8a7d8450a
|
|
BLAKE2b-256 checksum How to use checksums |
a39e5a0313e7973004ae025667fb548d70a77643dffde36d31a4dcf9bbb6ec35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyalgoengine-0.12.3.post1-cp315-cp315-win_amd64.whl
| Download URL | pyalgoengine-0.12.3.post1-cp315-cp315-win_amd64.whl |
|---|---|
| Size | 4.5 MB |
| Tags | CPython 3.15 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
594c00c66817dd3917f75b4ec5616c8623819b0e62efbad47c890d2b5a6cf715
|
|
BLAKE2b-256 checksum How to use checksums |
89dbe23bfd2cb3aa31703fe2f65b7be0034af1d84216bbad5004bef33e13b5b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyalgoengine-0.12.3.post1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyalgoengine-0.12.3.post1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 8.5 MB |
| Tags | CPython 3.15 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
46b7bbb8ab3fdcd7005da7115d4e7130eaa298edc048584af9176a33feb586e7
|
|
BLAKE2b-256 checksum How to use checksums |
1fa69a836409c42bb2ba86496a8a809fa8a72d902d97efd0977c28a3f47f5f4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyalgoengine-0.12.3.post1-cp314-cp314t-win_amd64.whl
| Download URL | pyalgoengine-0.12.3.post1-cp314-cp314t-win_amd64.whl |
|---|---|
| Size | 4.5 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Windows x86-64 |
|
SHA-256 checksum How to use checksums |
1cb4d025477a720282097788dc7ae552377b9f58f02f5f58fed3ead5fdabd01e
|
|
BLAKE2b-256 checksum How to use checksums |
a353a83114dbcb70b6a0522f588f3a5dc5e9de794501315b129cc7aa674bbaec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyalgoengine-0.12.3.post1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyalgoengine-0.12.3.post1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 8.6 MB |
| Tags | CPython 3.14 CPython 3.14 free-threading Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
a3871693973d2984f9c965ad223103e872bd47ae20ffab7604988bb06c93db61
|
|
BLAKE2b-256 checksum How to use checksums |
86452b7886bbc9115460c77773404a9442a23b3c3788584d13cb66417430617e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyalgoengine-0.12.3.post1-cp314-cp314-win_amd64.whl
| Download URL | pyalgoengine-0.12.3.post1-cp314-cp314-win_amd64.whl |
|---|---|
| Size | 4.5 MB |
| Tags | CPython 3.14 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
3284d83a5c81c83f1317916a235d1fa615344c2d607d77120818921f5da22d67
|
|
BLAKE2b-256 checksum How to use checksums |
f46b106eec315b82854c45bf28ac77365b7184b1a21dd5787e73741b0165d84c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyalgoengine-0.12.3.post1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyalgoengine-0.12.3.post1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 8.4 MB |
| Tags | CPython 3.14 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
beb0e2a2734e1e94d881480352b374f32fbedd47667c388da0c15b2f1398f28f
|
|
BLAKE2b-256 checksum How to use checksums |
0c84023b893c9ec59ffc0f74203e7606511d5e262d7e191b900a7adb791dc9e4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyalgoengine-0.12.3.post1-cp313-cp313-win_amd64.whl
| Download URL | pyalgoengine-0.12.3.post1-cp313-cp313-win_amd64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.13 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
986790873d0a1dccd20741808380dc7e401a6efe33085cb69bfab8425e576daa
|
|
BLAKE2b-256 checksum How to use checksums |
158d6233a5589ca5e5b43917a123f0d2e197a2db9b8fbf69ab1f716c7690e20f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyalgoengine-0.12.3.post1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyalgoengine-0.12.3.post1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 8.4 MB |
| Tags | CPython 3.13 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
14aea7e3cb61099e24bc29753023e9247d2db3a394fb2402da3ac521c1487e6e
|
|
BLAKE2b-256 checksum How to use checksums |
87577fab11ced62200f4e9988c032b3cbaaba126b323acc9a1ba118ecab9070c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyalgoengine-0.12.3.post1-cp312-cp312-win_amd64.whl
| Download URL | pyalgoengine-0.12.3.post1-cp312-cp312-win_amd64.whl |
|---|---|
| Size | 4.4 MB |
| Tags | CPython 3.12 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
f1efa08e4b69cf769da35aa03e8eaab6ab99c6f84ddb93f380bd2cc6f0788598
|
|
BLAKE2b-256 checksum How to use checksums |
f31c90b69cc580054cc62a1e294af639b21ccb3890ae92f7bf440fcb701eaa2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / pyalgoengine-0.12.3.post1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
| Download URL | pyalgoengine-0.12.3.post1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl |
|---|---|
| Size | 8.5 MB |
| Tags | CPython 3.12 Linux glibc 2.17+ x86-64 Linux glibc 2.28+ x86-64 |
|
SHA-256 checksum How to use checksums |
f6fd721b64611593fb77933009aef29559dae8b6eebbe551382bc0757d9d1186
|
|
BLAKE2b-256 checksum How to use checksums |
e66e3a025bc9f18c5f1e161eac6e806d9bbd7e5a123a0c97dfdfd4ba451c622d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Security for PyAlgoEngine 0.12.3.post1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.