2026-07-03
Dev.to — Technical Article Draft
Post to: https://dev.to/new (requires account — Kamal-required for posting)
Format: Markdown article with code blocks
Title: Building an AI Crypto Trading Bot with Verifiable Live Performance
Tags: python, crypto, trading, ai
Cover image: Screenshot of results page or signal pipeline diagram
I built an automated crypto trading bot. This is the architecture, the signal pipeline, and the honest live results — including today's -4.82%.
The Problem
The crypto trading bot space is 99% scams. Fake screenshots. Cherry-picked backtests. "Guaranteed returns." I got tired of it and decided to build something transparent.
The Architecture
```
kamoubot.py Runtime entry point
config/ Env loading, config resolution, validation
analyzedata/ Data fetch → indicators → T1/T2/T3 signal flow
executeentry/ Trade planning, sizing, entry gating
oms/ Orders, protections, position handling
reconciliation/ Exchange-truth sync and drift repair
exchange/ CCXT + KuCoin adapters, WebSocket
db/ SQLite schema, migrations, stores
api/ FastAPI app and routes
```
Python. FastAPI. SQLite. CCXT for exchange integration. No fancy frameworks — boring, reliable tech.
The Signal Pipeline: T1 → T2 → T3
This is the core. Three tiers of filtering, each more expensive than the last.
T1: Math Ranking
200+ symbols scanned per cycle. For each symbol, we compute:
- Order flow imbalance (OFI)
- Funding rate fade signals
- Long/short ratio fade
- Mean reversion indicators
- Cross-asset macro signals
Each strategy produces a score. T1 ranks all symbols by score.
```python
Simplified T1 scoring
def t1_score(symbol, strategy, data):
if strategy == "orderflow_imbalance":
return ofi_score(data)
elif strategy == "fr_fade":
return funding_rate_fade_score(data)
# ... 6 strategies total
return 0
```
T2: Rules-Based Veto
T1 produces candidates. T2 kills the bad ones:
- R:R ratio below threshold? Vetoed.
- Symbol on exclude list (historical losers)? Vetoed.
- Wrong regime for this strategy? Vetoed.
- Hour bucket with historical negative expectancy? Vetoed.
T2 is cheap and fast. It's a bouncer, not a thinker.
T3: AI Refiner
The survivors of T1+T2 go to T3 — an AI model that evaluates the final signal quality. This is the most expensive step, so we only run it on pre-filtered candidates.
Risk Controls (The Important Part)
This is what separates a real trading system from a casino:
1. 1% max risk per trade — No trade risks more than 1% of total balance. Enforced in code, no bypass.
2. 15% max exposure — No single position exceeds 15% of total balance.
3. Mandatory stop-loss from entry — Every position has a stop-loss from the moment it opens.
4. Drawdown circuit breaker — Halts trading at the daily loss limit. Today it fired at -4.82%.
5. Shadow validation — No strategy goes live without N≥30 trades, Sharpe>0.5, expectancy>$1/100 trades.
6. Non-custodial — Withdrawal-disabled API keys only. Your keys stay yours.
Shadow Validation: The Gate
Before any strategy touches live capital, it runs in shadow mode:
```
SHADOW → N≥30 trades? → Sharpe>0.5? → Expectancy>$1/100? → LIVE
↓
SHADOW (stay)
```
If a live strategy's performance degrades, the expectancy engine demotes it back to shadow. This is automated — no human decides promotions or demotions.
Reconciliation: Exchange as Truth
Every cycle, we reconcile our local state against the exchange. If there's drift (our DB says one thing, the exchange says another), we fix our state to match the exchange. The exchange is always right.
The Honest Results
Today: -4.82%. Win rate: 30%. Sharpe: -1.37. The daily loss halt fired.
I'm publishing this because:
1. It's the truth
2. Anyone evaluating a trading system deserves to see the bad days
3. The circuit breaker firing is the value proposition — a controlled stop, not a crash
Live API (no signup): https://superkamoubot.com/results
The Tech Stack
- Python 3.10+ — the whole bot
- FastAPI — public API surface
- SQLite — state storage (yes, SQLite. It works fine for this scale)
- CCXT — exchange abstraction
- httpx — async HTTP
- No fancy ML frameworks — the AI refiner is an API call, not a local model
What I Learned
1. Win rate is the wrong metric. 30% win rate with 2.3:1 R:R is profitable. Optimize expectancy, not win count.
2. Shadow validation prevents disasters. Strategies that look great in backtest can lose money live. The gate catches them.
3. Reconciliation is non-negotiable. If your local state drifts from the exchange, you're trading on fiction.
4. Governance matters. Every config change tracked, every strategy lifecycle managed. Operational mistakes are first-class failure modes.
5. Honesty is a feature. Publishing losing days builds more trust than any marketing copy.
Links
- Website: https://superkamoubot.com
- Live results: https://superkamoubot.com/results
- How it works: https://superkamoubot.com/how-it-works
- Pricing: https://superkamoubot.com/pricing
Notes:
- Dev.to requires a human account to post. Kamal must create an account and submit.
- Dev.to culture: technical, code-heavy, honest. This draft fits.
- Best posting time: Tuesday-Thursday morning.
- Add real code snippets from the codebase before posting (the simplified examples above should be replaced with actual code).
Marketing
Risk Notice: Trading cryptocurrency futures involves substantial risk of loss. Past performance does not guarantee future results. This is not financial advice.
