Continual Exchange — Python SDK
Write a bot in Python, run local matches against reference and house bots, and get
a verifiable replay. The SDK is a thin client over the NDJSON loopback-TCP
protocol — the Rust engine is authoritative; the SDK has no game logic beyond
convenience. Spawned bots receive CE_BOT_ADDR=HOST:PORT; run_bot connects
automatically.
The SDK is public on PyPI. During the current staging preview, the engine repository and public-season submissions are not open yet; staging accounts, ratings, and results are test-only.
Install
python -m pip install continual-exchange-sdk
Local matches become available when the engine source repository opens. At that point, build the matching engine release once and point the SDK at its checkout:
git clone https://github.com/continualresearch/continual-exchange.git
(cd continual-exchange/engine && cargo build --release)
export CE_ENGINE_ROOT="$PWD/continual-exchange"
For SDK development, clone this repository and use an editable install:
git clone https://github.com/continualresearch/continual-exchange-sdk.git
cd continual-exchange-sdk
python -m pip install -e '.[dev]'
Your first bot in 30 lines
from ce_sdk import Bot, run_bot, new_order, BUY, IOC
class FirstBot(Bot):
def on_start(self, ms):
self.base = ms["base_price"]; self.cid = 0
def on_tick(self, s):
f = (s.signals or {}).get("s") # FACTOR seats get a factor signal
if f is None:
return [] # IDIO seat: skip in this toy bot
out = []
for inst, beta in ((0, 1.0), (1, 0.8), (2, 0.9)):
fair = self.base + beta * f
ask = s.best_ask(inst)
if ask is not None and ask < fair - 3 and s.position[inst] < 90:
self.cid += 1
out.append(new_order(self.cid, inst, BUY, ask, 2, IOC))
return out
run_bot(FirstBot())
Run a local match after the engine source release
python examples/run_demo.py # reference bots + your bot, then verify
Or from code:
from ce_sdk import run_local_match, verify_replay
r = run_local_match(
["python examples/first_bot.py", "python examples/quoter_bot.py"],
seed="hello", manifest="../testkits/manifests/quick.json",
)
verify_replay(r["replay"]) # bit-identical re-execution
Package a submission
ce-package "python bot.py" --source ./my-bot --out submission.zip
The package is reproducible, contains a versioned submission.json entrypoint,
rejects symlinks and unsafe paths, and enforces the 4 GiB uncompressed limit.
Packaging works without the engine. After the engine source release, append
--smoke to run a Bronze validation with four competitor seats and four
disclosed house bots. The validation requires at least one valid message, no
crash or suspension, and a replay that verifies exactly.
Protocol crib
- Engine → bot (one JSON line each): protocol version 2
MATCH_START,TICK,MATCH_END; each carriestype, version, match id, tick, and sequence. - Bot → engine (one JSON line = array of 0+ messages):
NEW_ORDER,CANCEL,CANCEL_ALL. TickStateaccessors:best_bid(i),best_ask(i),mid(i),.position,.cash,.signals,.signal_type,.trades,.bulletins,.fills,.acks.- Constants:
BUY/SELL,GTC/IOC, instrumentsA=0, B=1, I=2.
Reference bots (ce_sdk.bots)
NoiseTrader, NaiveQuoter, and SignalFollower are readable examples for
random flow, symmetric quoting, and private-signal trading. See
examples/ and the public
first-bot walkthrough.
The public protocol reference documents every wire field.
Releases
PyPI publishing is release-only. Maintainers bump project.version, merge the
change, and publish a GitHub Release whose tag is exactly v<project.version>.
The release workflow builds and verifies both distributions, then publishes
them to PyPI using a short-lived OIDC credential. No PyPI API token is stored in
GitHub.
Metadata
Release files for continual-exchange-sdk 0.2.2
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 |
|---|---|---|---|---|
| continual_exchange_sdk-0.2.2.tar.gz | 19.1 kB | With provenance | Details for continual_exchange_sdk-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| continual_exchange_sdk-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for continual_exchange_sdk-0.2.2-py3-none-any.whl |
Total release size: 36.5 kB
Release files / continual_exchange_sdk-0.2.2.tar.gz
| Download URL | continual_exchange_sdk-0.2.2.tar.gz |
|---|---|
| Size | 19.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
002ad1e5d2dfbb08a4dc216d419d96543730884672bbcf11ea20cc173afbde7a
|
|
BLAKE2b-256 checksum How to use checksums |
b7509d8a2cf1cf45a1da6249020f8cc1c19575e17acc980fbfc6a6898044cc5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 11, 2026.
Transparency logRelease files / continual_exchange_sdk-0.2.2-py3-none-any.whl
| Download URL | continual_exchange_sdk-0.2.2-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
48c2f75db15d16b3cecd6fadf2db20427bc760f8a4ba527b8050659a4b268e09
|
|
BLAKE2b-256 checksum How to use checksums |
051521ca1db31108ff2738a060c7a74fe477cf44f42c698b8615d99782d0ee4d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 Jul 11, 2026.
Transparency logSecurity for continual-exchange-sdk 0.2.2
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 2 files in this release have been uploaded with provenance metadata.
Attestation for continual_exchange_sdk-0.2.2.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 Jul 11, 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.