<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Christian Faro</title>
    <description>The latest articles on DEV Community by Christian Faro (@christian_faro_70d81c0d16).</description>
    <link>https://dev.to/christian_faro_70d81c0d16</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4011279%2F3147fe1e-89d0-40c7-8232-13a8f9778003.jpg</url>
      <title>DEV Community: Christian Faro</title>
      <link>https://dev.to/christian_faro_70d81c0d16</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/christian_faro_70d81c0d16"/>
    <language>en</language>
    <item>
      <title>How I built a 35-bot trading fleet with an AI pair-programmer</title>
      <dc:creator>Christian Faro</dc:creator>
      <pubDate>Wed, 01 Jul 2026 18:33:40 +0000</pubDate>
      <link>https://dev.to/christian_faro_70d81c0d16/how-i-built-a-35-bot-trading-fleet-with-an-ai-pair-programmer-or-35-trading-bots-one-postgres-16ba</link>
      <guid>https://dev.to/christian_faro_70d81c0d16/how-i-built-a-35-bot-trading-fleet-with-an-ai-pair-programmer-or-35-trading-bots-one-postgres-16ba</guid>
      <description>&lt;p&gt;A note before we start: this is about the machine, not the money. I'm not going to show you returns, positions, or a single "this strategy made X%." Partly because that's a regulatory minefield, and partly because the returns aren't the interesting part — the engineering is. If you came for a get-rich screenshot, this isn't that. If you came to see how one person ships production infrastructure with an AI, pull up a chair.&lt;/p&gt;

&lt;p&gt;The thing I built&lt;br&gt;
Over the last few months I built, with an AI coding agent as my pair-programmer, a fleet of ~35 automated trading bots. They run across five equity markets plus crypto. Each one is a long-running service. They share a single database, post to a live dashboard, fire alerts to my phone, and — the part that took the longest — they're built to survive restarts, reconcile against reality, and refuse to do anything stupid.&lt;/p&gt;

&lt;p&gt;I'm one person. I am not a team. The "team" is me plus an AI in a terminal, working the way you'd work with a very fast, very literal junior engineer who never gets tired and occasionally needs to be talked out of a bad idea.&lt;/p&gt;

&lt;p&gt;Here's how it's put together, and the handful of lessons that cost me the most to learn.&lt;/p&gt;

&lt;p&gt;The architecture, in one breath&lt;br&gt;
One Postgres database is the brain — every trade, signal, and piece of state lives there. Around it sit ~35 containerized bots, each isolated (its own tables, its own config, its own identity), orchestrated with Docker Compose. A Streamlit dashboard reads the database and renders the whole fleet — open positions, P&amp;amp;L curves, health. A notification layer pushes Telegram alerts on every meaningful event. Schema changes go through migrations so a new bot is never born with a stale database shape.&lt;/p&gt;

&lt;p&gt;Each bot is the same skeleton wearing a different hat:&lt;/p&gt;

&lt;p&gt;a signal module (the strategy logic),&lt;br&gt;
a trader that turns signals into orders,&lt;br&gt;
a storage layer that persists everything,&lt;br&gt;
a runner loop on a schedule.&lt;br&gt;
Strategies are swappable. The infra underneath them is identical. That sameness is the whole point: I built the hard part once, then cloned it.&lt;/p&gt;

&lt;p&gt;The five lessons that actually mattered&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;If it isn't in the database, it doesn't exist&lt;br&gt;
My first bots kept state in memory — "have I already entered this position today?" as a variable. Then a container restarts at 3 a.m. and the bot wakes up with amnesia. Every flag that affects a trade has to be persisted. The bot should be able to die mid-thought, come back, and reconstruct exactly where it was from the database alone. This one rule eliminated a whole class of ghosts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The broker is the source of truth, not your code&lt;br&gt;
When a bot goes from fake money to real money, the scariest bug isn't a bad trade — it's a bot that thinks it holds something it doesn't, or vice versa. So on every boot, the live engine reconciles its own ledger against the broker's actual positions. Any mismatch and it halts, loudly, and pings me. It would rather do nothing than act on a wrong picture of the world. "Halt and yell" beats "guess and trade" every single time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Build the brakes before the engine&lt;br&gt;
Before a single real dollar moved, the live path had a kill switch (a database flag checked before every order), a price collar (reject orders priced too far from the last trade), a max order value, a max position size, and a daily-loss circuit breaker that auto-halts the whole thing. Risk rails aren't a feature you add later. They're the thing you build first, because the failure mode of trading software is measured in real money.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Validate with fake money, religiously&lt;br&gt;
Every bot runs as a paper-trader long before it's allowed near a live account, and the live engine is literally the same code as the paper engine with two methods swapped out — so the strategy can't silently drift between "what I tested" and "what's running." The discipline I keep repeating to myself: validate, don't guess. Pull the data, run it, watch it behave, then ship. A backtest is a hypothesis, not a promise — live introduces slippage, partial fills, delayed data, and a dozen frictions a backtest never sees.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Boring infrastructure is the moat&lt;br&gt;
Nobody tweets about idempotent migrations or restart-safety or reconciliation. But that unglamorous plumbing is exactly what separates "a script that worked once" from "a system that runs unattended for months." The strategies are the part people obsess over; the infrastructure is the part that actually decides whether you're still standing in six months.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Working with an AI pair-programmer&lt;br&gt;
The honest version: an AI coding agent didn't replace the thinking. It collapsed the distance between an idea and a running, tested implementation from weeks to hours. That changes what a single person can attempt.&lt;/p&gt;

&lt;p&gt;A few things I learned about the workflow:&lt;/p&gt;

&lt;p&gt;I'm still the operator. The AI builds; I decide. Anything that touches real money, real credentials, or production state is a human decision, every time. The agent never holds the keys to the irreversible stuff.&lt;br&gt;
Small, reversible steps win. Big-bang changes are where AI-assisted dev goes wrong. One scoped change, validated, then the next. Same as good engineering has always been — just faster.&lt;br&gt;
"Validate, don't guess" applies to the AI too. The agent is brilliant and confident and sometimes confidently wrong. So nothing is "done" because it looks done — it's done when it's been run and observed.&lt;br&gt;
The mispriced thing right now is velocity. Most people massively underestimate what one person plus an AI can ship. That gap is real, and it's temporary.&lt;br&gt;
What's next&lt;br&gt;
I pulled the infrastructure skeleton out of this — the orchestration, the storage layer, the dashboard, the paper/live engine pattern, the risk rails, the reconciliation — into something other people can build their own systems on. The strategies stay mine; the shovels I'm happy to share, because the infra is what everyone reinvents badly.&lt;/p&gt;

&lt;p&gt;It's open source, MIT, and docker compose up gives you a fleet paper-trading against a sandbox broker that invents its own prices — zero external data, zero credentials, zero real money:&lt;/p&gt;

&lt;p&gt;→ &lt;a href="https://gitlab.com/myicloudmusic/fleet-kit" rel="noopener noreferrer"&gt;https://gitlab.com/myicloudmusic/fleet-kit&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;No hype, no returns, just the build. The next post breaks down the paper-to-live engine: how the same code trades fake money and real money without ever drifting.&lt;/p&gt;

&lt;p&gt;Built in public from Montreal. The strategies are private; the engineering is open.&lt;/p&gt;

</description>
      <category>python</category>
      <category>docker</category>
      <category>showdev</category>
      <category>buildinpublic</category>
    </item>
  </channel>
</rss>
