A compact aggregate order-book market simulator.
Project description
orderwave
Compact aggregate order-book simulation for Python, with readable built-in heatmaps.
orderwave keeps the runtime model small: a sparse bid/ask book, Poisson limit/market/cancel flow, bounded mean-reverting fair value, and a light liquidity-state kernel that creates sweep and refill structure without the older heuristic stack.
Install
pip install orderwave
Quick Start
from orderwave import Market
market = Market(seed=42, capture="visual")
result = market.run(steps=1_000)
snapshot = result.snapshot
history = result.history
overview = market.plot()
heatmap = market.plot_heatmap(anchor="price")
book = market.plot_book()
Public API
Market(...): create a simulator with an initial price, tick size, visible depth, seed, optionalMarketConfig, andcapture="summary" | "visual".step(): advance one step and return the latest snapshot.gen(steps): run multiple steps and return the latest snapshot.run(steps): returnSimulationResult(snapshot=..., history=...).get(): return the current snapshot as adict.get_history(): return the summary history as apandas.DataFrame.plot(): render the price path with a mid-anchored signed-depth heatmap. Requirescapture="visual".plot_heatmap(anchor="mid" | "price"): render a standalone heatmap. Requirescapture="visual".plot_book(): render the current order book.
capture="summary" keeps the fast path lean. capture="visual" stores a fixed signed-depth window around the moving market center so the heatmap can show sweep, void, and refill structure clearly.
Snapshot and History
Snapshot fields:
steplast_pricemid_pricebest_bidbest_askspreadbidsasksbid_depthask_depthdepth_imbalancebuy_aggr_volumesell_aggr_volumefair_price
History columns:
steplast_pricemid_pricebest_bidbest_askspreadbid_depthask_depthdepth_imbalancebuy_aggr_volumesell_aggr_volumefair_price
Model
- Fair price follows a bounded mean-reverting Gaussian process.
- Limit, market, and cancel counts are sampled from Poisson distributions.
- Event side is driven by fair-value gap, depth imbalance, and recent signed flow.
- Limit placement mixes inside join/improve, best-level refill, and deeper wall placement.
- Aggressive flow raises side-specific stress and refill pressure so the heatmap shows asymmetric withdrawal and recovery.
Documentation Assets
Regenerate the documentation images with:
python -m scripts.render_doc_images
Render the standalone heatmap example with:
python -m examples.plot_market_heatmap --output artifacts/orderwave_heatmap.png
More docs:
- English: docs/en/README.md
- Korean: README.ko.md
- Release process: docs/en/releasing.md
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 Distribution
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 orderwave-0.6.1.tar.gz.
File metadata
- Download URL: orderwave-0.6.1.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0e28fcfdf2bf21c296e881bc00ed6cf3b4bc8967f56fb34aaff1bc2b96bb8db
|
|
| MD5 |
102e8fd0fe1eba6d4f23f372145fee4e
|
|
| BLAKE2b-256 |
c01c7a4c08bc7b74f89476c360a0f8adcde3433370284d4d91953c7e0bc9a772
|
Provenance
The following attestation bundles were made for orderwave-0.6.1.tar.gz:
Publisher:
workflow.yml on smturtle2/quoteflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orderwave-0.6.1.tar.gz -
Subject digest:
b0e28fcfdf2bf21c296e881bc00ed6cf3b4bc8967f56fb34aaff1bc2b96bb8db - Sigstore transparency entry: 1089905579
- Sigstore integration time:
-
Permalink:
smturtle2/quoteflow@b72135ed5bc72b040b905919133d62a6d3d971c7 -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/smturtle2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@b72135ed5bc72b040b905919133d62a6d3d971c7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file orderwave-0.6.1-py3-none-any.whl.
File metadata
- Download URL: orderwave-0.6.1-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
561bec09420e7e29334a00aa10da55c2ec9d8ef73e72e41e3c0977c1f8e568d3
|
|
| MD5 |
35ce436da8614c023df2c9a9a92a2f06
|
|
| BLAKE2b-256 |
7aaab520cf2c1ef71a2229e19facfdca28ead397bf7ce3423a6db3182669420a
|
Provenance
The following attestation bundles were made for orderwave-0.6.1-py3-none-any.whl:
Publisher:
workflow.yml on smturtle2/quoteflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
orderwave-0.6.1-py3-none-any.whl -
Subject digest:
561bec09420e7e29334a00aa10da55c2ec9d8ef73e72e41e3c0977c1f8e568d3 - Sigstore transparency entry: 1089905586
- Sigstore integration time:
-
Permalink:
smturtle2/quoteflow@b72135ed5bc72b040b905919133d62a6d3d971c7 -
Branch / Tag:
refs/tags/v0.6.1 - Owner: https://github.com/smturtle2
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@b72135ed5bc72b040b905919133d62a6d3d971c7 -
Trigger Event:
release
-
Statement type: