Geopolitical trading bot — how it works

A bot that reads the world
and trades on it.

An automated system that watches global events 24/7, scores their market impact, and executes trades — faster than any human could react.

World events move markets.
Most people react too slowly.

When a conflict escalates, a sanction is announced, or a tariff tweet drops, the prices of oil, defense stocks, gold, and currencies shift — sometimes within seconds. Human traders can't process the information and place orders fast enough to capture that move.

This bot can. It watches dozens of news sources and data streams simultaneously, converts that information into a confidence score, and executes a trade in milliseconds — before most of the market has finished reading the headline.

A simple analogy: Imagine hiring an analyst who reads every newspaper in the world simultaneously, never sleeps, never panics, and can place a trade before you've finished your morning coffee. That's what this bot does — but with risk controls so it doesn't bet the farm on a single headline.
Engine 1

Geopolitical event trading

Reads news, scores signals, buys or sells ETFs and stocks directly when a high-confidence event is detected.

Engine 2

Volatility arbitrage

Trades options contracts to exploit mispricings in fear itself — when markets overreact or lag behind reality.

Both engines run simultaneously. Both feed into the same safety and execution layer. Both have their results logged and fed to an AI that improves the system over time.

Six independent sources,
one composite score.

The bot doesn't trade on a single headline. Every 15 minutes, it pulls from six independent data streams and combines them into a single confidence score between −1 (very bearish) and +1 (very bullish) for each instrument.

Polymarket
35%
A prediction market where real people wager real money on geopolitical outcomes. Real stakes mean real conviction — it's the wisdom of the crowd, financially weighted.
News sentiment
20%
AI reads headlines and scores their emotional tone: panic vs. calm vs. bullish. Detects the overall mood of the news cycle, not just individual stories.
RSS feeds
15%
44 live news feeds — Reuters, defense news, energy publications, geopolitical analysts. Refreshed every 2 minutes for near-real-time coverage.
Momentum
10%
Is the price already moving in the predicted direction? Confirms or counters the other signals — the bot won't fight a strong trend.
Government data
5%
Policy and regulatory signals. Lowest weight currently — being expanded over time as more data sources are integrated.
Why these weights? The starting values — Polymarket at 35%, OPRA at 15% — are informed estimates, not proven facts. Polymarket is weighted highest because real money bets tend to be the most accurate predictor. OPRA is conservatively weighted at 15% because its implied volatility history is still being established; the signal needs weeks of data before it's fully reliable. These weights are not fixed. The self-improving AI (explained below) monitors which signals actually predict profitable trades, and adjusts the weights over time. If OPRA proves more predictive, its weight grows automatically.

From headline to trade
in seconds.

When the six signals agree that something significant is happening, the bot evaluates which assets are most likely to move — and in which direction.

01
Signals scored
All 6 sources run every 15 min
02
Corroboration
Multiple sources must agree
03
Risk check
All safety limits verified
04
Trade arbiter
Final approval — size & direction
05
IBKR order
Sent to broker, filled live
06
Monitor + exit
Close at profit target or stop-loss
The corroboration filter is one of the most important gates. No single source — no matter how strong — can trigger a trade on its own. At least two independent signal sources must agree before the pipeline proceeds. This eliminates the vast majority of false positives.

The instruments traded in Engine 1 are chosen because they have predictable, logical connections to world events:

Profiting from fear mispricings
using options.

What's an option? An option is a contract giving you the right — but not obligation — to buy or sell an asset at a fixed price within a set time. You pay a small premium upfront. When markets are fearful, options become very expensive (everyone wants insurance). When calm returns, that premium decays. Engine 2 exploits the gap between how scared the market is versus how scared it should be.

Oil vol dispersion — "crude is panicking, energy stocks haven't noticed yet"

USOXLEXOPOVX

When a Middle East headline hits, the price of fear (implied volatility) on crude oil spikes immediately. But options on individual energy company stocks often lag behind by minutes or hours — the market hasn't caught up yet.

The trade: The bot detects when crude oil fear is ≥20% higher than energy equity fear. It sells the overpriced crude options and buys the underpriced energy stock options — betting the gap closes within 48 hours. The profit is that convergence.

EM panic harvesting — "selling fear insurance on a temporary scare"

EWWEPOLMXNPLN

When geopolitical news hits, institutional investors panic-buy Put options on emerging market ETFs (Mexico, Poland funds). This makes those options wildly expensive — far beyond the actual risk the event represents.

The trade: The bot uses its geopolitical signal scoring to identify "temporary shocks" — a non-binding vote, a tweet that won't become policy. It sells the overpriced Put options, collecting the inflated premium. As fear subsides within 24–48 hours, those options decay in value and the bot keeps the difference.

Safe haven skew — "gold and the yen should move together, but they're not"

GLDFXY

In a crisis, investors normally flee to both Gold and the Japanese Yen — both are "safety assets." Right now, Gold options are skewing heavily toward Calls (people expect surges) but Yen options aren't moving the same way. That's an inconsistency the market will correct.

The trade: The bot structures a ratio spread — a combination of options that profits if markets stay volatile but don't actually collapse. It essentially bets that the market is overpaying for end-of-world insurance, and collects that overpayment as the options expire.

A bot that gives itself
a performance review.

Most trading bots are static — you set parameters once and they never change. This one has a feedback loop built in. Every signal score, every trade decision, and every outcome is logged to disk. Periodically, all of that data is sent to Claude (via the Anthropic API), which analyzes what's working and recommends changes.

01
Bot trades live
Both engines run. Every decision logged with full context.
02
Everything recorded
Signals, decisions, approvals, rejections, fills, P&L — all to .jsonl log files.
03
Claude analyzes
Anthropic API reviews the performance logs and identifies what's actually working.
04
Parameters updated
Signal weights, profit targets, thresholds — rewritten in config.py. Bot improves.
This is why signal weights shift over time. The 35% for Polymarket and 15% for OPRA are starting points based on informed judgment — not proven performance. As the bot accumulates real trade data, Claude will identify which signals are most reliably predicting profitable outcomes and automatically rebalance the weights. If OPRA proves more predictive than Polymarket for defense stocks, its weight grows. The bot gets smarter with every trade it makes.

It says no far more
than it says yes.

The majority of signal cycles result in no trade at all. Multiple hard gates must be passed before any money moves — and several automatic stops will halt all trading if thresholds are breached.

Hard stop

Daily loss limit

If the account loses beyond a set threshold in a single day, all trading freezes until the next session.

Hard stop

Max open positions

A fixed limit on how many trades can be open simultaneously. No overloading the portfolio with correlated bets.

Hard stop

Drawdown limit

If the account drops more than a set percentage from its peak, all trading halts immediately.

Automatic scaling

VIX-adjusted sizing

When markets are extremely volatile (VIX ≥ 30), position sizes are automatically reduced. More fear = smaller bets.

Automatic scaling

0.5% profit target

The bot aims for small, consistent gains — not moonshots. Once the target is reached, it exits cleanly.

Live monitoring

Telegram alerts

Every trade, signal cycle, and error sends a real-time message to a phone. Nothing happens silently.

Currently running in paper mode — all trades execute against a simulated account via Interactive Brokers' paper trading environment. Real market data, real signals, real decisions — but no actual money at risk until the system is validated.

What it looks like
when it's actually running.

A local web dashboard refreshes every 30 seconds, showing the full system state in real time — signals, positions, risk status, and recent trade decisions. Here's what a typical session looks like:

Dashboard preview ⚠ Sample data — illustrative only
Geopolitical Trading Bot — Dashboard ● LIVE · Paper Mode · Last refresh 09:47:32
IBKR ● Connected VIX 28.4 NAV CA$1,024.18 Daily P&L +$24.18 (+2.4%) Positions 2 / 5 Halt OFF Telegram ● Active
Signal scores — current cycle
Symbol PM Sent RSS OPRA Mom Score
LMT +0.72 +0.58 +0.64 +0.81 +0.44 +0.68 ▲
USO +0.61 +0.49 +0.55 +0.38 +0.52 +0.54 ▲
GLD +0.55 +0.41 +0.22 +0.19 +0.31 +0.38 →
NVDA +0.12 −0.08 +0.05 −0.14 +0.18 +0.04 —
RTX +0.66 +0.51 +0.60 +0.74 +0.29 +0.61 ▲
TSM −0.31 −0.11 −0.28 −0.42 −0.35 −0.30 ▼
Open positions (2/5)
LMT LONG
Entry $448.20 · 2 shares · 09:31
+$14.60
+1.63%
RTX LONG
Entry $131.55 · 7 shares · 09:33
+$9.31
+1.01%
Vol strategy engine
Oil dispersion (USO vs XLE) Monitoring · IV gap 11%
EM panic harvest (EWW) Watching · no trigger
Safe haven skew (GLD/FXY) ● Active · spread open
Recent trade decisions
Time Symbol Signal Direction Outcome Note
09:46 LMT PM+OPRA+RSS LONG APPROVED Score +0.68, filled $448.20
09:44 GLD PM+Sent LONG REJECTED tier1_insufficient (RSS missing)
09:33 RTX PM+OPRA+Sent LONG APPROVED Score +0.61, filled $131.55
09:31 TSM OPRA+Mom SHORT REJECTED corroboration_fail (PM neutral)
09:18 USO PM+RSS+Sent LONG APPROVED Score +0.54, filled $72.84 — exited +0.52%
Signal cycle: every 15 min · RSS refresh: every 2 min · Optimizer: weekly Next cycle in 08:14

The dashboard auto-refreshes every 30 seconds. Green scores indicate bullish signals, red bearish. The "REJECTED" entries show the corroboration filter doing its job — GLD and TSM were blocked because not enough independent sources agreed. Only trades with multi-source agreement get through.

Historical geopolitical events database
Sample of 25 events — the full database references over 711 significant historical market moves for regime classification and signal calibration.
View database →

Live trading vs. parallel theories — side by side.

The bot doesn't just run one strategy. The trading floor lets you run the live account alongside multiple paper configurations simultaneously — each with different signal weights, thresholds, or strategies. Watch them compete in real time. Promote the winner.

Why this matters: Instead of changing live settings and hoping for the best, you A/B test strategies in paper mode against identical real market data. When a paper config consistently outperforms live over 30+ trades, you promote it with one click. The bot earns its own upgrades.
Trading Floor · 3 panes active + Add Pane
● LIVE Real capital
CA$1,002,418
+$2,418 today (+0.24%)
SIGNAL WEIGHTS
Polymarket35%
Sentiment20%
OPRA15%
Analog15%
OPEN POSITIONS (2)
LMT LONG +1.63%
USO LONG +0.88%
◎ PAPER Aggressive ⚙
CA$1,008,841
+$8,841 today (+0.88%) ▲
SIGNAL WEIGHTS
Polymarket50%
Sentiment15%
OPRA25%
Analog10%
OPEN POSITIONS (4)
LMT LONG +1.63%
GLD LONG +2.11%
RTX LONG +0.94%
▲ Outperforming live — Promote?
◎ PAPER Analog-heavy ⚙
CA$999,122
-$878 today (-0.09%) ▼
SIGNAL WEIGHTS
Polymarket25%
Sentiment15%
OPRA20%
Analog40%
OPEN POSITIONS (1)
GLD LONG +2.11%
Underperforming — watching
All panes run against identical live market data · Paper panes use simulated fills Next cycle in 04:32

Each pane has independently configurable signal weights. The "Aggressive" config above is outperforming live today — after 30+ trades with consistent outperformance, it can be promoted to live with one click. The "Analog-heavy" config is underperforming, so it stays in paper mode until proven.

AI deliberation arena

AIs that argue before they act.

The AI Arena doesn't vote — it deliberates. AI 1 writes a hypothesis. AI 2 critiques it. Each round builds on the last until consensus reaches 95% or no trade is taken. Every reasoning chain is logged.

AI ARENA · USO · LONG hypothesis · Consensus: 0.97 ✓ TRADE APPROVED
ROUND 1 — CLAUDE SONNET · Hypothesis
USO LONG. Hormuz closure = supply shock. Polymarket 34% ceasefire (bearish reversal). OPRA put/call 8:1. Confidence: 0.72
ROUND 2 — GPT-4O · Critique
Agree on direction. IVR at 50 lags — supply shock not priced yet. Historical analog: Hormuz closures → USO +12% median over 10d. Elevating to 0.81
ROUND 3 — GEMINI 1.5 PRO · Synthesis
RSI divergence suggests pullback before continuation — recommend scaled entry. Running consensus: 0.94
ROUND 4 — GROK 2 · Final check · CONSENSUS REACHED
RED_2 regime: USO historical median +8.3% over 10 days. Consensus: 0.97 ✓ → TRADE APPROVED

The 95% consensus threshold means most signals never become trades — only those where multiple AIs genuinely agree after seeing each other's full reasoning. Every approved trade has a complete audit trail explaining exactly why it was taken.

The bot expands its own
awareness over time.

Right now the bot's thematic coverage is focused on its strongest areas: Middle East energy tensions, defense spending, US-China chip wars, and POTUS policy moves. But the same architecture works for any sector where a single headline can move a predictable basket of stocks — and there are many.

Claude scans for gaps automatically. As part of the self-improvement loop, Claude doesn't just tune signal weights — it also analyzes which emerging topics are generating high news volume and market movement that the bot is currently missing. When it identifies a thematic gap, it proposes new keyword clusters and instrument mappings to add to the taxonomy. The bot literally expands what it pays attention to based on what's happening in the world.
In scope now
  • ⚡ Energy & oil geopolitics
  • 🛡 Defense & military spending
  • 🤖 AI & semiconductor wars
  • 🏦 Safe haven flows (gold, bonds)
  • 🌎 Emerging market shocks
  • 🏛 POTUS / US policy moves
Expanding next
  • 🧬 Biotech & medical breakthroughs
  • 🦾 Robotics & automation
  • 🚗 Autonomous vehicles
  • 🚀 Space & aerospace
  • ⚛ Nuclear & fusion energy
  • 🌐 Quantum computing
How it expands
  • Claude identifies coverage gaps
  • Proposes new keyword tiers
  • Maps themes to instrument baskets
  • Cross-cluster amplifier fires when
      two themes hit simultaneously
  • Weights proven by performance data
  • Loop repeats — indefinitely

The architecture was deliberately built open-ended. Adding a new sector is a keyword list and an instrument basket — the scoring, corroboration, risk, and execution layers handle the rest automatically.

One click to start.
Everything else is automatic.

The bot runs entirely from your Mac or PC. A desktop launcher handles startup, connection sequencing, and confirmation — no terminal commands required once it's set up.

Bot Launcher
● IBKR Gateway — Connected (paper)
● Anthropic API — Ready
● Telegram bot — Active
● VIX feed — Fallback 25.0
▶ Launch Bot
Open Dashboard

The launcher checks all dependencies before allowing start — IBKR connection, API keys, Telegram — and won't launch if anything is missing.

Paper mode vs live mode

A single toggle switches between simulated trading (no real money) and live trading. Paper mode is the default — the bot will never go live accidentally.

Startup sequence

IBKR Gateway → API auth → signal sources → scheduler → dashboard. Each step confirmed before the next starts. Failures halt the sequence with a clear error.

Runs in the background

Once launched, the bot runs silently. You don't need to keep any window open. The dashboard is available any time at localhost in your browser.

Your bot in your pocket —
controlled via Telegram.

Every significant event sends an instant message to your phone. More importantly, you can send commands back — checking status, pausing trading, or closing positions from anywhere in the world, without needing to be at your computer.

9:47● ● ●
🤖
GeoBot
● TRADE EXECUTED
LONG LMT · 2 shares
Entry $448.20
Signal: PM+OPRA+RSS (+0.68)
● TARGET HIT
LMT closed +0.52%
P&L: +$4.67
Hold time: 14 min
⚠ REJECTED
GLD LONG blocked
tier1_insufficient
/status
📊 Bot status
Mode: Paper
NAV: CA$1,024.18
Positions: 2/5
VIX: 28.4
Halt: OFF
Daily P&L: +$24.18

Commands you can send from anywhere:

/status
Full system snapshot — NAV, positions, VIX, halt flag, daily P&L
/positions
All open trades with entry price, current P&L, and hold time
/pause
Pause the signal cycle — no new trades until /resume is sent
/resume
Resume normal operation after a pause
/closeall
Emergency close — immediately exits all open positions at market
/signals
Current signal scores for all instruments in the last cycle
Automatic alerts fire for: every trade execution, every rejection with reason, daily P&L summary, risk limit breaches, IBKR disconnections, and optimizer parameter updates. You're always informed — without needing to check.
Conceived & built by
S.J. Rubin

The architecture, strategy logic, instrument universe, volatility plays, thematic taxonomy, and self-improving AI feedback loop are original intellectual property — conceived, designed, and assembled from scratch.

Two trading engines — geopolitical & volatility arbitrage
Six signal sources — including live OPRA options flow
Self-improving — Claude tunes weights & expands themes automatically
Built on Python · Interactive Brokers · Anthropic Claude API