Back to the System
// Algorithmic & AI Trading Systems

Bots that trade. Logs that don't lie.

Fully automated Python trading engines wired to live news feeds, trained on real trading-class material, and journalled to a web dashboard you can open from anywhere. The bot trades. The journal proves it.

Capabilities

Six things that make the bot
actually work in production.

01

Fully Automated Python Engine

The trading core is pure Python — connects to your broker API, runs the strategy loop, executes orders, handles retries and reconnects. Runs 24/7 in a Docker container with auto-restart, no babysitting required.

Python 3.12asyncioBroker SDKDocker
02

Live News API Integration

Pulls real-time market headlines and macro events from sources like Polygon, Alpha Vantage, NewsAPI, and Benzinga. Sentiment is scored and fused with price action so the bot trades on what's actually happening, not yesterday's chart.

PolygonNewsAPIBenzingaSentiment
03

Trading-Class & Mind Materials

Your course notes, mentor playbooks, and the psychology behind disciplined trading are ingested as the bot's knowledge base. The model learns rules it can quote — entries, exits, risk caps, position sizing — not just patterns it guessed at.

RAGVector DBRule Encoding
04

Web-Based Trade Journal

Every move — entries, exits, the news the bot saw, the reasoning it gave — is written to a clean web dashboard. Open it on any device. Search, filter, replay. No CSVs, no terminal logs. Your performance history, readable.

PostgresRealtime UIExport
05

Self-Improving Learning Phase

A nightly review loop replays the day's trades, scores what worked and what didn't, and adjusts confidence weights for setups, time-of-day, and news categories. The bot gets sharper at reading your market, not a generic one.

Bayesian UpdateWalk-ForwardAuto-Tune
06

LLM RAG or ML Backbone

Two brains, your call. Hosted LLM (Claude / GPT) with a RAG layer that reasons in natural language and trades like a disciplined human, or a classical ML model (gradient boosted trees, LSTM) for pure-signal latency-sensitive setups. Either way, the Python execute engine has final say.

Claude APIGPT APIXGBoostLSTM
Architecture

How the data becomes a trade.

01 // Ingest

Market + News

Price ticks from the broker, headlines from news APIs, macro calendar events. Normalised into a unified stream with timestamps, source, and confidence.

polygon.io · alpha_vantage
02 // Reason

LLM + RAG Brain

Retrieves relevant rules from your trading class & mindset notes. Reads the news, scores the setup, proposes an action with a written rationale and confidence.

claude · gpt · vector_db
03 // Execute

Python Safety Engine

Validates the trade against hard rules — position size, risk caps, market hours, instrument whitelist. Rejects or trims anything the LLM hallucinated.

execute_trade.py
04 // Log

Journal & Learn

Order writes to the broker. Every detail — inputs, reasoning, fill, P&L — writes to Postgres. The web journal updates live. The nightly loop reviews.

postgres · web_journal
Zero Hallucinations

The LLM suggests.
The Python engine decides.

LLMs hallucinate. They can invent ticker symbols, miscount lots, or talk themselves into oversized positions. That's fine — because the LLM never touches your broker.

Every action the model proposes is parsed, schema-validated, and run through a deterministic safety engine in Python before a single order goes out. If the LLM says "buy 4,000 shares of TSLAA", the engine sees: invalid ticker, position exceeds risk cap, market closed — and the trade dies on the floor with a logged rejection. The bot never hesitates, never freezes, never wires up a hallucination to real capital.

  • Hard position-size and daily-loss caps enforced in code, not prompts
  • Ticker whitelist + market-hours check before every order
  • Structured JSON output from the LLM — anything malformed is rejected
  • Two-tier confirmation: the model's confidence is also a gate
  • Every rejection is logged to the journal with the reason
# execute_trade.py — the safety layer def execute(proposal: dict) -> Result: if proposal["symbol"] not in WHITELIST: return reject("unknown symbol") if proposal["qty"] * price > MAX_RISK: proposal["qty"] = trim_to_cap() if not market_open(): return reject("market closed") if proposal["confidence"] < 0.62: return reject("low confidence") order = broker.place(**proposal) journal.write(proposal, order, news_ctx) return ok(order)
Web Journal

Every move, logged. Open it on any device.

The bot writes a structured entry for every action it considers — not just fills. Skipped setups, rejected hallucinations, take-profits, partial closes. You see what it saw, why it acted, and what it learned. Filterable, searchable, exportable.

journal.riddleholding.com — live ● Bot online
Today
Net P&L
+$1,284
Trades
7
Win Rate
71%
Rejections
3
By Category
  • Earnings +$640
  • Macro News +$420
  • Technical +$224
  • Hallucination rejects 0 lost
NVDA Long 25 +$312 14:32 EST · entry $872.40 · exit $884.88

Headline at 14:28 confirmed enterprise GPU contract. Volume spike on 5m matched the rule from week-6 lesson notes ("breakout on news + above 20MA"). Position sized to 0.6% account risk; stop $866.20.

News-drivenBreakoutRule 6.3
SPY Short 40 +$184 11:05 EST · entry $501.20 · exit $499.32

CPI print 0.2% above consensus. RAG retrieved the macro-surprise playbook; brain proposed short with high confidence. Safety engine confirmed risk fit, executed. Trailed stop on 1m close above VWAP.

MacroCPIMean-revert
TSLAA Rejected 10:14 EST · safety engine

LLM proposed long 80 shares of "TSLAA" — symbol not in whitelist (likely hallucinated). Trade rejected before reaching the broker. Logged for model review. No capital exposure.

RejectedUnknown ticker
AAPL Long 30 +$176 09:48 EST · entry $228.40 · exit $234.27

Pre-market gap with no negative news matched the "gap-and-go" framework from class. Entry confirmed by 9:45 volume bar. Held for first profit target.

Gap & goOpening range
META Skipped 09:31 EST · confidence 0.54 < 0.62

Setup looked acceptable but model confidence under the threshold. Discipline rule: when in doubt, sit out. Logged so the learning loop can review whether the threshold needs adjustment.

Low confidenceSkipped
Pick Your Brain

LLM with RAG, or
a tighter ML model.

Option A · The Reasoning Trader

API-Based LLM + RAG

A hosted Claude or GPT model with a retrieval layer over your trading class, mentor notes, and historical journal. It reads the news, recalls the rule, writes the rationale, proposes the trade.

  • Trades like a disciplined human
  • Explains its reasoning in plain English
  • Easy to coach with new written material
  • Hallucinations are caught by the Python engine
  • Latency: ~1–3 seconds per decision
Best for: swing trades, news-driven setups, daily review
Option B · The Signal Engine

Pure ML Model

Classical machine learning — gradient boosted trees, LSTM, or a custom ensemble — trained on your historical signals and labels. No language, no narration. Pattern in, probability out.

  • Sub-millisecond inference
  • Deterministic and back-testable
  • Self-hosted, no LLM API costs
  • Easier to certify for regulated use
  • No prose explanations — pure numbers
Best for: intraday, scalping, latency-sensitive plays

// You can also run both — LLM for daily macro, ML for intraday execution. I've shipped that hybrid before.

Build Process

How I ship
a trading bot.

01

Strategy Capture

I sit with you, your class notes, and your existing playbook. Every rule becomes a testable spec.

02

Data & Backtest

Historical price + news data assembled. Strategy back-tested across multiple regimes before any live capital.

03

Paper Trading

Bot runs live but trades a simulated account for 2–4 weeks. Journal proves it follows the rules under real conditions.

04

Live Deploy

Capital allocated in stages. Safety caps tight at first, widened as the journal shows consistent behaviour.

05

Learn & Iterate

Nightly review loop tunes confidence weights. Monthly model retraining. New class material rolls in as RAG context.

Build it

Stop watching charts.
Run the strategy.

Tell us your edge — the setups, the rules, the discipline you trust. I'll engineer the engine that runs it 24/7 without flinching.

Start the Build