{"slug": "llm-trader-bot", "title": "LLM TRADER BOT", "summary": "A developer in Wrocław built an LLM-powered trading bot that uses visual inference on candlestick charts via Google Gemini 3.6 Flash, after reading 77 research papers to overcome initial failures. The bot generates 4K PNG charts with five overlay indicators and uses a custom JIT-compiled indicator engine built from scratch with NumPy and Numba, running 50 indicators in microseconds on a CPU. It employs a single-prompt framework that forces the LLM to argue both bullish and bearish cases, combined with an Expected Value Framework to validate signals mathematically.", "body_md": "Let me tell you a story about failure.\n\nLate 2024. I'm sitting in my Wrocław apartment after an 8-hour warehouse shift. My back hurts. I've been trying to make a trading bot work for two weeks. Every night, same result: the LLM generates beautiful-sounding analysis. Confident. Articulate. Completely wrong.\n\n\"RSI is 28, oversold. BUY.\"\n\nNext morning: -4.2%.\n\nThe problem wasn't the LLM being stupid. It was me being lazy. I was dumping numbers into a prompt and hoping for magic — the exact thing every \"LLM trading bot\" tutorial on YouTube tells you to do.\n\nI had three options: give up, buy a course, or do what nobody else was doing — read the actual research papers. I chose option three. 77 papers later, I understood the real problem. And I built something that fixes it.\n\nEvery cycle, the bot generates a 4K PNG candlestick chart with 5 overlay indicators (SMA, RSI, Volume, CMF, OBV). This image goes directly to Google Gemini 3.6 Flash. Not as bytes. Not as a data URL. As a visual inference.\n\nI spent two weeks coding pattern detection algorithms — head and shoulders, wedges, trendlines. Then I compared the AI's visual reads against my code. The AI was better. By a lot. I deleted 900 lines of pattern detection code. Never looked back.\n\nNo pandas-ta. No TA-Lib. I built the entire indicator engine from scratch Let me tell you a story about failure.\n\nLate 2024. I'm sitting in my Wrocław apartment after an 8-hour warehouse shift. My back hurts. I've been trying to make a trading bot work for two weeks. Every night, same result: the LLM generates beautiful-sounding analysis. Confident. Articulate. Completely wrong.\n\n\"RSI is 28, oversold. BUY.\"\n\nNext morning: -4.2%.\n\nThe problem wasn't the LLM being stupid. It was me being lazy. I was dumping numbers into a prompt and hoping for magic — the exact thing every \"LLM trading bot\" tutorial on YouTube tells you to do.\n\nI had three options: give up, buy a course, or do what nobody else was doing — read the actual research papers. I chose option three. 77 papers later, I understood the real problem. And I built something that fixes it.\n\nEvery cycle, the bot generates a 4K PNG candlestick chart with 5 overlay indicators (SMA, RSI, Volume, CMF, OBV). This image goes directly to Google Gemini 3.6 Flash. Not as bytes. Not as a data URL. As a visual inference.\n\nI spent two weeks coding pattern detection algorithms — head and shoulders, wedges, trendlines. Then I compared the AI's visual reads against my code. The AI was better. By a lot. I deleted 900 lines of pattern detection code. Never looked back.\n\nNo pandas-ta. No TA-Lib. I built the entire indicator engine from scratch using NumPy and Numba. Every EMA, SMA, MACD, ADX, Stochastic, Bollinger Band, TTM Squeeze, Ichimoku, and 11 moving average variants compiles to machine code on first call and caches the result.\n\n``` python\n@njit(cache=True)\ndef _ema_numba(prices, period):\n    alpha = 2.0 / (period + 1)\n    result = np.empty_like(prices)\n    result[0] = prices[0]\n    for i in range(1, len(prices)):\n        result[i] = alpha * prices[i] + (1 - alpha) * result[i - 1]\n    return result\n```\n\n50 indicators. All custom. All JIT-compiled. All running in microseconds on a CPU. No CUDA. No cloud. Just a Ryzen 5700G on my desk.\n\nTradingAgents spawns separate agents for bull and bear analysis. Smart, but each one costs an API call. My bot gives the LLM a single instruction: argue the bullish case first (with evidence), then argue the bearish case (with the same rigor). Then decide.\n\nOne prompt. Both perspectives. Zero extra tokens. The model holds both arguments in context simultaneously — it can't \"forget\" the counter-argument halfway through.\n\nOptiver found LLMs can explain expected value but can't execute it. My EV Framework computes:\n\nThe LLM provides the reasoning. The EV Framework provides the math. If the LLM says \"strong buy\" but EV comes back negative — HOLD.\n\nBefore any signal is accepted, the LLM must write one sentence:\n\n\"This signal would be proven wrong if [specific price level or indicator condition] occurs.\"\n\nIf it can't name one — rejected. If the named condition triggers — position closed early. If the condition is vague — rejected, try again. This single prompt addition improved signal quality more than any other change.\n\nEvery closed trade gets embedded as a vector with 15+ metadata fields: symbol, direction, entry price, exit price, P&L percentage, max adverse excursion, timeframe, ADX at entry, trend strength, RSI, volume trend, pattern detected, news sentiment score, surprise ratio, and closed timestamp.\n\nOn every new analysis cycle, the bot queries ChromaDB (now on **BAAI/bge-base-en-v1.5 768D** embeddings): \"Find me the 5 most similar trades to this current setup.\" These 5 trades are injected into the LLM prompt with their outcomes. Time-decay ensures recent trades carry 3x more weight than old ones.\n\nIn the `.ai/`\n\ndirectory, eight specialized agent prompts — one Supervisor plus seven workers. Each has a dedicated scope, journal, and personality. They've produced real commits:\n\n`main`\n\n133 commits since the agent system was introduced. Every one tested. Every one documented.\n\nEvery AI response passes through:\n\nReddit JSON (free, no auth), X/Twitter via Nitter (public feeds), RSS from CoinDesk, CoinTelegraph, Decrypt, CryptoSlate — enriched via Crawl4AI. All processed through a RAG engine built on ChromaDB. No monthly bills. No API rate limits.\n\n1,324 tests. Fully mocked — no network, no ChromaDB, no LLM API. They run in about 60 seconds on any machine. Codacy CLI v2 + ruff for automated quality gates. AST-based codebase vector search for semantic navigation.\n\nCoverage includes: LLM output corruption, async race conditions, rate limiting with exponential backoff, vector DB boundaries, friction reporting for all 6 guard types, closed-loop feedback injection, ticker retry with network timeout handling.\n\nWhen Optiver says LLMs \"fail to incorporate new information after acting\" — my tests verify the bot doesn't do that. When the arXiv survey says reproducibility is the bottleneck — my tests are deterministic.\n\n☕\n\nThis project is 100% self-funded.No company. No investors. Just a warehouse worker paying for servers and API keys. If this gave you an idea or saved you time —[Buy Me a Coffee]helps keep it running.[qrak.org]has more free content (AdSense-supported — every visit helps).\n\nMonth-to-month cost: **0 zł**. Not \"almost free.\" Free.\n\n```\ngit clone https://github.com/qrak/LLM_trader.git\ncd LLM_trader\npython -m venv .venv\nsource .venv/bin/activate\npip install -r requirements.txt\ncp keys.env.example keys.env\npython start.py\n```\n\nDashboard at `localhost:8000`\n\n. Windows users: `scripts/experimental_branch.ps1`\n\n.\n\n**What this bot IS:**\n\n**What it's NOT:**\n\n*Built in Wrocław, Poland. No degree. No bootcamp. Just Python, asyncio, and thousands of hours after warehouse shifts.*\n\n**☕ Support:** [buymeacoffee.com/qrak](https://www.buymeacoffee.com/qrak) — every coffee = real API calls\n\n**📊 Live:** [semanticsignal.qrak.org](https://semanticsignal.qrak.org) — watch it trade in real time\n\n**📚 More:** [qrak.org](https://qrak.org) — research, articles, free resources (AdSense-supported)", "url": "https://wpnews.pro/news/llm-trader-bot", "canonical_source": "https://dev.to/qrak/llm-trader-bot-3625", "published_at": "2026-07-29 23:13:41+00:00", "updated_at": "2026-07-29 23:32:33.283088+00:00", "lang": "en", "topics": ["artificial-intelligence", "large-language-models", "ai-tools", "ai-agents"], "entities": ["Google Gemini", "NumPy", "Numba", "Ryzen 5700G", "Optiver"], "alternates": {"html": "https://wpnews.pro/news/llm-trader-bot", "markdown": "https://wpnews.pro/news/llm-trader-bot.md", "text": "https://wpnews.pro/news/llm-trader-bot.txt", "jsonld": "https://wpnews.pro/news/llm-trader-bot.jsonld"}}