Autonomous Quant Research: A Practical Guide to Strategy
If you’ve spent any time building trading strategies, you know the cycle: write code, backtest, stare at the Sharpe ratio, tweak a parameter, and repeat until you’re cross-eyed. Most people get stuck in a local optimum, anchored to a single logic paradigm that they keep polishing long after it’s stopped yielding alpha.
The real breakthrough in autonomous quant research isn't just automating the backtest; it’s automating the evolution of the strategy itself. By applying the Karpathy-style autoresearch pattern to FreqTrade, you can force an LLM agent to treat your strategy directory as a living, breathing workspace.
Here’s the part nobody talks about: the agent needs to be able to kill its own ideas. In my experience, the biggest failure mode in automated strategy generation is "oracle-gaming." If you give an LLM a simple scalar goal like "maximize Sharpe," it will eventually find a way to clip ROI or compress variance to produce a fake, high-Sharpe result that falls apart the moment it hits real market data.
To prevent this, you have to move away from single-file mutation. Instead, give your agent a sandbox—a directory where it can maintain up to three competing strategies simultaneously. This multi-strategy approach forces the agent to compare performance across different logic sets, preventing the "single-paradigm anchoring" that ruins most automated experiments.
When you set this up, don't try to build a complex orchestrator. Keep it simple:
- Use a fixed
config.jsonthat the agent cannot touch. - Point the agent at a
program.mdfile containing your research instructions. - Let the agent invoke
run.pyto execute in-process backtests. - Log every event—create, evolve, fork, kill—into a
results.tsvfile that persists even when yougit reset --hardyour experimental code.
Why does this matter? Because the agent needs a memory of its failures. If you don't track the "kill" events, the agent will inevitably try the same losing strategy three times in a row. By keeping the event log outside of the git history, you ensure the agent learns from its past mistakes even when you discard the code that caused them.
Here’s where most people get tripped up: permissions. You are giving an LLM agent the ability to run shell commands and write files. If you don't use a scoped allowlist—like a project-level .claude/settings.json or equivalent—you’re asking for a broken environment. Limit the agent to uv run commands and specific git operations.
This isn't about finding a "holy grail" strategy overnight. It’s about building a system that can iterate faster than you ever could manually. If you want to see if your hypothesis holds water, stop tweaking parameters by hand. Build the loop, set the constraints, and let the agent find the patterns you’re too biased to see.
Try this today and share what you find in the comments. If you're just getting started with the framework, read our breakdown of FreqTrade backtesting to ensure your data environment is clean before you let the agent loose.