trump-code-market-signals by aradotso/trending-skills
npx skills add https://github.com/aradotso/trending-skills --skill trump-code-market-signals技能由 ara.so 提供 — Daily 2026 技能集。
Trump Code 是一个开源系统,它应用暴力计算来寻找特朗普在 Truth Social/X 上的发帖行为与标普 500 指数走势之间具有统计显著性的模式。该系统已测试了 3150 万种模型组合,保留了 551 条有效规则,并在 566 次预测中验证了 61.3% 的命中率(z=5.39,p<0.05)。
git clone https://github.com/sstklen/trump-code.git
cd trump-code
pip install -r requirements.txt
# AI 简报和聊天机器人所需
export GEMINI_KEYS="key1,key2,key3" # 逗号分隔的 Gemini API 密钥
# 可选:用于 Claude Opus 深度分析
export ANTHROPIC_API_KEY="your-key-here"
# 可选:用于 Polymarket/Kalshi 集成
export POLYMARKET_API_KEY="your-key-here"
# 从特朗普帖子中检测到的今日信号
python3 trump_code_cli.py signals
# 模型性能排行榜(全部 11 个命名模型)
python3 trump_code_cli.py models
# 获取 LONG/SHORT 共识预测
python3 trump_code_cli.py predict
# 预测市场套利机会
python3 trump_code_cli.py arbitrage
# 系统健康检查(断路器状态)
python3 trump_code_cli.py health
# 完整每日报告(三语)
python3 trump_code_cli.py report
# 将所有数据转储为 JSON
python3 trump_code_cli.py json
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
# 实时特朗普帖子监控器(每 5 分钟轮询一次)
python3 realtime_loop.py
# 暴力模型搜索(约 25 分钟,测试数百万种组合)
python3 overnight_search.py
# 个体分析
python3 analysis_06_market.py # 帖子与标普 500 相关性分析
python3 analysis_09_combo_score.py # 多信号组合评分
# 网页仪表板 + AI 聊天机器人,运行在端口 8888
export GEMINI_KEYS="key1,key2,key3"
python3 chatbot_server.py
# → http://localhost:8888
import requests
BASE = "https://trumpcode.washinmura.jp"
# 一次调用获取所有仪表板数据
data = requests.get(f"{BASE}/api/dashboard").json()
# 今日信号 + 7 天历史
signals = requests.get(f"{BASE}/api/signals").json()
# 模型性能排名
models = requests.get(f"{BASE}/api/models").json()
# 最新的 20 条特朗普帖子(带信号标签)
posts = requests.get(f"{BASE}/api/recent-posts").json()
# 实时的 Polymarket 特朗普预测市场(316+)
markets = requests.get(f"{BASE}/api/polymarket-trump").json()
# LONG/SHORT 策略手册
playbook = requests.get(f"{BASE}/api/playbook").json()
# 系统健康状态 / 断路器状态
status = requests.get(f"{BASE}/api/status").json()
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"])
添加到 ~/.claude/settings.json:
{
"mcpServers": {
"trump-code": {
"command": "python3",
"args": ["/path/to/trump-code/mcp_server.py"]
}
}
}
可用的 MCP 工具:signals, models, predict, arbitrage, health, events, dual_platform, crowd, full_report
所有数据位于 data/ 目录,每日更新:
import json, pathlib
DATA = pathlib.Path("data")
# 44,000+ 条 Truth Social 帖子
posts = json.loads((DATA / "trump_posts_all.json").read_text())
# 已预标记信号的帖子
posts_lite = json.loads((DATA / "trump_posts_lite.json").read_text())
# 566 条已验证的预测及其结果
predictions = json.loads((DATA / "predictions_log.json").read_text())
# 551 条活跃规则(暴力搜索 + 进化)
rules = json.loads((DATA / "surviving_rules.json").read_text())
# 384 个特征 × 414 个交易日
features = json.loads((DATA / "daily_features.json").read_text())
# 标普 500 OHLC 历史数据
market = json.loads((DATA / "market_SP500.json").read_text())
# 断路器 / 系统健康状态
cb = json.loads((DATA / "circuit_breaker_state.json").read_text())
# 规则进化日志(交叉/变异)
evo = json.loads((DATA / "evolution_log.json").read_text())
import requests
BASE = "https://trumpcode.washinmura.jp"
# 列出可用数据集
catalog = requests.get(f"{BASE}/api/data").json()
# 下载特定文件
raw = requests.get(f"{BASE}/api/data/surviving_rules.json").content
rules = json.loads(raw)
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", []))
import json
rules = json.loads(open("data/surviving_rules.json").read())
# 按命中率降序排序
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%}")
import requests
arb = requests.get("https://trumpcode.washinmura.jp/api/insights").json()
markets = requests.get("https://trumpcode.washinmura.jp/api/polymarket-trump").json()
# 按交易量排序的市场
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}")
import json
import numpy as np
features = json.loads(open("data/daily_features.json").read())
market = json.loads(open("data/market_SP500.json").read())
# 构建日期索引的回报率映射
returns = {d["date"]: d["close_pct"] for d in market}
# 示例:关联 post_count 与次日回报率
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}")
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}
# 找出美国东部时间上午 9:30 前出现 RELIEF 信号的日子
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%}")
| 信号 | 描述 | 典型影响 |
|---|---|---|
RELIEF 盘前 | 上午 9:30 前的"宽慰"类语言 | 当日平均 +1.12% |
TARIFF 交易时段 | 交易时间内提及关税 | 次日平均 -0.758% |
DEAL | 交易/协议类语言 | 52.2% 命中率 |
CHINA(仅 Truth Social) | 提及中国(X 上从不出现) | 1.5 倍权重提升 |
SILENCE | 零发帖日 | 80% 看涨,平均 +0.409% |
| 爆发 → 沉默 | 快速发帖后转为安静 | 65.3% LONG 信号 |
| 模型 | 策略 | 命中率 | 平均回报 |
|---|---|---|---|
| A3 | 盘前 RELIEF → 上涨 | 72.7% | +1.206% |
| D3 | 交易量激增 → 恐慌性底部 | 70.2% | +0.306% |
| D2 | 签名切换 → 正式声明 | 70.0% | +0.472% |
| C1 | 爆发 → 长时间沉默 → LONG | 65.3% | +0.145% |
| C3 ⚠️ | 深夜关税(反向指标) | 37.5% | −0.414% |
注意: C3 是一个反向指标 — 如果它触发,断路器会自动将其反转为 LONG(反转后准确率为 62%)。
Truth Social 帖子检测(每 5 分钟)
→ 信号分类(RELIEF / TARIFF / DEAL / CHINA / 等)
→ 双平台增强(仅 TS 的中国提及 = 1.5× 权重)
→ 快照 Polymarket + 标普 500
→ 运行 551 条有效规则 → 生成预测
→ 在 1h / 3h / 6h 跟踪
→ 验证结果 → 更新规则权重
→ 断路器:如果系统性能下降 → 暂停/反转
→ 每日:进化规则(交叉 / 变异 / 蒸馏)
→ 同步数据到 GitHub
realtime_loop.py 未检测到新帖子
data/trump_posts_all.json 的时间戳是否为最近python3 trump_code_cli.py health 查看断路器状态chatbot_server.py 启动失败
GEMINI_KEYS 环境变量:export GEMINI_KEYS="key1,key2"lsof -i :8888overnight_search.py 内存不足
命中率降至 55% 以下
data/circuit_breaker_state.json — 系统可能已自动暂停data/learning_report.json 了解被降级的规则overnight_search.py 以刷新有效规则data/ 目录中的数据陈旧
python3 trump_code_cli.py report 强制刷新git pull origin main每周安装数
246
代码仓库
GitHub 星标数
10
首次出现
6 天前
安全审计
安装于
github-copilot245
codex245
amp245
cline245
kimi-cli245
gemini-cli245
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).
git clone https://github.com/sstklen/trump-code.git
cd trump-code
pip install -r requirements.txt
# 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"
# 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
# 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
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()
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"])
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
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())
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)
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", []))
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%}")
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}")
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}")
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%}")
| 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 |
| 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).
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
realtime_loop.py not detecting new posts
data/trump_posts_all.json timestamp is recentpython3 trump_code_cli.py health to see circuit breaker statechatbot_server.py fails to start
GEMINI_KEYS env var is set: export GEMINI_KEYS="key1,key2"lsof -i :8888overnight_search.py runs out of memory
Hit rate dropping below 55%
data/circuit_breaker_state.json — system may have auto-pauseddata/learning_report.json for demoted rulesovernight_search.py to refresh surviving rulesStale data indata/ directory
python3 trump_code_cli.py report to force refreshgit pull origin mainWeekly Installs
246
Repository
GitHub Stars
10
First Seen
6 days ago
Security Audits
Gen Agent Trust HubFailSocketPassSnykWarn
Installed on
github-copilot245
codex245
amp245
cline245
kimi-cli245
gemini-cli245
Python PDF处理教程:合并拆分、提取文本表格、创建PDF文件
55,400 周安装
Bun运行时使用指南:快速JavaScript/TypeScript开发工具链与Node.js迁移教程
684 周安装
HR自动化工作流模板:基于n8n的招聘、入职、绩效与离职流程自动化解决方案
411 周安装
招聘流程管理插件 | 全流程自动化招聘工具,集成ATS系统,提升招聘效率
436 周安装
线索信息丰富化工具 - 将标识符转化为完整联系人档案 | Apollo数据集成
438 周安装
AI YouTube脚本撰写专家 | 一键生成高留存率视频脚本 | 支持多种风格与格式
349 周安装
ts-agent-sdk:为AI代理生成类型化TypeScript SDK,简化MCP服务器交互
317 周安装
| 80% bullish, avg +0.409% |
| Burst → silence | Rapid posting then goes quiet | 65.3% LONG signal |