Power your agent
คำสั่งของผู้เผยแพร่เอง ไม่ใช่เอนด์พอยต์ของ PlugMCP
Host a copy with our keys and logs.
uvx tradefloor==0.11.0Claude Code ไม่มีลิงก์ติดตั้งสำหรับคำสั่งแบบโลคัล ให้คัดลอกคำสั่งด้านล่างแล้วรันในเทอร์มินัล
claude mcp add io.github.simoncoombes-tradefloor -- uvx tradefloor==0.11.0รันในเทอร์มินัล
{ "mcpServers": { "io.github.simoncoombes-tradefloor": { "command": "uvx", "args": [ "tradefloor==0.11.0" ] } }}claude_desktop_config.json
URL แบบรีโมตหรือคำสั่งบนเครื่องของคุณ? การติดตั้งสองแบบต่างกันอย่างไร
รันบน PlugMCP
A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.
เปิดtradefloor is a market simulator you can run a strategy against. It has a Rust core and a Python API.
Give it a seed and a list of companies. It runs a market forward: prices, a limit order book, fills, and an economy that moves each day. Your orders match against the book's depth, so your trades move the price.
Real market data can't tell you what would have happened if you had traded
differently, or what caused a move. tradefloor can, because it computed every
price. You can fork a running market, change one thing in one branch (a rate
rise, a liquidity crisis, a different agent), and measure where the two
branches came apart. engine.truth() splits each move in the gap between a
price and the model's fair value into twelve factors, and
engine.explain(ticker, day) breaks down the move in the traded price, two
records no historical dataset carries.
Documentation is at https://docs.tradefloor.dev.
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.
The API may change before 1.0. Model changes ship as new presets, so a market with no agent orders in it replays exactly on its named preset in later releases. tradefloor was called pretium until 0.5.0. Versions up to 0.4.3 still install under that name, and results recorded with them still replay.
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 runs many seeds and compares strategies with
a paired sign test. Add tf.baselines.reference_agents() to the entrants and
tf.versus_buy_and_hold(scores) reads each score against buy-and-hold on
the same market.
A Python agent is any object with act(obs) that returns orders: a number
of shares for a market order, tf.Limit(quantity, price) or tf.Cancel().
It sees a read-only view of the market and its own portfolio, and
obs.history holds a daily bar per name. A bar's close is the day's last
print. On pt-v21 the close then re-marks every name and the next session
opens after an overnight move, so the next day starts away from that print:
the close sits 11 bp from it at the median on a 20-name roster, and the open
25 bp from the close.
docs/AGENTS.md
covers what the view holds, how trades are charged, the framework adapters
(OpenAI Agents SDK, PydanticAI, LangGraph, FinRobot) and how scoring works.
The examples are in this repository and not in the package, so clone it first:
git clone https://github.com/simoncoombes/tradefloor
cd tradefloor
python examples/rate-shock/counterfactual.py
It runs an agent in a controlled market, checkpoints the world and forks it, raises rates by 200 bp in one branch, and compares what the same agent does next. It prints nine checks that the two branches started identical, the step at which the agent's behavior changed, and the two branches side by side. The run takes under five seconds of CPU and needs no keys and no network. The walkthrough is Your first counterfactual experiment.
pip install "tradefloor[mcp]"
claude mcp add tradefloor -- tradefloor-mcp
tradefloor-mcp speaks MCP over stdio, and tradefloor mcp starts the same
server. Strategies, universes and scenarios are data, so a tool argument
cannot reach code. Each result carries its own caveats. A session keeps one
market in the server between calls, so an agent can place orders a step at a
time, fork the market to try two actions, and rewind. See
the MCP page.
engine = tf.Engine(seed=42, universe=universe)
engine.run_days(20) # a shared history first
scenario = tf.Scenario.load("liquidity_crisis") # ships with the package
control, stress = tf.branch(engine, 2)
for day in range(80):
scenario.apply(stress, day)
... # run both branches
A scenario is a file of changes to the market and the assumptions behind them. Each change targets a field the engine reads, and the file keeps the shock apart from the knock-on effects you assume follow it:
tradefloor scenario show oil_price_spike
Exogenous shocks
----------------------------------------------------------
day 50+ commodity.oil x1.4
Assumed transmission
----------------------------------------------------------
day 55..74 ramp macro.inflation +1.50pp
day 55+ macro.corporate_yield +0.50pp
at in a scenario counts days from the first day it is applied, so on a
branch it counts from the branch. Most packaged files first fire on day 50.
To fire one on the first day after a fork, use scenario.starting_at(0), or
world.apply(scenario, at=0) on a World. The gaps between its events stay
the same, and the run's record keeps the packaged file's fingerprint and the
days each event fired.
tradefloor does not predict what a war, an election, an oil shock or a
recession will do to markets. You state the assumptions and it measures how an
agent behaves under them. tradefloor scenario list names the seven packaged
scenarios, and tradefloor scenario targets lists every field a scenario can
change.
The same seed gives the same market on every platform. tradefloor ships its
own exp, log, pow, sin and cos, so the system's math library cannot
change a result, and each release runs a fixed simulation on five platforms
and stops if any result differs.
A shipped preset never changes, so a market with no agent orders in it replays
exactly on its named preset in every later release. Each release checks that
with a digest per preset. A run with agent orders in it replays exactly on the
same release. Across releases the promise is narrower. 0.8.5 changed how an
agent's fills reach the market, on every preset, so a traded run recorded
before 0.8.5 matches up to its first trade and differs after it. The default
preset is pt-v21, and any earlier one can be named:
eng = tf.Engine(seed=42, universe=u, model="pt-v10")
To let a reader rerun a result, publish its RunManifest. It records the
version, preset, seed, universe, macro state and scenario, and reproduce()
stops on a mismatch. A manifest checks the market and carries no score. Its
result block holds the market's digest, the number of days and
draws_consumed. tf.evaluate and tf.rank write no manifest, so a
published score has to be rerun to be checked.
docs/REPRODUCIBILITY.md
has the full contract, including what a saved engine state promises when it
is restored, and
docs/SUPPORT.md
says which release to pin for a long study.
tradefloor checks its market against real ones with three named sets of statistics, listed in docs/STATISTICS.md. On pt-v21, the default from 0.10.0, all 19 statistics of the one-year table (volatility, fat tails, how much stocks move together, how far the VIX jumps after a fall) are inside the range real markets show over a year, on the ruled bands. The index's return and the share of days it falls 3% or more are read over 360 seeds, as the long-run criteria read them: the index falls 3% or more on 0.98% of days, against a range of 0.64 to 2.34. All 15 statistics of the two-year panel are inside their two-year ranges. The long-run criteria are 40 rows over 21 years, covering crash depth, how long fear lasts, bear markets per decade, the 2008 and 2020 replays, the rate indices and the cost of size in the book. pt-v21 meets all 40, read on 270 histories.
Read those claims narrowly:
tf.envelope.intervals() for each statistic's
spread across seeds.abs_return_acf5 reads 0.020, below
every real 2015 to 2025 window (the lowest is 0.034), and it passes
because its range reaches lower than those windows do.tf.envelope.check(horizon_days=...) refuses a question that falls outside
a measured limit.
docs/REALISM.md
has every number behind these claims and the full table of limits.
explanation_accuracy. On pt-v21 a constant answer scores 0.70 to 0.95, so
quote explanation_edge, the accuracy minus that baseline, and never the
accuracy alone.tf.evaluate or tf.rank call run one after another in one
Python process, on one seed. An earlier agent can leave the price path in
a class variable for a later one. An agent written to cheat can read the
seed from the harness's frames through sys._getframe and run a copy of
the market ahead. Nothing flags either. The read-only market view guards
only against accidents, so run each agent you did not write in its own
process, through the MCP server.evaluate and rank run starts at day 0, so a rule that needs 20
days of prices sits out the first 20 while buy-and-hold is invested. Pass
history_days=20 to run the market 20 days first with nobody trading.World with several agents, orders placed at the same step execute in
label order, alphabetical, for the whole run. Rotate the labels across runs
when you compare different agents in one market.cash_interest=True, and a negative cash balance pays the policy rate,
which is below a broker's margin rate.docs/AGENTS.md has the measurements behind each of these.
The twelve numbered examples/ are in reading order, and the test suite runs them:
The rate-shock/
study is the demo above, and
integrations/
runs the same kind of experiment through each agent framework, offline and
without an API key.
https://docs.tradefloor.dev covers install, the API, the guides and how the model is measured. These pages in this repository have the detail behind the sections above:
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. RELEASING.md is the release checklist.
Report a vulnerability through GitHub's security advisory form, not a public issue. SECURITY.md says what is in scope. Bugs and questions go to GitHub issues.
0.8.5 and the 0.8 patches after it are the long-term support line, with bug and security fixes for 24 months. docs/SUPPORT.md says what a support line promises and which release to pin for a long study.
Cite the version you ran and name the preset. The same version can run several presets, and results depend on the preset.
@software{tradefloor,
author = {Coombes, Simon},
title = {tradefloor: a deterministic market simulator with a limit order book},
version = {0.10.2},
year = {2026},
url = {https://github.com/simoncoombes/tradefloor},
note = {Model preset pt-v21}
}
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.10.2, preset pt-v21, specified in its docs/MODEL.md". docs/REPRODUCIBILITY.md says how to publish a result so a reader can rerun it, and how to show a score was not tuned to its seeds.
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.
Simulated stock markets that react to your orders: run, fork and score trading agents.
{ "mcpServers": { "io.github.simoncoombes-tradefloor": { "command": "uvx", "args": [ "tradefloor==0.11.0" ] } }}เครื่องมือ
ยังไม่มีรายการเครื่องมือ เซิร์ฟเวอร์แบบรีโมตจะได้รายการหลังการตรวจสอบสถานะครั้งแรก
FAQ
คัดลอกคอนฟิก stdio สำหรับ Cursor, Claude Desktop, Claude Code หรือ VS Code ได้ในหน้านี้ คอนฟิกนี้ใช้การติดตั้งของผู้เผยแพร่ ไม่ใช่พร็อกซีของ PlugMCP
ระเบียนนี้ไม่ได้ระบุตัวแปรสภาพแวดล้อมที่จำเป็น
Tradefloor ทำงานแบบโลคัลผ่าน stdio
ตรวจสอบล่าสุดเมื่อ 2026-11-10 Simulated stock markets that react to your orders: run, fork and score trading agents.