trump-code: brute-forcing 31.5M rule combinations between Truth Social posts and the S&P 500
🔐 AI decoding Trump's posts × stock market | AI 解碼川普推文 × 美股 | AIでトランプ投稿×株式市場を解読 — 31.5M models, 61.3% hit rate, open source
At a glance
- What is it?
- The repository claims 551 surviving rules and a 61.3% hit rate across 566 verified predictions. The interesting part is not the number, it is the train/test filter, the circuit breaker, and how much of the pipeline depends on live model calls.
- Who is it for?
- Adopt it if you want a worked example of a self-verifying rule-mining loop with an open data directory, and you are willing to read Python before trusting any number on the dashboard. Skip it if you need a signal you can trade against without checking the code, because the README's own leaderboard shows a model at 37.5% being used as an inverted indicator, and the 61.3% headline is an aggregate that hides per-model spread from 72.7% down to 45%.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 1 day ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on September 15, 2026, and from our analysis. They are not legal advice.
DEEP OPEN-SOURCE ANALYSIS
The problem trump-code is actually trying to solve
Most retail signal projects start from a hypothesis and then look for data that fits it. This one inverts the order. The README describes a brute-force search over 31.5 million model combinations, with 551 rules surviving train/test validation. That is a search problem, not a theory problem. The target user is someone who wants to see the entire space of simple post-derived conditions enumerated and filtered, rather than reading a blog post about why tariff tweets matter. The repository ships a live dashboard at trumpcode.washinmura.jp, a daily analysis page, a chatbot, an API, a CLI and an MCP interface, so the intended audience spans people who just want to read the output and people who want to wire the output into their own tooling. The scope is narrow on purpose: Truth Social posts, X posts, the S&P 500, and Polymarket or Kalshi markets. Nothing else. If you want a general news-to-price engine, this is not it.
What the brute-force search produces, and what survives
The README gives a leaderboard of 11 named strategy models, each with a hit rate, an average return and a trade count. A3, pre-market RELIEF leading to a same-day surge, shows 72.7% across 11 trades. C1, burst posting followed by long silence, shows 65.3% across 176 trades. C3, late-night tariff as a gap-open signal, shows 37.5% across 8 trades and is labelled an anti-indicator, meaning the system inverts it. That last row is the most informative thing on the page. A rule that is wrong 62.5% of the time is still useful if you know the sign, and the project keeps it rather than discarding it. The trade counts matter more than the percentages. Eleven trades at 72.7% is a small sample, and the README does not present confidence intervals per model. The aggregate claim of 61.3% across 566 verified predictions comes with z=5.39 and p<0.05, which is stated for the pooled set, not for each row.
The pipeline: detect, classify, snapshot, verify, evolve
According to the architecture diagram, posts are detected every 5 minutes. The real-time engine classifies signals, applies a dual-platform boost, checks for known event patterns, snapshots Polymarket and the S&P 500, emits a prediction, then tracks it at 1h, 3h and 6h before verifying. A separate daily pipeline runs 11 steps: fetch, analyze, run the 551 rules, predict, verify, circuit breaker, prediction-market check, learn (promote, demote, eliminate), evolve (crossover, mutation, distill), AI briefing, sync to GitHub. Three components are named: Opus for causal analysis, an Evolver that breeds new rules from survivors, and a Circuit Breaker that stops the system if it degrades. The learning loop is the design decision worth noting. Rules are not fixed at publication time; they get promoted, demoted or eliminated on a daily cadence, so the rule set you clone today is not the rule set running next month. The circuit breaker is the safety valve, though the README does not state the threshold at which it triggers.
Getting it running: what the repository actually gives you
The README does not include an install section, a requirements file listing, or a quickstart command. What it does give is a data directory with surviving_rules.json and predictions_log.json, both linked from the badge row, plus a LICENSE file and a live dashboard. The daily pipeline is described as an 11-step sequence but the individual commands are not printed in the material available here. That is a real gap for anyone trying to reproduce the 61.3% figure locally. The practical path is to clone the repository, read the Python entry points that implement the daily pipeline, and check whether the Opus and Evolver steps require API credentials before you assume a local run will work end to end. The output surfaces listed (dashboard, chatbot, API, CLI, MCP) suggest the CLI is the intended local entry point, but the exact invocation is not in the README text supplied. Treat any setup instructions you find in the repo as the source of truth over this article.
Where the design breaks down
The dual-platform section states that China-related posts appear 203 times on Truth Social and zero times on X, and that Truth Social publishes 6.2 hours before X across 38 of 39 matched posts. That 6.2-hour lead is presented as an arbitrage window, but it is also a dependency: if the detection loop runs every 5 minutes and the edge is a 6-hour head start on a subset of posts, the value of the signal decays with every hour of pipeline latency. A second limitation is the anti-indicator logic. Auto-inverting a rule that is wrong 62% of the time assumes the relationship is stable, and the README's own learn step (promote, demote, eliminate) implies the project does not assume that either. Third, the leaderboard mixes sample sizes from 8 trades to 176 trades in one ranking. A model at 57.9% over 19 trades and a model at 65.3% over 176 trades are not comparable evidence. The repository does not appear to weight them differently in the presentation. Finally, the whole system depends on continued access to Truth Social and X post streams plus market data; the README does not describe fallback behaviour when a source is unavailable.
How this differs from a standard sentiment pipeline
A conventional approach would train a classifier on post text, score sentiment, and regress next-day returns on that score. The result is a continuous number with no named conditions and no audit trail. trump-code does the opposite: it enumerates discrete conditions (pre-market relief, tariff during market hours, three-day tariff streak, signature switch) and keeps only those that pass train/test. That makes every prediction explainable in one sentence, which is the main advantage. The cost is coverage. A rule-based system only fires when its conditions are met, so the 566 verified predictions over the project's lifetime is a small number relative to the volume of posts, and the README's own note that zero-post days are 80% bullish shows how much of the signal lives outside the rule set. If you need continuous exposure to post sentiment, a simple text classifier will fire far more often. If you need to know why a signal fired, this design is easier to defend.
Licence, maintenance and the cost of keeping it alive
The project is MIT licensed, which permits commercial use and modification provided the copyright notice and permission notice are retained. That is the standard permissive position; the repository's LICENSE file governs, and nothing here is legal advice. Maintenance cost is the more interesting question. The daily pipeline runs 11 steps including AI briefing and an Evolver stage, and the README names Opus as one of the three brains. Those stages imply recurring model API spend, and the README's own donation link is labelled Buy Me a Claude Max, which suggests the author is funding inference out of pocket. The repository was last pushed on 2026-09-09 and the most recent release listed is v2.8.0 from 2026-03-21, so the release cadence and the commit cadence are not the same thing. Anyone forking this should budget for API credits and for the work of keeping the Truth Social and X ingestion paths alive, because those are the parts most likely to break without warning.
Editorial conclusion
Adopt it if you want a worked example of a self-verifying rule-mining loop with an open data directory, and you are willing to read Python before trusting any number on the dashboard. Skip it if you need a signal you can trade against without checking the code, because the README's own leaderboard shows a model at 37.5% being used as an inverted indicator, and the 61.3% headline is an aggregate that hides per-model spread from 72.7% down to 45%. Verify first: open data/surviving_rules.json and data/predictions_log.json, confirm the 566 logged predictions match the 551 rules, and check whether the daily pipeline's Opus and Evolver steps need paid API access you do not have.
Community notes