Skip to main content

A compact aggregate order-book market simulator.

Project description

orderwave

Compact aggregate order-book simulation for Python.

orderwave generates a sparse bid/ask book, samples limit/market/cancel flow from explicit distributions, and records a small summary history. The public API is intentionally narrow: build a Market, step or run it, inspect the latest snapshot, and read the summary frame.

Overview

Install

pip install orderwave

Quick Start

from orderwave import Market

market = Market(seed=42)
result = market.run(steps=1_000)

snapshot = result.snapshot
history = result.history

Common overrides stay in config:

from orderwave import Market, MarketConfig

config = MarketConfig(
    market_rate=3.0,
    fair_price_vol=0.45,
    max_spread_ticks=4,
)

market = Market(seed=7, config=config)
market.gen(steps=500)
snapshot = market.get()

Public API

  • Market(...): create a simulator with an initial price, tick size, visible depth, seed, and optional MarketConfig.
  • step(): advance one step and return the latest snapshot.
  • gen(steps): run multiple steps and return the latest snapshot.
  • run(steps): return SimulationResult(snapshot=..., history=...).
  • get(): return the current snapshot as a dict.
  • get_history(): return the summary history as a pandas.DataFrame.

Snapshot fields:

  • step
  • last_price
  • mid_price
  • best_bid
  • best_ask
  • spread
  • bids
  • asks
  • bid_depth
  • ask_depth
  • depth_imbalance
  • buy_aggr_volume
  • sell_aggr_volume
  • fair_price

History columns:

  • step
  • last_price
  • mid_price
  • best_bid
  • best_ask
  • spread
  • bid_depth
  • ask_depth
  • depth_imbalance
  • buy_aggr_volume
  • sell_aggr_volume
  • fair_price

Model

The simulator keeps only one internal model family:

  • 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 and current depth imbalance.
  • Event level is sampled from a truncated decay distribution.
  • Event size is sampled from a bounded lognormal distribution.

There are no presets, participant taxonomies, latent regimes, validation pipelines, or plotting APIs in the runtime package.

Documentation Assets

Book

Diagnostics

Variants

Regenerate the documentation images with:

python -m scripts.render_doc_images

More docs:

Project details


Download files

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

Source Distribution

orderwave-0.6.0.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

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

orderwave-0.6.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file orderwave-0.6.0.tar.gz.

File metadata

  • Download URL: orderwave-0.6.0.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for orderwave-0.6.0.tar.gz
Algorithm Hash digest
SHA256 f26dd9a83709de595e8e65b59253891edf1a1d52b539b923bff7350a4c30b444
MD5 829d2d95fa1447a3f3133e237ee846ce
BLAKE2b-256 5d408fdbb261eaffd1ee3fae8c78f46e0ae6ccfa85dba848025507c1d9530652

See more details on using hashes here.

Provenance

The following attestation bundles were made for orderwave-0.6.0.tar.gz:

Publisher: workflow.yml on smturtle2/quoteflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file orderwave-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: orderwave-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for orderwave-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8032ee65e10bee0c4855e06f1804dff09dc9bf379b8f0026f25053c7ebe92541
MD5 9f55594dc4d0dad82d501e4102dc5e55
BLAKE2b-256 aae9722437c708affec9bf084798acd78e999759cebabc8bec63ddc01c57f183

See more details on using hashes here.

Provenance

The following attestation bundles were made for orderwave-0.6.0-py3-none-any.whl:

Publisher: workflow.yml on smturtle2/quoteflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page