Skip to main content

PyAlgoEngine

docs pypi-linux pypi-windows

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

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyalgoengine-0.12.3.post1-cp315-cp315t-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.15tWindows x86-64

pyalgoengine-0.12.3.post1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.15tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pyalgoengine-0.12.3.post1-cp315-cp315-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.15Windows x86-64

pyalgoengine-0.12.3.post1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.15manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pyalgoengine-0.12.3.post1-cp314-cp314t-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.14tWindows x86-64

pyalgoengine-0.12.3.post1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pyalgoengine-0.12.3.post1-cp314-cp314-win_amd64.whl (4.5 MB view details)

Uploaded CPython 3.14Windows x86-64

pyalgoengine-0.12.3.post1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (8.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pyalgoengine-0.12.3.post1-cp313-cp313-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.13Windows x86-64

pyalgoengine-0.12.3.post1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (8.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

pyalgoengine-0.12.3.post1-cp312-cp312-win_amd64.whl (4.4 MB view details)

Uploaded CPython 3.12Windows x86-64

pyalgoengine-0.12.3.post1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (8.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file pyalgoengine-0.12.3.post1-cp315-cp315t-win_amd64.whl.

File metadata

File hashes

Hashes for pyalgoengine-0.12.3.post1-cp315-cp315t-win_amd64.whl
Algorithm Hash digest
SHA256 b011f7dea32ad955e1fb65b67395c94724e269e11e44cdb9553b59ac6d0763f2
MD5 46a75612eac808e60c3e06338865cf74
BLAKE2b-256 95b479af66ce7736aab5b4a00965f1fcee7218d9dfaacb45f36576d855d20644

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.3.post1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyalgoengine-0.12.3.post1-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 683750900ba8a5254ca237a8c59a885d161ebaa1c9bfc958762fb1b8a7d8450a
MD5 100fe188cfc216b442b42ab7eb286c41
BLAKE2b-256 a39e5a0313e7973004ae025667fb548d70a77643dffde36d31a4dcf9bbb6ec35

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.3.post1-cp315-cp315-win_amd64.whl.

File metadata

File hashes

Hashes for pyalgoengine-0.12.3.post1-cp315-cp315-win_amd64.whl
Algorithm Hash digest
SHA256 594c00c66817dd3917f75b4ec5616c8623819b0e62efbad47c890d2b5a6cf715
MD5 e7ca8f478e2911c665ac857c60241b6f
BLAKE2b-256 89dbe23bfd2cb3aa31703fe2f65b7be0034af1d84216bbad5004bef33e13b5b3

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.3.post1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyalgoengine-0.12.3.post1-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 46b7bbb8ab3fdcd7005da7115d4e7130eaa298edc048584af9176a33feb586e7
MD5 6b064354ede63d8989695e97647d266b
BLAKE2b-256 1fa69a836409c42bb2ba86496a8a809fa8a72d902d97efd0977c28a3f47f5f4e

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.3.post1-cp314-cp314t-win_amd64.whl.

File metadata

File hashes

Hashes for pyalgoengine-0.12.3.post1-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 1cb4d025477a720282097788dc7ae552377b9f58f02f5f58fed3ead5fdabd01e
MD5 efe6540419dadd3e85a62f68f3d0ddbe
BLAKE2b-256 a353a83114dbcb70b6a0522f588f3a5dc5e9de794501315b129cc7aa674bbaec

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.3.post1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyalgoengine-0.12.3.post1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a3871693973d2984f9c965ad223103e872bd47ae20ffab7604988bb06c93db61
MD5 99ed34f333855d24035be01a8d04989f
BLAKE2b-256 86452b7886bbc9115460c77773404a9442a23b3c3788584d13cb66417430617e

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.3.post1-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for pyalgoengine-0.12.3.post1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 3284d83a5c81c83f1317916a235d1fa615344c2d607d77120818921f5da22d67
MD5 b8a26dfedee20fb8068df4100fc0ac04
BLAKE2b-256 f46b106eec315b82854c45bf28ac77365b7184b1a21dd5787e73741b0165d84c

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.3.post1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyalgoengine-0.12.3.post1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 beb0e2a2734e1e94d881480352b374f32fbedd47667c388da0c15b2f1398f28f
MD5 0b6c23a0d75cab763b1702757942387a
BLAKE2b-256 0c84023b893c9ec59ffc0f74203e7606511d5e262d7e191b900a7adb791dc9e4

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.3.post1-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyalgoengine-0.12.3.post1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 986790873d0a1dccd20741808380dc7e401a6efe33085cb69bfab8425e576daa
MD5 4d2d142fa942ea755ca4c5686253232b
BLAKE2b-256 158d6233a5589ca5e5b43917a123f0d2e197a2db9b8fbf69ab1f716c7690e20f

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.3.post1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyalgoengine-0.12.3.post1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 14aea7e3cb61099e24bc29753023e9247d2db3a394fb2402da3ac521c1487e6e
MD5 b4d935b14d89036597d78b7ff13a2bfc
BLAKE2b-256 87577fab11ced62200f4e9988c032b3cbaaba126b323acc9a1ba118ecab9070c

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.3.post1-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyalgoengine-0.12.3.post1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 f1efa08e4b69cf769da35aa03e8eaab6ab99c6f84ddb93f380bd2cc6f0788598
MD5 1daf5cc26d0ea1b6e487ed28015b41f5
BLAKE2b-256 f31c90b69cc580054cc62a1e294af639b21ccb3890ae92f7bf440fcb701eaa2a

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.3.post1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyalgoengine-0.12.3.post1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f6fd721b64611593fb77933009aef29559dae8b6eebbe551382bc0757d9d1186
MD5 1cbd4ee857a958db873b86f90c766e79
BLAKE2b-256 e66e3a025bc9f18c5f1e161eac6e806d9bbd7e5a123a0c97dfdfd4ba451c622d

See more details on using hashes here.

Release history Release notifications | RSS feed

0.12.6

12 files

0.12.5

6 files

0.12.4

6 files

This release

0.12.3.post1 This release

12 files

0.12.3

12 files

0.12.0.post3

8 files

0.12.0.post2

4 files

0.12.0.post1

4 files

0.11.2.post4

4 files

0.11.2.post3

4 files

0.11.2.post1

4 files

0.11.1.post2

4 files

0.10.8

4 files

0.10.6

4 files

0.10.5

4 files

0.10.0

4 files

0.9.4.post6

4 files

0.9.4.post1

4 files

0.9.1

4 files

0.9.0

4 files

0.8.6

2 files

0.8.5

2 files

0.8.4.post1

2 files

0.8.3

2 files

0.8.0.post5

4 files

0.8.0.post4

2 files

0.8.0.post3

2 files

0.8.0.post2

2 files

0.8.0

2 files

0.7.7.post1

2 files

0.7.7

2 files

0.7.6.post8

2 files

0.7.6.post7

2 files

0.7.6.post6

2 files

0.7.6.post5

2 files

0.7.6.post4

2 files

0.7.6.post3

2 files

0.7.6.post2

2 files

0.7.6.post1

2 files

0.7.6

2 files

0.7.5.post2

2 files

0.7.5.post1

2 files

0.7.5

2 files

0.7.4.post1

2 files

0.7.4

2 files

0.5.4.post11

1 file

0.5.4.post10

1 file

0.5.4.post8

1 file

0.5.4.post7

1 file

0.5.4.post6

1 file

0.5.4.post4

1 file

0.5.4

1 file

0.5.2

1 file

0.4.3

1 file

0.4.2

1 file

0.4.1

1 file

0.4.0.post2

1 file

0.4.0.post1

1 file

0.4.0

1 file

0.3.13.post1

1 file

0.3.13

1 file

0.3.12.post4

1 file

0.3.12.post3

1 file

0.3.11.post1

1 file

0.3.10

1 file

0.3.9.post4

1 file

0.3.9.post2

1 file

0.3.9.post1

1 file

0.3.8.post1

1 file

0.3.8

1 file

0.3.6

1 file

0.3.5

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page