<?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: HRK MYO</title>
    <description>The latest articles on DEV Community by HRK MYO (@hrk_myo_3d77c2630f3ffbe2f).</description>
    <link>https://dev.to/hrk_myo_3d77c2630f3ffbe2f</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3942421%2Fdfc73e05-25c8-431f-834f-b04a412cc352.jpg</url>
      <title>DEV Community: HRK MYO</title>
      <link>https://dev.to/hrk_myo_3d77c2630f3ffbe2f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hrk_myo_3d77c2630f3ffbe2f"/>
    <language>en</language>
    <item>
      <title>How I Built an Automated Stock Trading System with Claude Code (82% Win Rate, +10% in 2 Days)</title>
      <dc:creator>HRK MYO</dc:creator>
      <pubDate>Wed, 20 May 2026 13:38:27 +0000</pubDate>
      <link>https://dev.to/hrk_myo_3d77c2630f3ffbe2f/how-i-built-an-automated-stock-trading-system-with-claude-code-82-win-rate-10-in-2-days-34n2</link>
      <guid>https://dev.to/hrk_myo_3d77c2630f3ffbe2f/how-i-built-an-automated-stock-trading-system-with-claude-code-82-win-rate-10-in-2-days-34n2</guid>
      <description>&lt;h1&gt;
  
  
  How I Built an Automated Stock Trading System with Claude Code (82% Win Rate, +10% in 2 Days)
&lt;/h1&gt;

&lt;p&gt;I'm not a professional programmer. I've never learned Python or JavaScript formally. But in 2 days, I built a fully automated stock trading system using &lt;strong&gt;Claude Code&lt;/strong&gt; — and it achieved an &lt;strong&gt;82% win rate with +10% return&lt;/strong&gt; in its first live run.&lt;/p&gt;

&lt;p&gt;This is the story of how I did it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;A fully automated trading system that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Screens all 4,370 stocks&lt;/strong&gt; listed on the Tokyo Stock Exchange&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Places orders automatically&lt;/strong&gt; when conditions are met&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cuts losses and takes profits&lt;/strong&gt; without any manual intervention&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Runs 24/7&lt;/strong&gt; without me touching it&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first 2 days of live trading:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Confirmed profit: &lt;strong&gt;+¥12,700 (+10.0%)&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Win rate: &lt;strong&gt;82%&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Claude Code?
&lt;/h2&gt;

&lt;p&gt;I've tried coding with ChatGPT before. It's good at explaining concepts, but when you need to build a real, working system with multiple files, error handling, and API integrations — it falls apart.&lt;/p&gt;

&lt;p&gt;Claude Code is different. You work with it like a senior engineer on your team:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It reads your existing files before making changes&lt;/li&gt;
&lt;li&gt;It runs commands and checks the results&lt;/li&gt;
&lt;li&gt;It catches its own mistakes and fixes them&lt;/li&gt;
&lt;li&gt;It asks for clarification when something is ambiguous&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I gave it a clear goal: &lt;em&gt;"Build me an automated stock trading system for the Tokyo Stock Exchange."&lt;/em&gt; What came out was production-quality code.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Architecture
&lt;/h2&gt;

&lt;p&gt;The system has 4 main components:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Screener (&lt;code&gt;screener.py&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Pulls real-time data for all TSE-listed stocks and applies filters:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Price momentum (short-term trend)&lt;/li&gt;
&lt;li&gt;Volume spike detection&lt;/li&gt;
&lt;li&gt;Moving average crossover signals&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Runs every morning before market open.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Order Manager (&lt;code&gt;order_manager.py&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;When the screener flags a stock:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Calculates position size based on available capital&lt;/li&gt;
&lt;li&gt;Places market or limit orders via the brokerage API&lt;/li&gt;
&lt;li&gt;Logs every action with timestamps&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. Risk Manager (&lt;code&gt;risk_manager.py&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;Monitors all open positions in real time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stop loss&lt;/strong&gt;: Automatically exits if price drops X%&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Take profit&lt;/strong&gt;: Locks in gains when target is hit&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Max drawdown&lt;/strong&gt;: Pauses all new orders if daily loss exceeds threshold&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Dashboard (&lt;code&gt;dashboard.py&lt;/code&gt;)
&lt;/h3&gt;

&lt;p&gt;A simple terminal UI showing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Current positions and P&amp;amp;L&lt;/li&gt;
&lt;li&gt;Today's completed trades&lt;/li&gt;
&lt;li&gt;System health status&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Prompt That Started It All
&lt;/h2&gt;

&lt;p&gt;Here's roughly what I typed to Claude Code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I want to build a stock trading bot for the Tokyo Stock Exchange.
Requirements:
- Screen all TSE stocks daily for momentum signals
- Auto-place orders through [brokerage] API
- Stop loss at -3%, take profit at +5%
- Log everything
- I want to be able to run it with a single command

Start by reading the brokerage API documentation I've attached, then plan the architecture before writing any code.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's it. Claude Code read the docs, planned the architecture, asked me 3 clarifying questions, then started building.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Key Insight: Treat It Like a Junior Engineer
&lt;/h2&gt;

&lt;p&gt;The biggest mistake people make with AI coding tools is treating them like search engines — asking one-off questions and then stitching the answers together yourself.&lt;/p&gt;

&lt;p&gt;Instead, I gave Claude Code &lt;strong&gt;ownership&lt;/strong&gt; of the project:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Context first&lt;/strong&gt;: I shared the API docs, my goals, and constraints upfront&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Let it plan&lt;/strong&gt;: I reviewed and approved the architecture before any code was written&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Iterative testing&lt;/strong&gt;: After each component, we tested it together and fixed issues&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real feedback&lt;/strong&gt;: When something didn't work, I pasted the error and said "fix this"&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The result was a coherent system, not a pile of disconnected scripts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results After 2 Days
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Total trades&lt;/td&gt;
&lt;td&gt;17&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Winning trades&lt;/td&gt;
&lt;td&gt;14&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Win rate&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;82.4%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Total return&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;+10.0%&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Max drawdown&lt;/td&gt;
&lt;td&gt;-1.2%&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Avg hold time&lt;/td&gt;
&lt;td&gt;4.3 hours&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Not financial advice. Past performance doesn't guarantee future results. But as a proof of concept for what AI-assisted development can achieve — I'm pretty happy with it.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. You don't need to be a programmer&lt;/strong&gt;&lt;br&gt;
The hardest part wasn't the code — it was understanding what I wanted to build well enough to explain it clearly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The bottleneck is your thinking, not your typing&lt;/strong&gt;&lt;br&gt;
Claude Code can write the code. What it can't do is decide &lt;em&gt;what&lt;/em&gt; to build. That's still on you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Iteration beats perfection&lt;/strong&gt;&lt;br&gt;
The first version was rough. We went through 8 iterations over 2 days, fixing edge cases and adding features. That's normal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Test in production (carefully)&lt;/strong&gt;&lt;br&gt;
I started with the minimum position size my broker allowed. Real market conditions reveal bugs that backtesting misses.&lt;/p&gt;

&lt;h2&gt;
  
  
  Full Walkthrough
&lt;/h2&gt;

&lt;p&gt;I documented the complete process — every prompt I used, the full architecture, all the code, and the live trading logs — in a paid article on note.com.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;&lt;a href="https://note.com/claude_sidejob/n/n59f05d1a00c8" rel="noopener noreferrer"&gt;Full article (Japanese) — ¥1,980&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The complete prompt sequence I used with Claude Code&lt;/li&gt;
&lt;li&gt;Full source code for all 4 components&lt;/li&gt;
&lt;li&gt;Backtest results vs live results comparison&lt;/li&gt;
&lt;li&gt;The 3 bugs that almost cost me money and how we fixed them&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Built with Claude Code. No prior programming experience required.&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  claudecode #algorithmictrading #python #automation #AI
&lt;/h1&gt;

</description>
      <category>claudecode</category>
      <category>python</category>
      <category>automation</category>
      <category>trading</category>
    </item>
  </channel>
</rss>
