StocksLeak·Where the leaks Wall Street tries to bury surface first.

GG
Guy Gentile
Guy Gentile: The Official Record
AI Trading Edge

The Companion Repository

Every code example in AI Trading Edge comes from one repository, frozen at release v1.0-book-release so the code you read matches the code you run. The printed page is for judgment. This is for running.

Quick start

shell
git clone <your-clone-of-this-archive> ai-trading-edge
cd ai-trading-edge
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env   # add your data / broker / model keys
pytest -q
python examples/quickstart.py

Python 3.11 or newer. No API keys are required for the test suite — it runs on deterministic synthetic fixtures. If the suite passes, your environment reproduces the book's logic. If it fails, fix that before you write a strategy, because every result downstream depends on it.

Layout

BOOK_TO_REPO_MAP.md maps every printed example to its file path, its dependencies, the tests that cover it, and its expected output. When the text and the repository disagree, the repository is authoritative.

src/ate/data

Loaders, corporate actions, point-in-time joins, session calendars, survivorship-free universes.

src/ate/features

Gap metrics, session VWAP, volume profile, extension measures.

src/ate/signals

The shared signal contract and timestamp discipline.

src/ate/strategies

9:20 premarket reversal, gap-up-and-fail, momentum exhaustion.

src/ate/regime

The market regime engine.

src/ate/catalysts

Catalyst strength scoring and the LLM adapters that feed it.

src/ate/squeeze

Short-squeeze probability model.

src/ate/mean_reversion

Pair and portfolio mean reversion.

src/ate/models

Training harness, purged walk-forward validation, calibration.

src/ate/risk

Position sizing, R-multiples, portfolio heat, the risk service and kill switch.

src/ate/execution

Slippage, commissions, borrow, locates, halt handling.

src/ate/copilot

Provider-neutral LLM interface — the model name is configuration, not code.

src/ate/review

Trade journal and the Trade Failure Map.

backtests

One runner per system in Part III. They refuse survivorship-biased universes.

quantconnect

A LEAN port of the premarket reversal so the spec runs on another platform's data and fills.

charts

Regenerates every figure printed in the book.

tests

The suite that must pass before any example in the book is trusted.

docs

Data requirements, figure list, and the validation-status record for every unaudited system.

License and warranty

The code is released under a permissive license and carries no warranty. It is research and teaching code. It has not been audited for use with live capital, and the risk service in it is a starting point, not a compliance system. Trading it as written, without your own review, would be exactly the kind of unexamined delegation the book spends twenty-five chapters arguing against.

Questions

What is the AI Trading Edge companion repository?
It is the runnable version of every code example in AI Trading Edge — the data layer, feature builders, strategies, validation harness, risk service, execution model, and the test suite that covers them. The printed page is for judgment; the repository is for running.
Do I need API keys to use it?
Not to run the tests. The suite uses deterministic synthetic fixtures. You need your own market-data, broker, and model keys to run the backtests and the live-facing adapters.
Which Python version does it need?
Python 3.11 or newer.
What happens when the book and the repository disagree?
The repository is authoritative. The printed code is frozen at publication; the repository is the maintained implementation, and BOOK_TO_REPO_MAP.md tells you where each printed example lives.
Can I trade this code with real money as written?
No. It is research and teaching code released with no warranty and no audit. The risk service is a starting point, not a compliance system.