Market Microstructure Simulator
A price-time priority matching engine and an event-driven market simulator for studying liquidity provision, execution quality and adverse selection, in pure Python with no runtime dependencies.
- Matching engine. Integer tick grid, O(1) cancel,
GTC/IOC/FOK, market and post-only orders, self-trade prevention, exchange-style modify semantics and FIX-like execution reports. Its correctness is checked against an independent reference model with property-based testing. - Closed-loop market. Zero-intelligence noise traders and informed traders around a latent fundamental value, so prices are discovered and liquidity providers face real adverse selection.
- Realistic preset. Stochastic volatility, self-exciting order flow and
institutions splitting large orders.
MarketConfig.realistic()reproduces fat tails, volatility clustering, uncorrelated returns, long memory in order signs and square-root price impact, measured with themicrobook.stylizedtoolkit. - Research layer. Order-entry latency, strategy timers and callbacks; four market makers including Avellaneda–Stoikov; markouts, slippage vs arrival, spread capture, PnL and inventory analytics; deterministic, seed-controlled experiments.
Documentation: space-paragon1.github.io/Market-Microstructure-Simulator (getting started, concepts, guides and the API reference).
pip install microstructure-sim # the import name is microbook
pip install "microstructure-sim[plot]" # plus matplotlib, for the example figures
pip install "microstructure-sim[rl]" # plus gymnasium, for the RL environment
Try it in your browser
The Market Maker Playground
runs the simulator in the page, with no server, using Pyodide
(CPython compiled to WebAssembly). Pick a market maker and a market, add latency or
informed traders, and see PnL, inventory and markouts; 20,000 steps take about a
second. The source is in docs/demo/.
Results
examples/compare_market_makers.py runs every strategy in the same market over
16 seeds × 20,000 time steps. For a given seed, every strategy faces the identical
fundamental path and exogenous order arrivals (common random numbers). The 192
simulations take about 26 s on a laptop.
1. Strategy comparison (latency 0; t = ticks per share)
| Strategy | PnL | s.e. | Sharpe | Mean |inv| | Spread capture | Markout @1 | Markout @100 |
|---|---|---|---|---|---|---|---|
| Symmetric MM | 4.43 | 0.16 | 6.47 | 1.88 | 0.56 t | 0.44 t | 0.29 t |
| Adaptive MM | 5.04 | 0.21 | 6.89 | 1.97 | 0.59 t | 0.49 t | 0.35 t |
| Adaptive MM, no imbalance lean | 4.46 | 0.22 | 5.97 | 1.98 | 0.61 t | 0.50 t | 0.34 t |
| Avellaneda–Stoikov (rolling τ) | 4.53 | 0.17 | 6.38 | 1.81 | 0.58 t | 0.46 t | 0.31 t |
2. Latency (Adaptive MM)
| Latency (steps) | 0 | 5 | 20 | 50 |
|---|---|---|---|---|
| PnL | 5.04 ± 0.21 | 1.59 ± 0.26 | −7.27 ± 0.59 | −18.63 ± 1.19 |
| Markout @100 | 0.35 t | 0.33 t | 0.18 t | −0.26 t |
3. Informed flow (Adaptive MM)
| Informed arrivals / step | 0.0 | 0.2 | 0.4 | 0.8 |
|---|---|---|---|---|
| PnL | 5.50 ± 0.09 | 6.78 ± 0.13 | 5.04 ± 0.21 | 0.52 ± 0.22 |
| Sharpe | 16.3 | 12.4 | 6.9 | 0.5 |
| Markout @100 | 0.48 t | 0.41 t | 0.35 t | 0.16 t |
What the experiments show:
- Markouts decay with horizon for every maker. Part of the spread earned at the fill is given back as the price moves against it. That is adverse selection, measured directly.
- The order-book-imbalance signal is worth about +0.6 PnL (5.04 vs 4.46). It is the only difference between those two runs.
- Latency is ruinous for a liquidity provider. Slow quotes become stale. At 50 steps the 100-step markout turns negative: the maker is systematically picked off.
- Informed flow cuts both ways. It brings volume, so PnL first rises, but Sharpe and markouts fall monotonically, and at high intensity adverse selection overwhelms the spread.
- Avellaneda–Stoikov needs γ calibrated to the realized mid volatility, which is about 3.6× lower than the fundamental's, because the book lags and smooths the latent value. With a γ chosen against the fundamental, its inventory skew is negligible and it carries inventory through trends.
Single seed. The book tracks the latent fundamental with a lag; the Adaptive MM's inventory mean-reverts around zero. Rankings on one seed differ from the 16-seed averages above.
Does the simulated market look real?
Real markets share a set of statistical signatures, the stylized facts (Cont
2001; Bouchaud et al. 2018). examples/stylized_facts.py measures them in the
default market and in MarketConfig.realistic() (8 seeds × 200,000 steps, read
as seconds; 20 s on a laptop):
| Statistic | MarketConfig() |
.realistic() |
Real markets |
|---|---|---|---|
| Tail index (Hill, 10-step returns) | 7.1 | 2.7 | ≈ 3 (2–5) |
| Excess kurtosis at 10 / 100 / 1,000 steps | 4.5 / 0.2 / −0.6 | 40 / 4.0 / 1.6 | large, falling with horizon |
| Return autocorrelation, lag 1 (100-step returns) | 0.52 | −0.01 | ≈ 0 |
| Return autocorrelation, lag 1 (10-step returns) | 0.04 | −0.08 | ≈ 0 or slightly < 0 (bid-ask bounce) |
| |Return| autocorrelation at 10 / 100 / 1,000 steps | 0.11 / 0.02 / 0.00 | 0.32 / 0.10 / 0.03 | > 0, slow decay |
| Order-sign autocorrelation, lag 1 / 10 / 100 / 1,000 | 0.39 / 0.36 / 0.14 / −0.01 | 0.39 / 0.31 / 0.05 / 0.02 | ≈ c·lag^−0.5 |
| Order-sign decay, fitted exponent | – | 0.52 | ≈ 0.5 |
| Impact prefactor Y in I = Yσ√(Q/V) | – | 0.49 ± 0.02 | 0.5–1 |
The preset reproduces every fact in the table, and held-out seeds (11–18) give the same numbers within their error bars. Long memory in order signs comes from metaorders split into many small child orders. One metaorder then spans hundreds of trades, as institutional executions do. The same splitting lets a metaorder move the price faster than arbitrage pulls it back, which gives a concave, square-root impact curve (fitted exponent 0.51).
What it does not capture: in this model the impact of a metaorder is a race between its execution and arbitrage, so Y is roughly proportional to execution speed. With one child order every 10 / 4 / 2 / 1 steps, Y is 0.0 / 0.14 / 0.27 / 0.49, with everything else fixed. In real markets the participation rate matters much less. The preset matches the square-root law at its calibrated speed, but the law does not emerge at every speed. The tail index (2.7) is also slightly below the typical 3.
Against real data
The literature values above come from many markets and studies.
examples/real_data_facts.py measures one real market directly, with the same
code: every public BTC/USD trade on Kraken on 4 June 2024 (UTC), 26,649 trades
from 15,976 aggressive orders, downloaded from Kraken's public API (the date is
fixed, so anyone gets the same data):
| Statistic | Simulator (.realistic()) |
Kraken BTC/USD, 2024-06-04 |
|---|---|---|
| Tail index (Hill, 10 s returns) | 2.74 | 3.04 |
| Excess kurtosis at 10 s / 100 s / 1,000 s | 40.1 / 4.0 / 1.6 | 28.0 / 6.7 / 0.9 |
| Return autocorrelation, lag 1 (100 s returns) | −0.01 | 0.05 |
| Return autocorrelation, lag 1 (10 s returns) | −0.08 | 0.11 |
| |Return| autocorrelation at 10 s / 100 s / 1,000 s | 0.32 / 0.10 / 0.03 | 0.14 / 0.10 / 0.08 |
| Order-sign autocorrelation, lag 1 / 10 / 100 / 1,000 | 0.39 / 0.31 / 0.05 / 0.02 | 0.28 / 0.17 / 0.03 / 0.02 |
| Order-sign decay, fitted exponent | 0.53 | 0.46 |
The simulator column averages 8 seeds of 200,000 steps, a step read as one second; the Kraken column is one day. They agree on every fact: fat tails that thin out with the horizon, little linear autocorrelation, volatility clustering, and order signs with long memory decaying at about lag^−0.5. The magnitudes differ, and some differences are in the data rather than the model:
- Crypto, not equities. The preset is calibrated to equity-like statistics. Bitcoin trades around the clock, with no open or close, and one exchange sees only part of the market's flow.
- Trade prices, not mids. The public data has trades but no quotes, so the real price path is the last trade price. On a day with one aggressive order every five seconds, many 10-second intervals have no trade and the price is stale; stale prices give the positive lag-1 autocorrelation of 10-second returns (0.11). The simulator's mid moves with every quote and shows the usual small negative value from bid-ask bounce.
- Clock time vs trade time. Both columns sample on a clock in seconds, but the simulator's activity is the same at every hour, while real activity follows the time of day: it is busiest when the US and European markets are open. That daily pattern alone keeps the autocorrelation of |returns| positive at long lags, which is part of why it is higher in the real data at 1,000 s (0.08 against 0.03).
- One day is one sample. The Kraken numbers carry the noise of a single
day; the fitted exponent and the long-lag autocorrelations move from day to
day. Run another day with
--start.
Price impact is not compared: it needs metaorders, and public trade data does not say which trades belong to one.
Matching engine
from microbook import LimitOrderBook, Order, Side, STPMode, TimeInForce
lob = LimitOrderBook(tick_size=0.01, stp=STPMode.CANCEL_RESTING)
lob.submit(Order.limit("a1", Side.SELL, 100.02, 5, owner="mm"))
lob.submit(Order.limit("a2", Side.SELL, 100.03, 10))
r = lob.submit(Order.limit("b1", Side.BUY, 100.03, 20)) # sweeps 2 levels, rests 5
print(r.status, [(f.price, f.qty) for f in r.fills], r.resting_qty)
# OrderStatus.PARTIALLY_FILLED [(100.02, 5), (100.03, 10)] 5
r = lob.submit(Order.limit("b2", Side.SELL, 100.03, 8, tif=TimeInForce.IOC))
print(r.status, r.filled_qty, r.canceled_qty) # CANCELED 5 3
r = lob.modify("b1", new_qty=0) # cancel via modify
print(lob.depth(), lob.check_invariants())
examples/quickstart.py tours every feature.
| Message | Semantics |
|---|---|
LIMIT GTC |
match while crossing, rest the remainder |
LIMIT IOC |
match while crossing, cancel the remainder |
LIMIT FOK |
fill completely or do nothing (pre-checked, no side effects) |
MARKET |
sweep the opposite side, never rests |
post_only |
rejected if it would take liquidity |
modify reduce |
same price, smaller size: amended in place, keeps priority |
modify reprice / increase |
loses priority (cancel/replace); a crossing reprice trades and returns its fills |
| self-trade | NONE, CANCEL_RESTING or CANCEL_INCOMING, keyed on Order.owner |
| invalid input | duplicate id, off-tick price, bad modify → REJECTED, book untouched |
Data structures. Prices are stored as integer ticks, so float keys can never
alias and off-grid prices are rejected. Each side keeps a sorted list of price
keys with the best price at the end, so reading or removing the touch is O(1).
Each level is an OrderedDict (FIFO, O(1) removal by id) with an incrementally
maintained aggregate size.
Correctness. tests/test_book_model.py drives random sequences of submits,
cancels, modifies and duplicate submits through the engine and through a
deliberately naive reference book (a flat list re-sorted on every message), under
all three STP modes. After every step the two must agree exactly on fills,
statuses and depth, and check_invariants() must pass. Injecting a FIFO
violation, an off-by-one in the crossing test, or a stale level-size cache each
makes the test fail.
Performance (benchmarks/bench_book.py: 200k messages, 55% passive adds, 35%
cancels, 10% aggressive; Apple M2, CPython 3.12):
| v0.1 | v0.2 | |
|---|---|---|
| Throughput | 139k msg/s | 484k msg/s |
| Cancel p50 / p99 | 13.8 µs / 44.4 µs | 0.50 µs / 1.08 µs |
| Aggressive p50 | 2.00 µs | 1.96 µs |
| Passive add p50 | 0.54 µs | 0.88 µs |
Passive adds are slower because they now pay for duplicate-id protection, tick
validation and an execution report. Cancels dominate real message traffic, so
throughput still improves 3.5×. The full simulator, including agents and
analytics, runs at about 200k events/s (benchmarks/bench_sim.py).
Optional native build. The engine (book.py, order.py, types.py) can be
compiled with mypyc. This needs a C compiler:
HATCH_BUILD_HOOK_ENABLE_MYPYC=true pip install --no-binary microstructure-sim microstructure-sim
# from a checkout: build through the sdist, which compiles in a temporary copy
HATCH_BUILD_HOOK_ENABLE_MYPYC=true python -m build -o native/ && pip install native/*.whl
Avoid pip install . and python -m build --wheel with the hook enabled: mypyc
compiles in place and leaves .so files in src/microbook/. Those shadow the
Python sources, so an editable install would silently ignore your edits.
The code is the same and CI runs the whole test suite against the compiled
wheel, including the golden digests, so seeded results are identical. One
difference: mypyc drops class docstrings, so help(LimitOrderBook) is empty in a
compiled install (the documentation site has them). Best of 7 runs of the benchmark above:
| pure Python | compiled | |
|---|---|---|
| Throughput | 521k msg/s | 597k msg/s |
| Passive add p50 | 0.83 µs | 0.58 µs |
| Aggressive p50 | 1.88 µs | 1.46 µs |
| Cancel p50 | 0.38 µs | 0.33 µs |
The whole simulator gains only 10–20%, because agents and strategies stay interpreted (they are meant to be subclassed). The gain is too small to justify platform-specific wheels, so the published wheel is pure Python.
Simulator
flowchart LR
Q[("event heap<br/>(time, seq)")] -->|SUBMIT / CANCEL / MODIFY| B[LimitOrderBook]
B -->|ExecutionReport + fills| S[MarketSimulator]
S -->|portfolio, metrics| P[Portfolio / ExecutionMetrics]
S -->|on_fill / on_report| ST[Strategies & agents]
Q -->|SNAPSHOT → on_tick<br/>TIMER → on_timer| ST
ST -->|Actions, delayed by latency| Q
- Deterministic. Events are ordered by
(time, seq), ties resolve FIFO, and every random stream is seeded per agent. The test suite asserts bit-identical reruns. - Strategies never touch the book. They read it and return
Actions; order messages arrive after the strategy'slatency, while decisions use the then-current book. Arrival mid is recorded at decision time, so implementation shortfall includes latency. - Accounting. Fills are attributed to the maker and the taker.
Portfoliouses average cost with maker/taker fees. Every participant is an agent, so total PnL is exactly zero-sum, and that is tested.
Market agents (microbook.sim.agents, assembled by build_market):
| Agent | Behaviour |
|---|---|
FundamentalValue |
latent Gaussian random walk, optional jumps and stochastic volatility; invisible to the book |
NoiseTrader |
zero-intelligence population (Smith, Farmer et al., 2003): Poisson limit orders placed relative to the opposite touch, Poisson or self-exciting (HawkesProcess) market orders, proportional random cancellation |
InformedTrader |
IOC orders when the book is mispriced vs the fundamental by more than a threshold, optionally sized by the mispricing |
MetaorderTrader |
uninformed institutions splitting Pareto-sized orders into child market orders (Lillo, Mike & Farmer 2005); completed metaorders feed the impact analysis |
Strategies:
| Strategy | Idea |
|---|---|
MarketMaker |
symmetric quotes around mid, fixed inventory skew |
AdaptiveMarketMaker |
volatility-scaled spread, inventory skew, order-book-imbalance lean, hard limits |
AvellanedaStoikovMarketMaker |
reservation price s − qγσ²τ and optimal spread γσ²τ + (2/γ)ln(1+γ/k), finite or rolling horizon, online σ |
TWAPExecutor |
time-sliced market orders; unfilled remainder rescheduled |
Market makers derive from TwoSidedQuoter, which rounds passively onto the grid,
never quotes through the opposite touch (post-only), and leaves unchanged quotes
alone so they keep queue priority.
Writing a strategy
from microbook import Order, Side
from microbook.sim import Action, MarketConfig, Strategy, build_market, strategy_report
class WideSpreadBuyer(Strategy):
"""Buy 5 shares whenever the spread is wider than one tick; check every 50 steps."""
def on_start(self, now, lob):
return [Action.timer(now + 50)]
def on_timer(self, now, lob):
actions = [Action.timer(now + 50)]
spread = lob.spread()
if spread is not None and spread > 1.5 * lob.tick_size: # 2+ ticks, robust to float round-off
actions.append(Action.submit(Order.market(self.next_order_id(), Side.BUY, 5), now))
return actions
market = build_market(MarketConfig(seed=1), [WideSpreadBuyer("wsb", latency=2)], horizon=10_000)
sim = market.run(10_000)
print(strategy_report(sim, ["wsb"])["wsb"])
Hooks: on_start, on_tick (every SNAPSHOT), on_timer, on_fill(now, fill, side, is_maker, lob)
and on_report(now, report). Each returns a list of Actions.
Metrics
| Metric | Definition |
|---|---|
| Slippage vs arrival | fill VWAP − mid at decision time (buys; mirrored for sells), over orders with a known arrival mid |
| Spread capture | maker fills: distance from the pre-trade mid, per share |
| Markout @h | side × (mid(t+h) − fill price), volume-weighted; its decay with h measures adverse selection |
| Fill ratio / participation | filled ÷ submitted; own volume ÷ market volume |
| PnL stats | final, max drawdown, per-sample PnL volatility, Sharpe (mean/std of increments × √n, not annualised) |
Replaying historical data
microbook.replay feeds order-by-order exchange data through the matching engine.
It reads the LOBSTER format, the standard academic
reconstruction of NASDAQ TotalView-ITCH (academic sample days are available on
request from LOBSTER).
from microbook.replay import build_replay, check_reconstruction, load_lobster
from microbook.sim import AdaptiveMarketMaker, AdaptiveConfig, strategy_report
day = load_lobster("AAPL_2012-06-21_message_10.csv", "AAPL_2012-06-21_orderbook_10.csv")
print(check_reconstruction(day)) # rebuilt book vs the exchange's snapshots
mm = AdaptiveMarketMaker(AdaptiveConfig(size=50, latency=5), name="mm")
replay = build_replay(day, [mm], time_unit=1e-3) # 1 clock unit = 1 ms
sim = replay.run()
print(strategy_report(sim, ["mm"], horizons=(100, 1_000, 10_000))["mm"])
- Reconstruction. New orders, partial cancels and deletions are applied as
they are. An execution is replayed as an IOC from the aggressor's side, so it
is matched by the engine's own price-time priority. Orders resting before the
file starts are seeded as one aggregate order per level.
check_reconstructioncompares the rebuilt book with the recorded snapshot after every message. - Backtests. Any
Strategytrades alongside the historical flow, with its latency and analytics. A strategy is filled when history reaches its place in the queue, or when an incoming order crosses its quote. The historical book is then corrected, so a passive strategy with small orders leaves the recorded book exactly intact (tested). The flow does not react to the strategy, so market impact is ignored. Taking liquidity, or swallowing a whole incoming order, makes the rest of the replay counterfactual;HistoricalFlow.statscounts both. - Validation without licensed data.
synthetic_day()generates LOBSTER-format days from an independent FIFO reference model (it does not use the engine), andwrite_lobster()saves them. On these the reconstruction is exact at all levels after every message.
examples/replay_lobster.py runs all three steps (reconstruction, a market-maker
latency sweep, the day's stylized facts) on LOBSTER files, or on a synthetic day
if none are given.
Reinforcement learning
microbook.rl.MarketMakingEnv is a Gymnasium
environment (pip install "microstructure-sim[rl]"). Every decision_interval
steps the agent picks how many ticks behind the touch to quote on each side.
Observations are inventory, spread, book imbalance, the last mid move,
volatility and time left. The reward is the PnL change in ticks, minus an
optional quadratic inventory penalty. Quote handling is shared with the
library's market makers (post-only, queue-preserving, inventory limit), so a
policy trained here is directly comparable to them. The environment works with
any Gymnasium-compatible library.
from microbook.rl import MarketMakingEnv
from microbook.sim import MarketConfig
env = MarketMakingEnv(MarketConfig.realistic(), horizon=5_000, inventory_penalty=2e-5)
obs, info = env.reset(seed=0)
obs, reward, terminated, truncated, info = env.step(env.action_space.sample())
examples/rl_market_making.py trains a 7-parameter linear policy with the
cross-entropy method (numpy only, about a minute) and evaluates it on 32
held-out seeds:
| Policy | PnL per episode ($) | Mean peak |inventory| |
|---|---|---|
| Random offsets | −5.57 ± 1.11 | 37.5 |
| Always join the touch | −11.01 ± 1.12 | 43.8 |
Hand-written MarketMaker rule (shift 2 ticks against inventory) |
1.00 ± 0.07 | 6.2 |
| Learned | 1.10 ± 0.05 | 6.7 |
Starting from "1 tick out, no skew", the learner rediscovers the 2-tick inventory shift and adds a strong order-book-imbalance lean and volatility widening. Paired by seed, it is ahead of the hand-written rule by 9.8 ± 7.2 ticks, which is not a significant difference. Quoting without inventory control loses money to informed traders.
Project layout
src/microbook/
├── book.py # LimitOrderBook: matching engine
├── order.py, types.py # Order, Side, Fill, ExecutionReport, enums
├── stylized.py # stylized facts: tails, ACFs, order-sign memory, impact
├── replay.py # LOBSTER I/O, historical replay, reconstruction check
├── rl.py # Gymnasium market-making environment (optional extra)
└── sim/
├── simulator.py # MarketSimulator: event loop, latency, attribution
├── strategy.py # Strategy, Action, TwoSidedQuoter, MarketMaker, TWAPExecutor
├── strategies_mm.py # AdaptiveMarketMaker, AvellanedaStoikovMarketMaker
├── agents.py # FundamentalValue, Noise/Informed/MetaorderTrader, HawkesProcess
├── scenarios.py # MarketConfig (+ realistic preset), build_market
├── portfolio.py # average-cost PnL with maker/taker fees
├── execution_metrics.py, analytics.py, metrics.py
└── orderflow.py # open-loop Poisson flow (controlled tests)
examples/ # quickstart, static_flow, compare_market_makers, stylized_facts,
# real_data_facts, replay_lobster, rl_market_making
benchmarks/ # bench_book, bench_sim, profile_book
docs/demo/ # browser demo: index.html, worker.js (Pyodide), demo.py
tests/ # model-based, property-based, API-snapshot and docs-snippet tests
Development
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pre-commit install # ruff lint + format on every commit
pytest --cov # tests + coverage (95% branch)
ruff check . && ruff format --check . # lint / format
mypy # strict type checking
python examples/compare_market_makers.py --plot docs/figures # regenerate results
python examples/stylized_facts.py --plot docs/figures # regenerate realism figure
python benchmarks/bench_book.py # engine benchmark
Stability and versioning
From 1.0.0, microbook follows Semantic Versioning: a patch release fixes bugs, a minor release adds features, and only a major release removes or changes public API. Until 1.0.0, a minor release may break the API, and every break is listed in the changelog with what to use instead.
The public API is every name in __all__ of microbook, microbook.sim,
microbook.stylized, microbook.replay and microbook.rl, together with the
documented parameters, attributes and return values of those names. Nothing else is
public:
- Import from the packages above, not from submodules such as
microbook.sim.agents. The submodule layout can change in any release. - Names starting with an underscore are internal.
- The text formatting of reports and tables (
format_table, the examples' output) can change in any release.
tests/test_public_api.py pins the public names, so an accidental change fails CI.
Deprecation. A public name that is renamed or replaced keeps working, with a
DeprecationWarning that names its replacement, for at least one minor release, and
is removed only in the next major release. The changelog lists every deprecation.
Reproducibility. A given version, seed and configuration produces identical
fills on every supported Python, with or without the compiled build. Golden digests
in tests/test_sim_determinism.py check this in CI. A release that changes seeded
output (a recalibration or a bug fix) says so in the changelog. Simulated numbers
from different minor versions are therefore not guaranteed to match.
Python versions. The supported CPython versions are the ones tested in CI and listed in the package classifiers. Support for a version is dropped only in a minor release, with a changelog note.
Limitations
- Single instrument, discrete integer clock, and no hidden or iceberg orders. Fees are per share.
- The agents are stylized and their parameters are chosen for plausible depth, spread and tracking. They are not fitted to market data, so treat the results as qualitative mechanisms rather than calibrated estimates.
- Pure Python (optionally compiled with mypyc): fast enough for research loops (hundreds of thousands of messages per second), not a production matching engine.
What is planned, and what is deliberately out of scope, is in ROADMAP.md.
Contributing
Bug reports, questions and pull requests are welcome. CONTRIBUTING.md covers setup, the checks a change must pass, and how to add a strategy or an agent. Everyone taking part follows the code of conduct; security problems are reported privately, as SECURITY.md describes.
Citing
If you use microbook in your research, please cite it. GitHub's "Cite this repository" button reads CITATION.cff, or use:
@software{umeasalugo_microbook,
author = {Umeasalugo, Alex Chidera},
title = {microbook: a price-time priority matching engine and event-driven market microstructure simulator},
url = {https://github.com/Space-Paragon1/Market-Microstructure-Simulator},
version = {1.0.0},
license = {MIT}
}
Cite the version you used, so others can reproduce your numbers: seeded results are identical within a version.
License
MIT. For education and research; it does not connect to any market.
Metadata
Release files for microstructure-sim 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| microstructure_sim-1.0.0.tar.gz | 124.1 kB | With provenance | Details for microstructure_sim-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| microstructure_sim-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for microstructure_sim-1.0.0-py3-none-any.whl |
Total release size: 195.2 kB
Release files / microstructure_sim-1.0.0.tar.gz
| Download URL | microstructure_sim-1.0.0.tar.gz |
|---|---|
| Size | 124.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
848ef549be7b11d8583d869949cc794128e27c7ccc6dc8659ea0558c552bbc17
|
|
BLAKE2b-256 checksum How to use checksums |
6a88c628c191a59af9fb28a13860f782cfd1dfd20be3a41c31dcd972776db083
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.
Transparency logRelease files / microstructure_sim-1.0.0-py3-none-any.whl
| Download URL | microstructure_sim-1.0.0-py3-none-any.whl |
|---|---|
| Size | 71.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1492c572ee3e08c63c6d7305d716030dda1dbf9bca493910f57a28cd5685f352
|
|
BLAKE2b-256 checksum How to use checksums |
f06077bbe984aaabb253ce950c1568e0a0ec5a035d55332f0926750815b2a8d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.
Transparency logSecurity for microstructure-sim 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for microstructure_sim-1.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.