A Python template for building trading algorithms that connect to the exchange simulator.
Available scenarios
- normal_market
- stressed_market
- flash_crash
- hft_dominated
- mini_flash_crash
pip install -r requirements.txtASk NBC to register your team.
- Team Name:
team_alpha - Password:
secret123
Deployed server (HTTPS):
python student_algorithm.py --name team_alpha --password secret123 --scenario normal_market --host ip:host --secureUse manual_trader.py to manually submit orders and explore the market:
python manual_trader.py --name team_alpha --password secret123 --scenario normal_marketCommands: buy <qty> <price> | sell <qty> <price> | step | quit
Edit the decide_order() method in student_algorithm.py:
def decide_order(self, bid: float, ask: float, mid: float) -> Optional[Dict]:
"""
Your strategy goes here!
Available state:
self.inventory - Your current position
self.pnl - Your realized PnL
self.current_step - Current simulation step
Return:
{"side": "BUY"|"SELL", "price": X, "qty": N}
Or return None to not send an order
"""
# YOUR LOGIC HERE
return {"side": "BUY", "price": mid - 0.05, "qty": 100}| Argument | Required | Description |
|---|---|---|
--name |
Yes | Your team name |
--password |
Yes | Your team password |
--scenario |
No | Scenario to run (default: normal_market) |
--host |
No | Server host:port (default: localhost:8080) |
--secure |
No | Use HTTPS/WSS for deployed servers |
| Rule | Limit |
|---|---|
| Max open orders | 50 |
| Order quantity | 100-500 per order |
| Rate limit | 1000 runs per hour |
| File | Description |
|---|---|
student_algorithm.py |
Main algorithm template - edit this! |
manual_trader.py |
Interactive manual trading tool |
requirements.txt |
Python dependencies |