A graduate systems-engineering course disguised as a trading competition. You design the objects, make them concurrent, put a protocol under them, backtest them, speed them up, learn from them — and every week your code connects to AlgoArena, a live Python exchange where your bot competes against your classmates on real Yahoo Finance prices.
Each week is a concept, a piece of code, and a live market session. Nothing is thrown away: the class hierarchy you draw in Week 1 is the thing you make concurrent in Week 2, protocol-ise in Week 3, backtest in Week 4, optimise in Week 6 and defend in Week 9.
Model the arena as objects, then sketch it in UML before you write a line of code.
One event loop, many tasks — juggle a feed, orders and fills without ever blocking. Then the threads and processes it hands work to: the GIL, a live race, measured speedups.
From the seven OSI layers up: UDP vs TCP, the socket API, FIX, ITCH and OUCH, then the arena's WebSocket and a validated wire contract.
What a backtest is for, where tick data lives (SQL, kdb+, Parquet), logical vs real time, and a Parquet-backed backtester that gives the same P&L at every replay speed. One page: widgets, checklist and interview questions.
The midterm on Weeks 1–4 and how to prepare. No new teaching; the graded live block still runs that evening.
Pick the right structure, know its cost, and profile the hot path inside the order book.
Think in columns and processes — parallelise a strategy search, not one lonely config.
Train offline, validate walk-forward, predict inside on_tick — without fooling yourself.
Make the bot tested, reproducible and observable — then prove it end to end, measure it with a real tearsheet, and defend it. The leaderboard locks.
Three student-built roles share one WebSocket. The Broker turns Yahoo Finance prices into resting quotes, the Exchange matches, the Trader aggresses. Step through the lifecycle and watch the money move: every number below is computed from the arena's real fee model (taker 0.0015, maker rebate 0.0010).
Handshake(team_id="T07", role="trader", level=1)
Every message on the wire is a pydantic model from shared/messages.py — never a raw dict.
In Week 1 you declare a role. It decides what you build, how you earn, and which unlock ladder you climb for the rest of the season.
A WebSocket server with a central limit order book. Price-time priority matching, order acks, book snapshots, portfolio updates — the venue everyone else connects to.
Transaction fees. Under the maker/taker model you collect 0.0015 from the aggressor and pay 0.0010 back to the resting order; the difference is yours. Set fees too high and flow leaves for another venue.
A market maker. Poll Yahoo Finance on a background thread, derive a fair value, and continuously post two-sided quotes on the exchange — requoting whenever the reference price moves.
The spread: (ask_fill - bid_fill) × qty / 2,
plus the maker rebate. Your enemy is inventory risk — a one-sided market leaves you holding the position
while the price runs against you.
An algorithmic bot. Subclass
arena.Trader, implement on_tick(market, portfolio), return a
Signal — or None. The SDK handles sockets, auth and reconnection.
Realised P&L on closed positions plus the mark-to-market on open ones, net of fees. Every crossing trade pays the spread and the taker fee, so an edge has to beat both before it is an edge.
Week 1 assumes Week 0 is green. Tick each step as you finish it; the lamp turns green when your environment is ready to connect to the arena. (Your ticks are kept only in this browser tab.)
The exchange server is not running yet — the instructor starts it first.
Check EXCHANGE_HOST and EXCHANGE_PORT in your .env.
The arena requires pydantic v2 and will not run against v1.
Re-run make install in a clean 3.11 venv; never mix v1 and v2.
export is not persistent on Windows shells.
Copy .env.example to .env and load it with python-dotenv. Never commit .env.
Yahoo throttles aggressive polling; a tight yf.download() loop will get you blocked.
Respect YAHOO_POLL_INTERVAL (5s default); the broker SDK already backs off.
The handshake was accepted but under a team the instructor does not know.
Your TEAM_ID (and ARENA_TOKEN) must match the registered roster exactly.
make install.