I Built a Stock Trading Bot With AI, Ran It, Then Shut It Down

In my post explaining MCP and APIs I mentioned, in one line, that I’d tried automated stock trading and that it ended up being more hassle than help unless you trade seriously. This is the longer version of that line.

To be clear up front: this is about building the program. It isn’t a recommendation for any stock or any trading method.

What I built

I signed up for the REST API from Kiwoom Securities, a Korean brokerage, and built a short-term trading program for Korean stocks with AI doing most of the coding. I named it “Kim Secretary STOCK,” after the nickname I already use for my AI assistant. During market hours it looks for stocks worth buying, buys when the conditions line up, and sells by rules I set in advance.

One early decision mattered more than anything else. I didn’t let AI make the buy or sell call in real time. Instead, I built a rule-based engine that scores stocks with technical indicators, and then I tuned the rules myself. If I’m asking an AI every few seconds, I can’t look back later and see why a trade happened. With fixed rules, I can.

Flow of the stock bot: find candidates, score, grade, buy, sell, with safety rails
Find candidates, score them, grade them, buy by grade, and sell by fixed rules.
  • Finding candidates. It combines the stocks with the highest trading value and the ones with a sudden jump in volume.
  • Scoring. Moving averages (5, 20 and 60 days), Bollinger Bands, RSI, MACD, volume compared with normal, and the day’s price change each add positive or negative points.
  • Grades. Scores become A, B, C or D. It buys an A if there is one, otherwise a B. C is watch-only.
  • Selling. There’s a stop-loss and a take-profit line. Once a position is up past a set level, it sells if the price falls a set percentage from its peak.

I added safety rails, too. There’s a cap on how many new buys it can make in a day, and if the day’s losses pass a set amount, it stops buying until the next day. By default it runs as paper trading with no real money, and real orders only go through when two separate settings are both turned on. I also planned a Telegram bot command to cut off new buys if I needed to stop it fast.

The first version ran in a window on my PC. Then, so it could run with the PC off, I had the code written for a server version that stays up on Linux around the clock.

It worked. It was also a burden

The program did what it was supposed to do. It found candidates, scored them and followed the rules. Then problems I hadn’t thought about started showing up.

The PC version needs the computer on, with the program open, for the whole trading day. Every day I had to start it and check it was running properly. I have a day job managing telecom construction, with site work and meetings during the day. Babysitting a program every morning was more of a load than I expected.

That’s why I built the server version. But running it for real means keeping a separate server up 24 hours a day. Then come the follow-up chores: checking that orders actually filled, making it pick up where it left off if the server restarts, handling market holidays. When I listed everything I’d need to harden before trusting it with a real account, the list was long.

So I stopped there. Unless I’m going to trade seriously, running and maintaining a server for this isn’t worth it. A program I built to make money had turned into one more thing to look after every day.

What I kept

I dropped the automatic buying and selling, but one part proved genuinely useful: the screening and scoring.

Seeing at a glance why a stock made the candidate list, and how each indicator came out, is much faster than flipping through charts one by one. Even if I press the buy button myself, a tool that lays out the evidence is worth having. I wanted to add fundamentals, financial ratios and news to the score too, and if I pick this up again, that’s where it’ll go: an analysis tool, not a bot.

Looking back, it’s the same lesson I got from building a work dashboard with ChatGPT. With AI, you can build a working program without knowing how to code. Making it something you can trust and leave running every day is a separate job, and you only find out whether you actually need that job after you’ve built the thing.

This post describes a personal programming project. It is not investment advice or a recommendation of any stock or trading method. Investing in stocks can lose money, and every investment decision and its consequences are your own.

Leave a Comment