Work/Autonomous Agents

Self-Improving Market Bot

Karpathy-style autoresearch loop for a quant strategy, gated by CPCV

Typeexperiment
Statusprototype
Updated2026-06-01
SourcePrivate

What it is

A scaffolded recursive-improvement harness for a sector-rotation strategy: a Claude Code agent edits only train.py each iteration, and a deterministic harness keeps the change (git commit) or rolls it back. Acceptance needs a higher median CAGR across combinatorial purged cross-validation paths, beating the benchmark in at least half the time blocks, and a Probability of Backtest Overfitting under a ceiling.

The problem

Automated strategy search overfits unless the judge is deterministic and the agent cannot touch it.

How it works

  1. The agent's only editable file is train.py; program.md steers it, and validation, CPCV and backtest code are off-limits
  2. CPCV with purge and embargo produces a distribution of out-of-sample backtest paths
  3. PBO is tracked across every strategy tried, and a sealed lockbox set is reserved for rare final checks
  4. Run modes for the Claude agent, random parameter mutation, and manual edits; scaffold smoke-tested on synthetic data, real data not yet downloaded

Stack

PythonNumPypandasSciPyyfinanceClaude Codeuvruff

Disciplines

For your business

Agent loops with deterministic acceptance gates, so AI proposals ship only when they pass independent validation.