Miles Deutscher Finance
Miles Deutscher FinanceSep 10
Crypto

How To Build an AI Trading Bot That Trades While You Sleep (full guide)

20 min video4 key momentsWatch original
⚡
TL;DR

Miles Deutscher shows how to build a Claude-powered crypto trading bot in under 10 minutes using an MCP connection—no coding required, full execution automation.

Key Insights

1

Execution failures, not bad picks — Most traders lose money not from bad picks but from execution failures — buying at the wrong time, selling too early, or failing to take profits systematically. Automating execution through AI removes emotion and timing delays.

2

MCP makes this possible now — Claude and other LLMs can now connect directly to crypto exchanges via Model Context Protocol (MCP), which became possible only in the last six months. This integration lets you voice prompt a trade and have it execute automatically across assets.

3

Memory system is critical — You need a memory system — a folder with context files, instructions, and a ledger that tracks every trade's trigger, timing, and outcome. Without it, Claude gives generic advice instead of personalized strategy tailored to your goals and risk.

4

Ledger plus learnings compounds knowledge — A ledger file logs every trade and why it fired; a learnings file documents what the bot learned after each trade closes. Pairing these with your own pre-trade reflections creates a compounding feedback loop that improves decision-making over months and years.

5

Avoid over-engineering with rules — Don't create permanent rules after every loss — most professional traders have 40% win rates but win big on winners. Instead, observe patterns over time before introducing a rule, then assess it; over-engineering with too many rules kills profitable strategies.

Want this for every new video Miles Deutscher Finance posts? Brevyd summarizes each upload automatically, the morning it drops.

Deep Dive

Why execution automation matters more than strategy selection

Miles opens by stating that most traders lose not because their directional ideas are wrong, but because execution breaks down — missed entries, poor exits, profit-taking at the wrong moment. He pivoted to trading bots in 2023 after noticing he was round-tripping too much capital. Earlier AI models made bots impractical, but recent improvements in Claude and GPT have made the approach viable again. Critically, exchanges like Bybit have only recently shipped native Model Context Protocol (MCPs) and AI toolkits; without these, connecting an LLM to an exchange was technically impossible. This convergence of better models plus exchange infrastructure means what Miles is showing was literally impossible six months ago. He's clear this isn't a set-and-forget money printer, but a customizable execution layer where you plug in any strategy — whether algorithmic, discretionary, or hybrid.

Setting up the technical stack: Claude, MCP, exchange, and memory

The setup requires a Claude subscription (or ChatGPT with Codex), Node.js installed locally, and an exchange account supporting MCP natively — Miles uses Bybit. The architecture flows: Claude acts as the brain sending instructions to the MCP, which relays commands to the exchange for order execution, and the exchange reports back data through the MCP to Claude. Before any trading, you build a memory system in a folder on your computer containing a context file describing your financial situation and goals, an instructions document defining how Claude should behave, and a memory.md file that updates based on your learnings. Miles recommends voice prompting with Claude first to co-create this profile, converting the conversation into markdown. The key advantage over Bybit's built-in grid and DCA bots is full customizability — you can ask Claude to execute a specific Pine Script backtest, buy Bitcoin when price drops 10% and volatility hits 1.5 on a custom index, or run any rule you define. Once you create exchange API credentials with trading permission enabled and withdrawals off for security, Claude can verify the connection and make test orders to confirm the pipeline works end-to-end.

Building feedback loops: ledgers, learnings, and reflection before every trade

The execution layer is only half the system; the other half is structured learning. Miles implements two critical files: a ledger that logs what fired, when, why, and the outcome, and a learnings file that the bot writes in plain English after every closed trade summarizing what was learned. He goes further by encouraging traders to add personal reflections before entering a trade — stating your thesis, the catalyst, and your invalidation price — then reflecting after the position closes. This forced reflection prevents the impulse trading that plagued him earlier. However, he warns against over-adjusting: most great traders have 40% win rates, so a single loss shouldn't spawn a new rule. Instead, observe patterns over time, and only introduce a rule once you're confident in the pattern. Over-engineering kills profitable strategies by adding too many conditions. The power emerges over years of compounding data — every trade logged, every outcome recorded, every decision documented. AI excels at processing this data retroactively, allowing you to recall exactly why you entered a trade months ago and assess whether the pattern held. This removes the human brain's limitation of forgetting specifics and creates a systematic, auditable approach to trading.

Remote execution and integration with Telegram for hands-free trading

Miles extends the system to work from his phone via Telegram. He sets up a Telegram bot using BotFather, connects it to his Claude session (running 24/7 on a separate device like a Mac Mini or $10 VPS), and uses WhisperFlow to send voice messages that transcribe into text and reach Claude. This allows him to query account balances, portfolio changes, and place trades while traveling without touching a computer. The constraint is that Claude only accesses files on devices currently running; cloud-based solutions like Claude Dispatch face the same limitation. He prefers Telegram since he's already messaging on it for business. This setup extends to stock portfolios too — he's built a similar system for Interactive Brokers using TWS (the trading workstation application), allowing him to monitor and trade equities using the same execution framework. The pattern generalizes: any brokerage or exchange with an API or MCP connection can be automated, whether crypto, stocks, or commodities. By automating execution and making it accessible from his phone, Miles spends far less time at a computer while staying continuously updated — a major quality-of-life win given his travel schedule and conference attendance.

Takeaways

  • ✓Set up a memory system with context files, instructions, and a ledger before trading—this forces disciplined reflection and prevents Claude from giving generic advice.
  • ✓Use a sub-account or paper trading account to test strategies before risking your main portfolio, since AI execution errors still happen.
  • ✓Log every trade reason and invalidation level before executing, then review learnings after—compound this data over years to build systematic trading rules, not reactive ones based on single losses.
  • ✓Connect Telegram to your Claude session running on a Mac Mini or VPS so you can voice-prompt trades and get portfolio updates while traveling, without being chained to your computer.

Key moments

1:15Why people lose money trading

“Most people who lose money in trading don't necessarily lose money because they pick bad trades. Oftentimes, they have bad execution.”

2:09What changed in the last 6 months

“What I'm going to show you today was literally not possible 6 months ago. Exchanges weren't letting you connect an LLM, but now they're all shipping their own MCPs.”

7:47Why custom AI bots beat built-in exchange bots

“We can ask the exchange to buy Bitcoin every time price drops 10% on a day and has an implied volatility of 1.5 on a custom index. The problem with the bots that are inbuilt into the exchange is that they don't give you that level of customizability.”

14:07The learnings file system

“The bot writes itself in plain English after every trade that closes that establishes what it learned from that trade. This forced reflection and storage of that reflection is such an important thing that AI can now help with.”

You just read one. Brevyd does this for every upload.

Follow Miles Deutscher Finance and every new video comes back as a summary like this, in your morning briefing. No watching required.