Inspiration

I'm preparing for quant trading internships and wanted hands-on practice building a real backtesting tool, while also learning to work effectively with Codex on a non-trivial project. Strategy Copilot combines both: a genuinely useful tool and a real test of AI-assisted development.

What it does

Strategy Copilot lets you describe a trading strategy in plain English — like "10/50 day moving average crossover on AAPL since 2022" — and get a full backtest: real historical price data, an equity curve, total return, max drawdown, and an automatic comparison against simply buying and holding the stock.

It supports two strategy types (moving average crossover and RSI threshold), a side-by-side comparison mode to run both at once, and a parameter sweep that tests a range of window sizes and ranks them by return. The natural language parser is typo-tolerant and order-independent, and supports international tickers (e.g. 0700.HK, 7203.T).

How I built it

I used Codex throughout as an implementation partner. Codex wrote the core signal logic (moving average crossover, RSI), the natural language parser, the strategy comparison and parameter sweep functions, and unit tests for all of it. I drove the architecture — designing a strategy-agnostic backtest engine so new strategies plug in without touching the core simulation logic — and ran deliberate stress- testing throughout, feeding Codex concrete failing examples (reordered sentences, typos, plural phrasing) to iteratively harden the parser.

Challenges I ran into

The natural language parser needed multiple rounds of stress-testing to handle real-world phrasing variance. I also caught and fixed real logic bugs before they shipped — including an inverted RSI threshold case (oversold > overbought) that silently produced a nonsensical backtest instead of erroring, and a ticker-parsing bug that truncated international tickers like "0700.HK" down to just "HK". I also hit intermittent Yahoo Finance rate-limiting, solved with an automatic retry and clearer, date-aware error messages.

What I learned

Working with Codex effectively meant giving it precise, falsifiable specs and then verifying its output against real edge cases rather than accepting it at face value — the iterative loop of stress-test, find a real failure, hand it back with a specific fix request produced much more robust code than a single one-shot prompt would have.

What's next for Strategy Copilot

Additional strategy types (Bollinger Bands, MACD), and potentially options strategies — which would require historical options data or a theoretical pricing model like Black-Scholes, since the current architecture assumes simple equity positions.

Built With

Share this project:

Updates