AI Essentials is free. Paid enrollment opens soon.
Written practical guide
Downloads and references for this free lesson. Library resources may require course access.
You need Python 3.10 or newer and basic terminal, JSON and Python skills. Download and extract the starter. It contains trader_lab.py, test_trader_lab.py, annotation.json and a README. There are no third-party packages, API keys or accounts to configure. On Windows, use py if python3 is unavailable.
Run these commands from the extracted folder:
python3 -m unittest -v
python3 trader_lab.py demo
python3 trader_lab.py demo --db lab.sqlite
python3 trader_lab.py demo --db lab.sqlite
python3 trader_lab.py backtest --cost-bps 10
python3 trader_lab.py validate-ai --annotation annotation.jsonThe demo should show duplicate_created: false, same_approval_result: true and paper_preview_count: 1. The two commands using lab.sqlite share a durable ledger. The second must still show one preview. The default demo uses a new in-memory database, so persistence only applies when you provide the path.
Open trader_lab.py. Follow ingest → validate_event → events table, then approve → risk_quantity → paper_orders table. The approval transaction reserves notional before another preview can consume it. The resulting object says OFFLINE_PREVIEW. It has not reached a broker and is not an executed trade.
NOW is a fixed clock for repeatability. DEMO is a fictional symbol. These are intentionally synthetic fixtures, not delayed live quotes. Replacing only the clock with the current time will make old fixture events fail freshness validation; when adding a data adapter you must replace both coherently.
Change the event price to zero or the timestamp to three minutes before NOW. The event must be rejected before a preview exists. Restore the fixture and rerun the suite. Save your terminal output, Python version and commit ID in evidence/. A screenshot of a profitable number is not the deliverable; a reproducible sequence with clearly stated assumptions is.
Explore the full curriculum, projects, and access details.