
trump-code-market-signals
AI-powered analysis of Trump's social media posts to predict stock market movements using 31.5M brute-force tested rules
- Installs
- 1.3K
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/reason-machines/trending-skills --skill trump-code-market-signals- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads trump-code-market-signals automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Trump Code — Market Signal Analysis
Skill by ara.so — Daily 2026 Skills collection.
Trump Code is an open-source system that applies brute-force computation to find statistically significant patterns between Trump's Truth Social/X posting behavior and S&P 500 movements. It has tested 31.5M model combinations, maintains 551 surviving rules, and has a verified 61.3% hit rate across 566 predictions (z=5.39, p<0.05).
Installation
git clone https://github.com/sstklen/trump-code.git
cd trump-code
pip install -r requirements.txt
Environment Variables
# Required for AI briefing and chatbot
export GEMINI_KEYS="key1,key2,key3" # Comma-separated Gemini API keys
# Optional: for Claude Opus deep analysis
export ANTHROPIC_API_KEY="your-key-here"
# Optional: for Polymarket/Kalshi integration
export POLYMARKET_API_KEY="your-key-here"
CLI — Key Commands
# Today's detected signals from Trump's posts
python3 trump_code_cli.py signals
# Model performance leaderboard (all 11 named models)
python3 trump_code_cli.py models
# Get LONG/SHORT consensus prediction
python3 trump_code_cli.py predict
# Prediction market arbitrage opportunities
python3 trump_code_cli.py arbitrage
# System health check (circuit breaker state)
python3 trump_code_cli.py health
# Full daily report (trilingual)
python3 trump_code_cli.py report
# Dump all data as JSON
python3 trump_code_cli.py json
Core Scripts
# Real-time Trump post monitor (polls every 5 min)
python3 realtime_loop.py
# Brute-force model search (~25 min, tests millions of combos)
python3 overnight_search.py
# Individual analyses
python3 analysis_06_market.py # Posts vs S&P 500 correlation
python3 analysis_09_combo_score.py # Multi-signal combo scoring
# Web dashboard + AI chatbot on port 8888
export GEMINI_KEYS="key1,key2,key3"
python3 chatbot_server.py
# → http://localhost:8888
REST API (Live at trumpcode.washinmura.jp)
import requests
BASE = "https://trumpcode.washinmura.jp"
# All dashboard data in one call
data = requests.get(f"{BASE}/api/dashboard").json()
# Today's signals + 7-day history
signals = requests.get(f"{BASE}/api/signals").json()
# Model performance rankings
models = requests.get(f"{BASE}/api/models").json()
# Latest 20 Trump posts with signal tags
posts = requests.get(f"{BASE}/api/recent-posts").json()
# Live Polymarket Trump prediction markets (316+)
markets = requests.get(f"{BASE}/api/polymarket-trump").json()
# LONG/SHORT playbooks
playbook = requests.get(f"{BASE}/api/playbook").json()
# System health / circuit breaker state
status = requests.get(f"{BASE}/api/status").json()
AI Chatbot API
import requests
response = requests.post(
"https://trumpcode.washinmura.jp/api/chat",
json={"message": "What signals fired today and what's the consensus?"}
)
print(response.json()["reply"])
MCP Server (Claude Code / Cursor Integration)
Add to ~/.claude/settings.json:
{
"mcpServers": {
"trump-code": {
"command": "python3",
"args": ["/path/to/trump-code/mcp_server.py"]
}
}
}
Available MCP tools: signals, models, predict, arbitrage, health, events, dual_platform, crowd, full_report
Open Data Files
All data lives in data/ and is updated daily:
import json, pathlib
DATA = pathlib.Path("data")
# 44,000+ Truth Social posts
posts = json.loads((DATA / "trump_posts_all.json").read_text())
# Posts with signals pre-tagged
posts_lite = json.loads((DATA / "trump_posts_lite.json").read_text())
# 566 verified predictions with outcomes
predictions = json.loads((DATA / "predictions_log.json").read_text())
# 551 active rules (brute-force + evolved)
rules = json.loads((DATA / "surviving_rules.json").read_text())
# 384 features × 414 trading days
features = json.loads((DATA / "daily_features.json").read_text())
# S&P 500 OHLC history
market = json.loads((DATA / "market_SP500.json").read_text())
# Circuit breaker / system health
cb = json.loads((DATA / "circuit_breaker_state.json").read_text())
# Rule evolution log (crossover/mutation)
evo = json.loads((DATA / "evolution_log.json").read_text())
Download Data via API
import requests
BASE = "https://trumpcode.washinmura.jp"
# List available datasets
catalog = requests.get(f"{BASE}/api/data").json()
# Download a specific file
raw = requests.get(f"{BASE}/api/data/surviving_rules.json").content
rules = json.loads(raw)
Real Code Examples
Parse Today's Signals
import requests
signals_data = requests.get("https://trumpcode.washinmura.jp/api/signals").json()
today = signals_data.get("today", {})
print("Signals fired today:", today.get("signals", []))
print("Consensus:", today.get("consensus")) # "LONG" / "SHORT" / "NEUTRAL"
print("Confidence:", today.get("confidence")) # 0.0–1.0
print("Active models:", today.get("active_models", []))
Find Top Performing Rules from Surviving Rules
import json
rules = json.loads(open("data/surviving_rules.json").read())
# Sort by hit rate descending
top_rules = sorted(rules, key=lambda r: r.get("hit_rate", 0), reverse=True)
for rule in top_rules[:10]:
print(f"Rule: {rule['id']} | Hit Rate: {rule['hit_rate']:.1%} | "
f"Trades: {rule['n_trades']} | Avg Return: {rule['avg_return']:.3%}")
Check Prediction Market Opportunities
import requests
arb = requests.get("https://trumpcode.washinmura.jp/api/insights").json()
markets = requests.get("https://trumpcode.washinmura.jp/api/polymarket-trump").json()
# Markets sorted by volume
active = [m for m in markets.get("markets", []) if m.get("active")]
by_volume = sorted(active, key=lambda m: m.get("volume", 0), reverse=True)
for m in by_volume[:5]:
print(f"{m['title']}: YES={m['yes_price']:.0%} | Vol=${m['volume']:,.0f}")
Correlate Post Features with Returns
import json
import numpy as np
features = json.loads(open("data/daily_features.json").read())
market = json.loads(open("data/market_SP500.json").read())
# Build date-indexed return map
returns = {d["date"]: d["close_pct"] for d in market}
# Example: correlate post_count with next-day return
xs, ys = [], []
for day in features:
date = day["date"]
if date in returns:
xs.append(day.get("post_count", 0))
ys.append(returns[date])
correlation = np.corrcoef(xs, ys)[0, 1]
print(f"Post count vs same-day return: r={correlation:.3f}")
Run a Backtest on a Custom Signal
import json
posts = json.loads(open("data/trump_posts_lite.json").read())
market = json.loads(open("data/market_SP500.json").read())
returns = {d["date"]: d["close_pct"] for d in market}
# Find days with RELIEF signal before 9:30 AM ET
relief_days = [
p["date"] for p in posts
if "RELIEF" in p.get("signals", []) and p.get("hour", 24) < 9
]
hits = [returns[d] for d in relief_days if d in returns]
if hits:
print(f"RELIEF pre-market: n={len(hits)}, "
f"avg={sum(hits)/len(hits):.3%}, "
f"hit_rate={sum(1 for h in hits if h > 0)/len(hits):.1%}")
Key Signal Types
| Signal | Description | Typical Impact |
|---|---|---|
RELIEF pre-market | "Relief" language before 9:30 AM | Avg +1.12% same-day |
TARIFF market hours | Tariff mention during trading | Avg -0.758% next day |
DEAL | Deal/agreement language | 52.2% hit rate |
CHINA (Truth Social only) | China mentions (never on X) | 1.5× weight boost |
SILENCE | Zero-post day | 80% bullish, avg +0.409% |
| Burst → silence | Rapid posting then goes quiet | 65.3% LONG signal |
Model Reference
| Model | Strategy | Hit Rate | Avg Return |
|---|---|---|---|
| A3 | Pre-market RELIEF → surge | 72.7% | +1.206% |
| D3 | Volume spike → panic bottom | 70.2% | +0.306% |
| D2 | Signature switch → formal statement | 70.0% | +0.472% |
| C1 | Burst → long silence → LONG | 65.3% | +0.145% |
| C3 ⚠️ | Late-night tariff (anti-indicator) | 37.5% | −0.414% |
Note: C3 is an anti-indicator — if it fires, the circuit breaker auto-inverts it to LONG (62% accuracy after inversion).
System Architecture Flow
Truth Social post detected (every 5 min)
→ Classify signals (RELIEF / TARIFF / DEAL / CHINA / etc.)
→ Dual-platform boost (TS-only China = 1.5× weight)
→ Snapshot Polymarket + S&P 500
→ Run 551 surviving rules → generate prediction
→ Track at 1h / 3h / 6h
→ Verify outcome → update rule weights
→ Circuit breaker: if system degrades → pause/invert
→ Daily: evolve rules (crossover / mutation / distillation)
→ Sync data to GitHub
Troubleshooting
realtime_loop.py not detecting new posts
- Check your network access to Truth Social scraper endpoints
- Verify
data/trump_posts_all.jsontimestamp is recent - Run
python3 trump_code_cli.py healthto see circuit breaker state
chatbot_server.py fails to start
- Ensure
GEMINI_KEYSenv var is set:export GEMINI_KEYS="key1,key2" - Port 8888 may be in use:
lsof -i :8888
overnight_search.py runs out of memory
- Runs ~31.5M combinations — needs ~4GB RAM
- Run on a machine with 8GB+ or reduce search space in script config
Hit rate dropping below 55%
- Check
data/circuit_breaker_state.json— system may have auto-paused - Review
data/learning_report.jsonfor demoted rules - Re-run
overnight_search.pyto refresh surviving rules
Stale data in data/ directory
- Daily pipeline syncs to GitHub automatically if running
- Manually trigger:
python3 trump_code_cli.py reportto force refresh - Or pull latest from remote:
git pull origin main
FAQ
What does the trump-code-market-signals skill do?
AI-powered analysis of Trump's social media posts to predict stock market movements using 31.5M brute-force tested rules
How do I install trump-code-market-signals?
Run npx skills add https://github.com/reason-machines/trending-skills --skill trump-code-market-signals in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/trump-code-market-signals/ (personal) or .claude/skills/trump-code-market-signals/ (project).
Which AI agents can use trump-code-market-signals?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is trump-code-market-signals safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains trump-code-market-signals?
It is published by reason-machines in reason-machines/trending-skills. It has 1,301 recorded installs.
More from reason-machines/trending-skills
openclaw-control-center
reason-machines/trending-skills
Local-first, security-first control center for OpenClaw agents — visibility dashboard with readonly defaults, token attribution, collaboration tracing, and safe write operations.
inkos-multi-agent-novel-writing
reason-machines/trending-skills
Multi-agent CLI system for autonomous novel writing, auditing, and revision with human review gates
claude-hud-statusline
reason-machines/trending-skills
A Claude Code plugin that displays a real-time HUD showing context usage, active tools, running agents, and todo progress in your terminal statusline.
understand-anything-knowledge-graph
reason-machines/trending-skills
Turn any codebase into an interactive knowledge graph using Claude Code skills — explore, search, and ask questions about any project visually.
agency-agents-ai-specialists
reason-machines/trending-skills
A collection of specialized AI agent personalities for Claude Code, Cursor, Aider, Windsurf, and other AI coding tools — covering engineering, design, marketing, sales, and more.
agent-browser-automation
reason-machines/trending-skills
Headless browser automation CLI for AI agents using native Rust binary with Chrome DevTools Protocol
Popular marketing & seo skills
reddit-automation
flowkit-labs/skills
Find Reddit threads where people are genuinely asking for what you offer, then draft short, genuinely helpful replies — disclosing your affiliation honestly and naming your product only when it truly answers the question. Two moves: discovery — scan the right subreddits for real needs (recommendation asks, expressed pain, competitor mentions) and rank the few threads where you can actually help; drafting — write from real experience, respect each community's self-promo rules, and keep a human in the loop to review and post. This markets on Reddit the honest way: contribute value, disclose who you are, never astroturf. Distilled from the playbook behind doany.ai's Reddit agent. Triggers on "find reddit opportunities", "reddit marketing", "reddit automation", "reply on reddit for my product", "reddit community engagement", "reddit lead gen", or any ask to turn Reddit threads into genuine, disclosed marketing replies.
twitter-automation
101-skills/superpowers
Automate Twitter/X with posting, engagement, and user management via inference.sh CLI. Apps: x/post-tweet, x/post-create (with media), x/post-like, x/post-retweet, x/dm-send, x/user-follow. Capabilities: post tweets, schedule content, like posts, retweet, send DMs, follow users, get profiles. Use for: social media automation, content scheduling, engagement bots, audience growth, X API. Triggers: twitter api, x api, tweet automation, post to twitter, twitter bot, social media automation, x automation, tweet scheduler, twitter integration, post tweet, twitter post, x post, send tweet
twitter-automation
magentosh/superpowers
Automate Twitter/X with posting, engagement, and user management via inference.sh CLI. Apps: x/post-tweet, x/post-create (with media), x/post-like, x/post-retweet, x/dm-send, x/user-follow. Capabilities: post tweets, schedule content, like posts, retweet, send DMs, follow users, get profiles. Use for: social media automation, content scheduling, engagement bots, audience growth, X API. Triggers: twitter api, x api, tweet automation, post to twitter, twitter bot, social media automation, x automation, tweet scheduler, twitter integration, post tweet, twitter post, x post, send tweet
twitter-automation
qu-skills/superpowers
Automate Twitter/X with posting, engagement, and user management via inference.sh CLI. Apps: x/post-tweet, x/post-create (with media), x/post-like, x/post-retweet, x/dm-send, x/user-follow. Capabilities: post tweets, schedule content, like posts, retweet, send DMs, follow users, get profiles. Use for: social media automation, content scheduling, engagement bots, audience growth, X API. Triggers: twitter api, x api, tweet automation, post to twitter, twitter bot, social media automation, x automation, tweet scheduler, twitter integration, post tweet, twitter post, x post, send tweet
product-launch-video
heygen-com/hyperframes
Turn a product or marketing URL, pasted script, or brief into a product launch / promo video — SaaS promos, feature reveals, product demos, app and company launches. Use when the user wants to market, launch, promote, or reveal a product; the default for any commercial URL. Site tours / showcases of a website route here too — the brief carries the show-it-as-is intent. Unclear → /hyperframes.
twitter-automation
skills-shell/superpowers
Automate Twitter/X with posting, engagement, and user management via inference.sh CLI. Apps: x/post-tweet, x/post-create (with media), x/post-like, x/post-retweet, x/dm-send, x/user-follow. Capabilities: post tweets, schedule content, like posts, retweet, send DMs, follow users, get profiles. Use for: social media automation, content scheduling, engagement bots, audience growth, X API. Triggers: twitter api, x api, tweet automation, post to twitter, twitter bot, social media automation, x automation, tweet scheduler, twitter integration, post tweet, twitter post, x post, send tweet