tradefloor
tradefloor is a reproducible evaluation environment for financial AI agents. It is a deterministic market simulator with a Rust core and a Python API.
The figure is engine output on one seed, drawn by
examples/fork-futures/fork_futures.py.
Purpose
A backtest replays one history. A language model may have read that history during training, and an order placed in a backtest leaves the replayed price where it was. tradefloor computes every price from a seed. So an agent meets a market that no dataset holds, its orders move the price, and a running market forks into branches that share one past. The prices are simulated, and a result here says how an agent behaved in the model. Limits names what to check before a result is used, and the documentation is at https://docs.tradefloor.dev.
Install
pip install tradefloor
There are wheels for Linux, macOS and Windows on CPython 3.11+, and no
dependencies. The same engine is a Rust crate (cargo add tradefloor).
Optional extras add the MCP server (tradefloor[mcp]), Arrow output
(tradefloor[arrow]), the Gymnasium environment (tradefloor[rl]) and one
extra per agent framework.
A first run
import tradefloor as tf
universe = tf.Universe.random(40, seed=111)
spec = tf.StrategySpec.momentum(lookback_days=1.0, top_k=5)
scores = tf.evaluate({"mine": spec}, seed=7, universe=universe, days=10)
scores["mine"].return_pct # what it made
scores["mine"].impact_bps # what its own footprint cost
scores["mine"].strategy_fingerprint # sha256, cite this
scores["mine"].errors # each step that raised or was refused
scores["mine"].sharpe # annualised, from the daily closes
scores["mine"].time_in_market # share of steps holding a position
That result comes from one random market, so it says as much about the seed
as about the strategy. tf.rank compares strategies across many seeds with a
paired sign test (docs/AGENTS.md).
Forking a market
A tf.World holds a market, an agent and its portfolio. world.run advances
it, world.fork returns independent branches that share its history, and
tf.compare reads two branches side by side. This block runs the market in
the figure above and applies the packaged rate_shock scenario to one
branch:
import tradefloor as tf
universe = tf.Universe.random(20, seed=11)
world = tf.World(seed=7, universe=universe,
agent=tf.baselines.BuyAndHold())
world.run(days=40) # a shared history
control, shock = world.fork("control", "rate_shock")
same = tf.agree(control, shock) # checked before any change
shock.apply(tf.Scenario.load("rate_shock"), at=0)
control.run(days=80)
shock.run(days=80)
print(same)
print(tf.compare(control, shock, agreement=same).render())
tf.agree runs nine checks that two branches hold the same state, and
docs/API.md shows the printed comparison, the scenarios and the rate-shock demo.
Reinforcement learning
pip install "tradefloor[rl]" registers Gymnasium environments, and
tradefloor.rl scores a trained policy on markets it never trained on:
import gymnasium as gym
import tradefloor.gym
from tradefloor import rl
from stable_baselines3 import PPO
env = gym.make("Tradefloor/Portfolio-v0", seeds=range(32)) # training markets
model = PPO("MlpPolicy", env).learn(20_000)
test = gym.make("Tradefloor/Portfolio-v0")
print(rl.compare({"cash": rl.cash(test), "ppo": rl.from_sb3(model)},
test, seeds=tradefloor.gym.HELD_OUT_SEEDS[:20]).table())
Tradefloor/Trading-v0 trades long and short, Tradefloor/Portfolio-v0
allocates long-only with cash, and Tradefloor/SingleName-v0 takes a
discrete action. docs/RL.md gives each one's spaces, reward and
termination.
Further reading
| docs/AGENTS.md | writing, scoring and comparing agents, the framework adapters and the sandbox limits |
| examples/README.md | the thirteen numbered examples, the studies and the starter projects |
| examples/integrations/ | adapters for a plain callable, the OpenAI Agents SDK, the Anthropic SDK, PydanticAI, LangGraph and FinRobot, each run offline with no API key |
| docs/RL.md | the Gymnasium environments, their spaces and rewards, training pools, vector envs and scoring a trained policy |
| docs/MCP.md | the MCP server: pip install "tradefloor[mcp]", then claude mcp add tradefloor -- tradefloor-mcp, with entries for Claude Desktop, Cursor and VS Code |
tradefloor ci compare |
a baseline and a candidate agent on the same seeds for a pull request, with a reusable workflow |
| docs/API.md | the package contents, price attribution with engine.truth(), forks and scenarios |
| docs/REALISM.md | the realism results and every measured limit |
| docs/REPRODUCIBILITY.md | what replays exactly, across platforms, releases and restored state |
| docs/MODEL.md | the model as equations, with every coefficient's value on the default preset and where it came from |
| docs/STATISTICS.md | the named sets of realism statistics |
| docs/SUPPORT.md | which release lines get fixes, and for how long |
| docs/EMBEDDING.md | driving the Rust engine from a game or another host, and how much flow of its own the model takes |
| ROADMAP.md | planned work |
Tradefloor Bench, a benchmark for financial AI agents built on this engine, is in preparation. So far only baseline strategies have been run on it. No language model has been scored, so no model results exist yet. ROADMAP.md lists the planned pilot and the public version after it.
Limits
- The prices are simulated. On pt-v22, the default, 19 of the 19 statistics of the one-year table are inside the range real markets show over a year, and docs/REALISM.md has every measured limit.
- The read-only market view guards only against accidents, and agents in one
tf.evaluateortf.rankcall share one Python process. Run each agent you did not write in its own process (docs/AGENTS.md). - A result depends on its seed and its preset, so publish both with the
version. The default preset is
pt-v22, and docs/REPRODUCIBILITY.md says what replays exactly.
Contributing
CONTRIBUTING.md explains how to build and test the project. Its main rule is that any change to the simulated trajectory is a breaking change, however small, so a model change ships as a new preset. CODE_OF_CONDUCT.md sets the conduct expected in the project's spaces. Report a vulnerability through GitHub's security advisory form, and SECURITY.md says what is in scope. Bugs and questions go to GitHub issues.
Citing tradefloor
Cite the version you ran and name the preset. The same version can run several presets, and results depend on the preset. CITATION.cff carries the same details, and GitHub's "Cite this repository" button reads it. In the text, say which model you used, for example: "tradefloor 0.12.0, preset pt-v22, specified in its docs/MODEL.md".
@software{tradefloor,
author = {Coombes, Simon},
title = {tradefloor: a deterministic market simulator with a limit order book},
version = {0.12.0},
year = {2026},
url = {https://github.com/simoncoombes/tradefloor},
note = {Model preset pt-v22}
}
License
tradefloor is licensed under MIT OR Apache-2.0, at your option. See
LICENSE-MIT
and
LICENSE-APACHE.
GitHub's sidebar reads Apache-2.0 because its license detection picks one
file and stops. The grant that applies is the dual one, stated in
pyproject.toml, rust/Cargo.toml and this section.
Metadata
Release files for tradefloor 0.12.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 |
|---|---|---|---|---|
| tradefloor-0.12.0.tar.gz | 2.7 MB | With provenance | Details for tradefloor-0.12.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| tradefloor-0.12.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for tradefloor-0.12.0-cp311-abi3-win_amd64.whl |
| tradefloor-0.12.0-cp311-abi3-manylinux_2_34_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.34+ x86-64 | Details for tradefloor-0.12.0-cp311-abi3-manylinux_2_34_x86_64.whl |
| tradefloor-0.12.0-cp311-abi3-manylinux_2_34_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.34+ ARM64 | Details for tradefloor-0.12.0-cp311-abi3-manylinux_2_34_aarch64.whl |
| tradefloor-0.12.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for tradefloor-0.12.0-cp311-abi3-macosx_11_0_arm64.whl |
| tradefloor-0.12.0-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details for tradefloor-0.12.0-cp311-abi3-macosx_10_12_x86_64.whl |
Total release size: 17.5 MB
Release files / tradefloor-0.12.0.tar.gz
| Download URL | tradefloor-0.12.0.tar.gz |
|---|---|
| Size | 2.7 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4801f0b074974075f64566635eb3e072d771a6f4a1fb93462f59ad9b306d568e
|
|
BLAKE2b-256 checksum How to use checksums |
ec4a2323efd3a09e0a66c356adb5ba52e1b2174018b3a1b804b5456cfef43f05
|
| 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 Nov 30, 2026.
Transparency logRelease files / tradefloor-0.12.0-cp311-abi3-win_amd64.whl
| Download URL | tradefloor-0.12.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
4a84b55be65fc304339e9d413b5ba8074bcf92bdb2b2e757c822cceb4db52f6f
|
|
BLAKE2b-256 checksum How to use checksums |
63aa43511b5f4f3541392558ccedab1cabb477ee500b802e3552193f80f85d28
|
| 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 Nov 30, 2026.
Transparency logRelease files / tradefloor-0.12.0-cp311-abi3-manylinux_2_34_x86_64.whl
| Download URL | tradefloor-0.12.0-cp311-abi3-manylinux_2_34_x86_64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | CPython 3.11 Linux glibc 2.34+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
cb783ce1f0565d3f246337235511c3061e94938ecc5d305325740fe5b139555e
|
|
BLAKE2b-256 checksum How to use checksums |
9d462bbb1073d6933dac98ad380d19a632d71b7e6757c571f3fb7cf9b2479d1f
|
| 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 Nov 30, 2026.
Transparency logRelease files / tradefloor-0.12.0-cp311-abi3-manylinux_2_34_aarch64.whl
| Download URL | tradefloor-0.12.0-cp311-abi3-manylinux_2_34_aarch64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.11 Linux glibc 2.34+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
c3144b275fb12beac8c443d24d962eace08cec481b29b0ef52a563e8802760b5
|
|
BLAKE2b-256 checksum How to use checksums |
e6089636a79a00cb0cc8c082d664f65c035b741ffa4463539fef85c15e8f4a06
|
| 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 Nov 30, 2026.
Transparency logRelease files / tradefloor-0.12.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | tradefloor-0.12.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
8fd620c81b924325e551cd30215449d396d26995ce80a705fc16175abfa1de1f
|
|
BLAKE2b-256 checksum How to use checksums |
18607fbb04da62c040aefdc312792362a8cc2693d0062c062ae185d82f66e85b
|
| 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 Nov 30, 2026.
Transparency logRelease files / tradefloor-0.12.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | tradefloor-0.12.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
029926ef3e8b44996b51e491bc99fa8b184c2c5df28d7bb79c821bb95c042643
|
|
BLAKE2b-256 checksum How to use checksums |
be5fbffe4c5ecac05c66bf327dce7dacb2f4ca6b16d93964c250c088a3285db8
|
| 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 Nov 30, 2026.
Transparency logSecurity for tradefloor 0.12.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
All 6 files in this release have been uploaded with provenance metadata.
Attestation for tradefloor-0.12.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 Nov 30, 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.