Quickstart¶
From a fresh machine to your first trade. You need the login and password your teacher gave you.
1. Install¶
Copy the install line for your system from the course site. It installs Python 3.13
if needed, the SDK, the fastboxex command and the terminal UI.
With Python 3.13 or newer already installed, this does the same by hand:
python3 -m venv ~/fastboxex
source ~/fastboxex/bin/activate # Windows: ~\fastboxex\Scripts\Activate.ps1
pip install --find-links https://exchange.samuel-drapeau.info/wheels fastboxex plotly
2. Save your login¶
It asks for your login and password once and saves them where only you can read
them, in ~/.config/fastboxex (%APPDATA%\fastboxex on Windows). Every script then
finds them from any folder. On campus or off campus nothing changes: the campus
server is tried first, then the Singapore relay.
3. Check everything¶
server Campus 202.120.13.117:11001 reachable
server Singapore exchange.samuel-drapeau.info:11001 reachable
runtimes 11 exchange, 21 arena
login user 6, runtime 11 exchange, in 0.14s
feed 4/4 books, delay p50 5 ms, p95 9 ms above the fastest sample
arena 0/0 arenas in use, 1 traders allowed
doctor done
One reachable server is enough. See the fastboxex command for what each line means and what to do when one fails.
4. Watch the market¶
fastboxex run examples/01_hello.py # who you are, what you can trade
fastboxex run examples/02_market_board.py # every market, live
fastboxex run examples/03_order_book.py # the order book of one market
These only read. Ctrl-C stops them.
5. Join the class game¶
Your teacher opens an arena and gives you a code.
It waits for trading to open, then trades and prints every fill. To compete, edit
my_signal in play.py. 05_strategies/ holds two more strategies to start from.
Ctrl-C leaves, and the script stops by itself when the teacher ends the game. If it
dies, run it again: you return to the same seat.
6. Your own script¶
import time
from fastboxex import Platform
from fastboxex.price import to_display
platform = Platform.auto_login()
asset_id = platform.asset_by_symbol("JTW")["asset_id"]
market = platform.market()
time.sleep(1)
md = market.get_latest(asset_id)
print(f"bid {to_display(md['bid']):.2f} ask {to_display(md['ask']):.2f}")
Platform.auto_login() uses what fastboxex setup saved. Pass runtime="arena" to
reach arenas.
7. Without a server¶
SimExchange runs a full order book on your machine, with no account:
from fastboxex import SimExchange, SimConnection
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)
for state in ("Suspended", "Auction", "Trade"):
ex.transition_to(state)
conn = SimConnection(ex, pid)
conn.submit_limit(1, 0, 999_900, 100, client_tag=1)
print(conn.drain_acks())
See the SimExchange guide.
Next steps¶
- The
fastboxexcommand: setup, doctor, run, tui - Authentication: where logins and servers are stored
- Order Types: limit, market, delta, IOC
- Market Data: BBO, book depth, snapshots
- Arenas: lifecycle and classroom mode