Skip to main content

PyAlgoEngine

gitlab

GitHub Actions: ⛔ temporarily disabled — kept disabled until the GitHub Actions issue is resolved. See .github/workflows/README.md. CI runs on the GitLab mirror pipeline while disabled.

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.4-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (9.9 MB view details)

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

pyalgoengine-0.12.4-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (9.8 MB view details)

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

pyalgoengine-0.12.4-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (9.9 MB view details)

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

pyalgoengine-0.12.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (9.8 MB view details)

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

pyalgoengine-0.12.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (9.7 MB view details)

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

pyalgoengine-0.12.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (9.8 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.4-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.4-cp315-cp315t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8c18792896e5dc8a94990b4cd321ae61727f2cbdc5361586895126e5c34c7a98
MD5 888daee5e638b2d31ee4a1bdb4eeb4a5
BLAKE2b-256 225d4a6b8703cd3549719dc37a530e8c33cf7ca94d51283f1afe4dfda6e7dc6c

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.4-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.4-cp315-cp315-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c391c7c78df3d5d0c652e96971ca2a3169aeb1cd3bc7ea4b4fa98260570a1231
MD5 d3b2831ee296aba6014494841aeb242d
BLAKE2b-256 8357397f1c9705e8643b920d2b1e511000890941c645640ac21020ba135c8ed6

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.4-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.4-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 514934631c9f2ab48e2381de2cf4c7b475fa65fe04c2b9b4fc96c89bd310aea7
MD5 0734711cf41b6e6b72846cfdb468e981
BLAKE2b-256 f9590fd792dc8c588af057c0d2bb75fbb93f8819daee2a350dcaeb42bd301c3e

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.4-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.4-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6e2aae5e8c6ab21b5c38201cc46bae7158a9594eb7da297e4a0dfb9a620d6bf7
MD5 7475528a89b7f654df4738c4987d1d18
BLAKE2b-256 34052fcba329c8a6061c96c0f25e4e8903aa2e1d4656e83512b60fb2c3b41ecd

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.4-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.4-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e149f041905e36f71def96860a5c594faee8f070434e966cca17c39c22183db8
MD5 6c0bf5ad161988ff9fdf64fc37774274
BLAKE2b-256 d27190fb9faa535bcf911aaf324d8d4707de02e7c9a898182be04f80b42b5900

See more details on using hashes here.

File details

Details for the file pyalgoengine-0.12.4-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.4-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d8719e30a30c0387936338b9bc70af6e6bfe30b13a154fd7aaafb7af8c778a12
MD5 1422ca9a17750e0d92a5a5388242e67e
BLAKE2b-256 9595ea792e907727df1b8faeaefc1ffac8156a315590bb0e5c9e948e98c56152

See more details on using hashes here.

Release history Release notifications | RSS feed

0.12.6

12 files

0.12.5

6 files

This release

0.12.4 This release

6 files

0.12.3.post1

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