A high-performance order book implementation in Python
Project description
py-orderbook
A high-performance order book implementation in Python.
Features
- Price-time priority matching engine
- Limit and market order support
- Order cancellation
- 124k+ matched orders/second throughput
Installation & Setup
git clone https://github.com/Akhil4n/py-orderbook.git
cd py-orderbook
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
Usage
from orderbook import OrderBook, Order, MarketOrder, OrderSide
from decimal import Decimal
book = OrderBook()
# Add a limit order
order = Order(side=OrderSide.BID, price=Decimal("50.00"), original_quantity=100)
book.add_limit_order(order)
# Add a market order
market_order = MarketOrder(side=OrderSide.ASK, original_quantity=50)
book.add_market_order(market_order)
print(book) # displays current bids and asks
Running Tests
pytest test_orderbook.py -v
Project Structure
py-orderbook/
├── orderbook.py # Core order book implementation
├── test_orderbook.py # Unit tests
├── stress_test.py # Performance benchmarks
└── requirements.txt
Project details
Release history Release notifications | RSS feed
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 Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file akhil4n_orderbook-0.1.0-py3-none-any.whl.
File metadata
- Download URL: akhil4n_orderbook-0.1.0-py3-none-any.whl
- Upload date:
- Size: 1.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6b3c86a737d33d5ed99279034208de86c23f43003974fd02124a3ca88be1616
|
|
| MD5 |
6941bfd979a4f68319eca23660c878bf
|
|
| BLAKE2b-256 |
19418c38fbe05961522925f94628d42e5c90e13372f1062117654cc94baac415
|