Skip to content

FastBoxEx Python SDK

A low-latency trading SDK for the FastBoxEx exchange. Submit orders. Stream market data. Train AI strategies. All in Python.

Get started in 5 minutes SimExchange (no network) :octicons-flask-outline:


What is FastBoxEx?

FastBoxEx is a real matching engine — not a simulation framework. Orders you submit go into a live limit order book, get matched at sub-microsecond latency, and generate real fills. The Python SDK connects you to that engine.

Four things you can do with the SDK:

Goal How
Trade on the live exchange Platform.login() → Connection → submit / drain fills
Run your own private arena Create an isolated sandbox with your own assets and participants
Test locally with SimExchange SimExchange — full order book, no network, no server required
Record and analyse runs fills_to_polars() saves every fill as a Polars DataFrame

Architecture at a glance

graph LR
    P[Platform<br/>login · register · asset discovery] --> C[Connection<br/>submit · cancel · drain fills]
    P --> M[Market<br/>top-of-book · depth · trades]
    P --> A[Arena<br/>create · join · lifecycle]
    P --> O[Observer<br/>read-only · all connections]
    A --> C
    SIM[SimExchange<br/>local · no network] --> SC[SimConnection<br/>same API as Connection]
    SIM --> SM[SimMarket<br/>same API as Market]
    style P fill:#7e57c2,color:#fff,stroke:#5e35b1
    style C fill:#5e35b1,color:#fff,stroke:#4527a0
    style M fill:#9575cd,color:#fff,stroke:#7e57c2
    style A fill:#ffca28,color:#333,stroke:#f9a825
    style O fill:#b39ddb,color:#333,stroke:#9575cd
    style SIM fill:#66bb6a,color:#fff,stroke:#43a047
    style SC fill:#81c784,color:#333,stroke:#66bb6a
    style SM fill:#81c784,color:#333,stroke:#66bb6a

Five-minute tour

from fastboxex import Platform, load_config
import os

cfg = load_config()
p   = Platform.login(cfg, "alice", os.environ["FASTBOXEX_PASSWORD"])
print(f"user_id={p.user_id}  assets={len(p.assets)}")
market = p.market()
md = market.get_latest(asset_id=1)
bid = md["bid"] / 10_000
ask = md["ask"] / 10_000
print(f"bid={bid:.4f}  ask={ask:.4f}")
conn = p.connection()
conn.activate(asset_id=1)
conn.submit_limit(1, side=0, price=999_900, qty=100, client_tag=1)
for fill in conn.drain_fills():
    print(f"FILL: {fill['price']/10_000:.2f}  qty={fill['volume']}")
from fastboxex import SimExchange, SimConnection, SimMarket

ex = SimExchange(tick_size=100, lot_size=100, reference_price=1_000_000)
ex.add_asset(1)
pid = ex.add_participant("bot", cash=10_000_000_000, inventory=100_000)
ex.transition_to("Trade")

conn = SimConnection(ex, pid)
conn.submit_limit(1, 0, 999_900, 100, client_tag=1)
for fill in conn.drain_fills():
    print(fill)
cfg = load_config()

# Register
Platform.register(cfg, "student01", "pass123", "student01@sjtu.edu.cn")
code = input("Confirmation code: ")
Platform.confirm_registration(cfg, "student01@sjtu.edu.cn", code)

# Password reset
Platform.forgot_password(cfg, "student01@sjtu.edu.cn")
token = input("Reset code: ")
Platform.reset_password(cfg, "student01@sjtu.edu.cn", token, "newpass")

  • Quickstart


    Install, configure, and run your first strategy in 5 minutes.

    Quickstart

  • Exchange Concepts


    Prices, lifecycle, order types — understand the exchange first.

    Concepts

  • Guides


    Trading, market data, arenas, SimExchange, recording, TUI.

    Guides

  • API Reference


    Every class and method, with signatures.

    Reference