DEV Community

William Wang
William Wang

Posted on

How I Built an AI Trading Discipline Scorer (and Why Profit Isn't the Right Metric)

90% of traders lose money. Not because they can't read charts — but because they can't follow their own rules.

I've been building KeepRule, a trading journal that uses AI to score your discipline rather than just tracking profit and loss. Here's the story behind it and the tech that powers it.

The Problem

Every trader has experienced this cycle:

  1. Market dips → panic sell
  2. Price bounces back → regret
  3. Buy high on FOMO → repeat

The problem isn't strategy. It's execution. Warren Buffett's Rule #1 is "Never lose money" — but how do you actually implement that?

The Solution: Score Discipline, Not Profit

KeepRule works in three steps:

1. Record

Before every trade, the user logs their thesis AND their emotional state. Not just "I bought AAPL at $150" but "I bought AAPL because of strong earnings, and I'm feeling confident but not FOMO-driven."

2. Refine

Over time, wins and losses become patterns. The app helps extract personal trading rules like:

  • "Never risk more than 2% on a single position"
  • "Don't trade within 30 minutes of market open"
  • "Don't trade on FOMO"

3. AI Discipline Score

Here's where it gets interesting. An AI reviews each trade and scores whether the trader followed their own rules — not whether they made money. A disciplined loss is better than a lucky win.

Tech Stack

  • Frontend: Nuxt 3 (SSR for SEO)
  • Backend: Go-Zero (high-performance Go microservice framework)
  • AI Scoring: Claude API for analyzing trade journals against personal rules
  • Database: MySQL with structured trade logs

The Explainer Video

I also built an explainer video using Remotion (React-based programmatic video framework) with Edge-TTS for voiceover generation. The whole video is code — every animation, transition, and scene is a React component.

Key lesson from video production: never use CSS filter: blur() in Remotion — it causes frame-to-frame flickering in headless Chrome's multi-threaded rendering. Use radial-gradient and textShadow instead, and render with --concurrency=1.

What I Learned

The biggest insight: traders don't need more information. They need a system that makes their existing knowledge actionable even when emotions are running high.

If you're interested, try it free at keeprule.com. Would love feedback from the dev community!


Built by William Wang — also building GEOScore AI for AI search visibility.

Top comments (0)