{"id":"2069056530960490835","url":"https://x.com/RohOnChain/status/2069056530960490835","text":"","author":{"name":"Roan","username":"RohOnChain","avatarUrl":"https://pbs.twimg.com/profile_images/2015696704448704512/IqwOwcRn_200x200.jpg"},"createdAt":"Mon Jun 22 13:54:52 +0000 2026","engagement":{"replies":33,"retweets":113,"likes":1004,"views":902957},"article":{"title":"How To Use Loop Engineering To Build A Self-Improving Quant Trading System","previewText":"I will break down exactly how to build the loops that run an entire quant trading system on their own.\n\nLet's get straight to it.\nBookmark This - I'm Roan, a backend developer working on system","coverImageUrl":"https://pbs.twimg.com/media/HLZ4VdoacAA8c8b.jpg","content":"I will break down exactly how to build the loops that run an entire quant trading system on their own.\n\nLet's get straight to it.\n\n> Bookmark This - I'm Roan, a backend developer working on system design, HFT-style execution, and quantitative trading systems. My work focuses on how prediction markets actually behave under load. For any suggestions, thoughtful collaborations, partnerships DMs are open.\n\nOne thing I am starting from today.\n\nIf you are building a quant system, about to start or even just thinking about it, DM me what you are working on or just reply under this article and I will reach out to you (even you can simply give me the screenshot of your current architecture). \n\nI will personally walk through the first 20 setups show you the gap between what you have and a system that actually prints alpha. \n\nMost quants still prompt Claude. They type. They wait. They read the output. They type again.\n\nThe smartest builders on the planet have stopped doing that.\n\nThey write loops. The loops prompt Claude. The loops verify the output. The loops decide what happens next. The loops keep running after the laptop is closed.\n\nBoris Cherny, the head of Claude Code at Anthropic, said it plainly two weeks ago. \"I don't prompt Claude anymore. I have loops running that prompt Claude and figuring out what to do. My job is to write loops.\" That single sentence reframed how every serious AI engineer on earth thinks about building. And it pairs perfectly with quant trading.\n\nMost retail quants will read this and say it does not apply to them because they are too small. They are wrong. The smaller your capital, the more this matters. A self running loop is the only way a solo builder ever closes the gap with a fund running 100 PhDs.\n\nBecause quant trading is already a loop. Pull data. Generate signals. Backtest. Execute. Monitor risk. Repeat.\n\nEvery fund on Wall Street runs that exact cycle. Renaissance has been running it since 1988. Citadel runs it with teams of engineers monitoring every stage. Two Sigma, Jane Street, all of them.\n\nThe only difference is they need hundreds of humans sitting inside the loop. You do not.\n\nI have already built this loop for myself. It pulls market data on schedule. It runs alpha research. It verifies every signal through a separate agent. It executes only what passes verification. It writes every lesson back to memory.\n\nThis article is everything I have learned about loop engineering and how to wire it into a complete autonomous trading system.\n\nBy the end of this you will know:\n\nThe exact difference between prompting an agent and engineering a loop.\n\nThe six pieces that run every working loop in production.\n\nHow to wire those six pieces into a self improving quant trading system from scratch.\n\nLet's get into it.\n\n## Part 1: The Difference Between Prompting And Loop Engineering\n\nFor the last two years, working with AI looked like this.\n\nYou typed a prompt. You read what came back. You typed the next prompt based on what you saw.\n\nYou were the loop.\n\nThe agent was a tool. You held it the entire time. Every move was you sitting at your keyboard deciding what to do next.\n\nLoop engineering ends that.\n\nYou stop being the thing inside the loop. You become the architect who designs it.\n\nA loop is a recursive goal. You define a purpose. The agent iterates against it. The loop keeps running until a real stopping condition is met.\n\nThe agent forgets between runs. The loop does not.\n\nThat single fact is the entire architecture.\n\nThis is what Boris meant when he said his job is to write loops. He stopped typing instructions one at a time. He built systems that send the instructions for him, read the results, and decide what happens next.\n\nFor coding, this changes how software ships.\n\nFor trading, this changes everything.\n\nBecause no quant has ever made money by typing one prompt and walking away. The edge comes from running the same cycle thousands of times, getting one percent better every iteration, and never sleeping.\n\nThat is exactly what a loop does.\n\nIf you are still typing prompts into Claude one trade at a time, you are doing what Boris stopped doing two years ago. The leverage point has moved one floor up. You are not writing better prompts anymore. You are writing the system that writes the prompts.\n\n![The Difference Between Prompting And Loop Engineering](https://pbs.twimg.com/media/HLGJ0hxaEAA6Gzz.jpg)\n\n## Part 2: The Six Pieces That Run Every Working Loop\n\nA working loop is built out of six parts. Miss one and the loop breaks quietly.\n\n> 1. The automation.\n\nThis is the heartbeat. A cron schedule, a webhook, a /loop command, or a hook inside Claude Code that fires without you typing.\n\nThere are two flavors worth knowing. /loop reruns on a cadence regardless of state. /goal keeps going until a verifiable condition you wrote is actually true, with a separate small model grading whether the work is done.\n\nIn trading, /loop is your data pull every minute. /goal is \"keep iterating on this signal until the backtest Sharpe is above 1.5.\"\n\n> 2. The skill.\n\nA skill is a procedure manual the agent reads instead of being told from scratch every session.\n\nIt lives in a SKILL.md file. It holds your conventions, your rules, your \"we don't do it like this because of that one incident.\"\n\nWithout skills, every loop run starts from zero. With skills, intent compounds.\n\n> 3. The state file.\n\nA markdown file. Usually called STATE.md or PROGRESS.md.\n\nIt survives between runs. The agent forgets. The file does not.\n\nThe agent reads it at the start of every run. It writes back what happened at the end.\n\nThis sounds too dumb to matter. It is actually the spine of every working loop.\n\n> 4. The verifier.\n\nThe agent that wrote the code is the worst possible judge of whether the code is correct.\n\nApply this to trading. The agent that generated the signal is the worst possible judge of whether the signal is real alpha or noise.\n\nYou need a separate agent, with different instructions, ideally a different model, whose only job is to verify the work.\n\nThis is the maker checker pattern. Every prop shop on Wall Street is structured this way internally. At Jane Street, the trader who proposes a trade does not approve the trade. At Citadel, the researcher who builds the model does not validate the model.\n\n> 5. The worktrees.\n\nThe moment you run more than one agent against the same files, they start colliding.\n\nGit worktrees give each agent its own isolated working directory pointed at its own branch.\n\nIn trading, this lets you run signal research, backtesting, and risk monitoring in parallel without ever stepping on each other.\n\n> 6. The connectors.\n\nA loop that can only read files is a tiny loop.\n\nConnectors built on the Model Context Protocol let the loop hit a broker API, query a database, post to Slack, send orders to the exchange.\n\nThis is the difference between a loop that suggests trades and a loop that actually places them.\n\nThese six pieces are universal. They show up in Claude Code. They show up in Codex. They show up in every working agentic system on the planet.\n\nNow let me show you how to wire them together into a complete trading system.\n\n## Part 3: How To Build A Self-Improving Quant Trading Loop\n\nThe quant trading loop has five stages. Each stage is its own sub loop, with its own skill, its own state file, and its own verifier.\n\nStage one. Data ingestion.\n\nAn automation fires every minute, every hour, or every day depending on the asset class.\n\nThe data goes into a shared state file the next stage reads.\n\nStage two. Signal generation.\n\nThis is where the alpha research happens.\n\nThe signal generation agent reads from a SKILL.md file that holds your alpha research rules.\n\nThe skill grows over time. Every loss writes a new lesson back. Every lesson becomes a new rule for the next run.\n\nThis is what makes the system self improving.\n\nStage three. Verification.\n\nThe signal goes to a completely separate agent. Different model. Different instructions. No exposure to how the original signal was reasoned.\n\nIf verification fails, the signal is killed. If it passes, it moves to execution.\n\nThe verifier never sees what the maker reasoned. That separation is the entire edge.\n\nYou can also use a stronger model for the checker than the maker. Claude Opus for verification, Claude Sonnet for generation. Different model architectures catch different kinds of errors. This is the same logic ensemble methods use in machine learning.\n\n![The maker checker split](https://pbs.twimg.com/media/HLGLfHRaYAAVSku.jpg)\n\nStage four. Execution.\n\nOnly verified signals reach this stage.\n\nThe MCP connector handles the broker API. The loop never asks for permission. Auto mode lets it run hands off.\n\nStage five. Risk monitoring.\n\nRunning in a parallel worktree the entire time.\n\nThis is the kill switch. It enforces rules without negotiation.\n\nTogether these five sub loops form one self running system.\n\nData flows in. Signals get generated. Signals get verified. Verified signals get executed. Risk gets monitored. Lessons get written back to memory.\n\nThen it starts over.\n\n![How the loop compounds](https://pbs.twimg.com/media/HLGL7EeaMAA-zjx.jpg)\n\nI designed this once. I have not prompted any of these steps since.\n\nThat is loop engineering. That is what Boris meant when he said his job is to write loops.\n\nOne warning. A loop without a real stopping condition fails quietly. The agent emits a completion signal believing the half done job is finished. The loop exits. The bad trade sits open.\n\nYour stop conditions need to be checkable by something other than the agent's own claim. \"Sharpe above 1.5 over the last 30 trades.\" \"Drawdown below 5 percent.\" \"Test suite passes.\" Never \"the agent says it is done.\"\n\nIn my game theory article I explained why every trade is a strategic move in a multi player game with imperfect information. If you missed it, you will want to read it right after this:\n\nThe loop is what lets you sit at that table forever without burning out.\n\n## Summary\n\nQuant trading is already a loop. Every fund on Wall Street runs it. They just need hundreds of humans sitting inside.\n\nLoop engineering removes the humans.\n\nSix pieces make every working loop. Automations fire the heartbeat. Skills hold the project knowledge. State files hold the memory. Verifiers grade the output. Worktrees isolate parallel work. Connectors give the loop hands in the real world.\n\nWire them around the five stage trading cycle and you have a self improving system that runs alpha research, verifies signals, executes trades, and monitors risk on its own.\n\nThe system gets smarter every cycle. Every loss writes a new lesson. Every lesson becomes a new rule. After a hundred trades, the skill file is a living document. After a thousand, it is closer to institutional knowledge than anything a single human could remember.\n\nThe funds that build this first will compound for the next decade. The ones still prompting will be left behind.\n\nSo here is the question to sit with.\n\nIf loop engineering is the next abstraction above prompting, and quant trading is the highest stakes loop in the world, are you the person still typing prompts one trade at a time, or are you the architect who designed the loop that trades for you while you sleep?\n\nThere is no wrong answer but there are very revealing ones."}}