Tutorial: Claude Code vs Codex CLI Polymarket Trading

Two AI agents — Claude Code running Opus 4.7 and Codex CLI running model version 5.5 — go head-to-head as autonomous Polymarket trading bots on Bitcoin 5-minute up/down markets. Each agent receives the same prompt and $50 USDC, then independently develops its own edge over sixty minutes. This tutorial covers the full setup: wallet provisioning, agent prompting, plan mode configuration, monitoring dashboards, and what the official docs clarify that the video leaves open.


0

Claude Code vs Codex CLI: Autonomous Polymarket Trading Battle

Two AI coding agents. One hundred dollars. Sixty minutes. By the end of this tutorial, you’ll know how to provision competing Polymarket accounts, craft a competitive agent prompt with embedded API documentation, and launch Claude Code and Codex CLI as autonomous trading bots on Bitcoin 5-minute up/down markets — watching each agent develop its own edge in real time.

The rules of the fight: Claude Code (Opus 4.7) vs Codex CLI (5.5) — same prompt, same docs, 1 hour on the clock. Most $ wins.
The rules of the fight: Claude Code (Opus 4.7) vs Codex CLI (5.5) — same prompt, same docs, 1 hour on the clock. Most $ wins.
  1. Create two separate Polymarket accounts and fund each with approximately $50 USDC — one for Claude Code, one for Codex CLI. Complete wallet isolation ensures the final balance comparison is clean and neither agent can touch the other’s funds.

  2. Check the Codex CLI wallet’s MATIC balance before proceeding. Polymarket operates on Polygon, so every on-chain trade consumes MATIC for gas. Transfer enough MATIC (the experiment used roughly 20) to the Codex wallet to prevent failed transactions mid-run.

  3. Write a single competitive prompt and paste it into both agents unmodified. Instruct each agent to research the Polymarket API, maximize dollar profit — not account balance — over exactly one hour, and acknowledge that zero trades is an automatic loss. Naming each agent’s rival explicitly (e.g., “your fierce rival, Claude Code”) produces more goal-directed behavior than a generic performance objective.

The complete agent brief: research the Polymarket API, build a strategy, run uninterrupted for 1 hour. Balance hits zero = automatic loss.
The complete agent brief: research the Polymarket API, build a strategy, run uninterrupted for 1 hour. Balance hits zero = automatic loss.
  1. Embed the Polymarket API documentation URL directly inside the prompt string. A concrete docs URL reduces hallucinated endpoints and lets each agent pull live schema details before committing to any trading logic.

  2. Enable plan mode before submitting the prompt. In Claude Code, press Shift+Tab to toggle plan mode. In Codex CLI, accept the “Create a plan?” prompt that appears automatically. Both agents will research, brainstorm, and surface a proposed strategy for your review before writing executable code.

Warning: this step may differ from current official documentation — see the verified version below.

  1. Accept each agent’s plan when ready and let both complete their build phases without interruption. Each agent independently queries the API, reads the documentation, and lands on a distinct strategy — resist the urge to guide them.

  2. Read and compare the two proposed strategies before launching. Codex CLI settled on a probability model: watch the Chainlink BTC/USD oracle live, compute the true win probability from time-remaining and volatility inputs, and only place a bet when the calculated edge clears the 1.5% fee floor. Claude Code settled on late-window settlement buying — with roughly six seconds left in each five-minute window, Bitcoin’s direction is nearly decided, yet winning-side contracts often still trade below $1.00. Buy at $0.80, collect $1.00.

Claude Code's core edge: with 6 seconds left in each window, the outcome is nearly settled — but the winning side still trades below $1. Buy at 80¢, collect $1.
Claude Code’s core edge: with 6 seconds left in each window, the outcome is nearly settled — but the winning side still trades below $1. Buy at 80¢, collect $1.
Claude Code's risk rules: half-Kelly bet sizing, 20% max per window, $8 hard floor — 'lots of small smart bets, not a few big gambles.'
Claude Code’s risk rules: half-Kelly bet sizing, 20% max per window, $8 hard floor — ‘lots of small smart bets, not a few big gambles.’
  1. Instruct each agent to build a local monitoring dashboard before the live run. Specify the required fields: current balance, realized P&L for the hour, a live countdown timer, and a scrolling trade log. Matching layouts make side-by-side monitoring practical across a full hour.

  2. Once both agents report preflight checks passed, type go into each terminal simultaneously. The synchronized start matters — any gap skews the sixty-minute balance comparison.

The starting gun: 'go' entered in both terminals simultaneously — the 1-hour autonomous trading battle begins.
The starting gun: ‘go’ entered in both terminals simultaneously — the 1-hour autonomous trading battle begins.
  1. Step back and monitor passively for the full hour. The only permitted intervention is restarting a crashed process — do not adjust prompts, strategy parameters, or position sizes mid-run.
Both bots go LIVE: Claude Code's dashboard (left) and Codex CLI's dashboard (right) — watching Chainlink BTC/USD in real time, hunting for last-second edges.
Both bots go LIVE: Claude Code’s dashboard (left) and Codex CLI’s dashboard (right) — watching Chainlink BTC/USD in real time, hunting for last-second edges.
  1. At the sixty-minute mark, pull final account balances from both Polymarket accounts and calculate realized P&L against the $50 baseline. The higher ending balance wins.

How does this compare to the official docs?

Polymarket’s developer documentation covers API authentication, order placement, and market resolution mechanics in precise detail — and what it says about order timing constraints, fee structure, and CLOB order types raises pointed questions about both agents’ assumptions that Act 2 addresses directly.

Here’s What the Official Docs Show

The video delivers a solid experiment frame — the documentation adds precision on token naming, tool versioning, and integration options that matter when you try to replicate it. Nothing below invalidates the setup; it fills the gaps.

Step 1 — Create and fund two Polymarket accounts with USDC

The video’s approach here matches the current docs exactly. One addition: the Polymarket docs banner flags a separate US portal — if you’re based in the United States, confirm which documentation governs your account before funding.

Polymarket developer documentation overview showing USDC under Core Concepts, the ClobClient TypeScript quickstart, and the US-specific portal notice.
📄 Polymarket developer documentation overview showing USDC under Core Concepts, the ClobClient TypeScript quickstart, and the US-specific portal notice.

Step 2 — Check gas balance before running

Polymarket running on Polygon is confirmed — the Polygon homepage lists Polymarket as a named trusted partner. As of May 2026, the correct token name is POL, not MATIC — Polygon rebranded its native gas token and the video reflects the prior name. Fund your agent wallet with POL.

Polygon homepage showing
📄 Polygon homepage showing “STAKE POL” navigation and Polymarket as a listed trusted partner — confirming POL as the current native gas token.

Step 3 — Write and paste the agent prompt

No official documentation was found for this step — proceed using the video’s approach and verify independently.

Step 4 — Embed the Polymarket API docs URL in the prompt

The video’s approach here matches the current docs exactly. Worth knowing: Polymarket offers official SDKs in Python, TypeScript, and Rust — plus a unified TypeScript/Python SDK in beta — either of which could replace a raw REST integration in your agent prompt.

Polymarket documentation showing the API Reference card and official SDK offerings in Python, TypeScript, and Rust.
📄 Polymarket documentation showing the API Reference card and official SDK offerings in Python, TypeScript, and Rust.

Steps 5–7 — Enable plan mode, accept plans, compare strategies

No official documentation was found for these steps — proceed using the video’s approach and verify independently.

Two naming clarifications before you proceed. “Claude Code (Opus 4.7)” refers to the claude-opus-4-7 model, not a product tier — Claude’s subscription plans are Free, Pro, and Max. “Codex CLI (5.5)” refers to an underlying OpenAI model version, not the CLI release — the current CLI release tag is 0.133.0.

Claude.ai pricing page showing Free, Pro ($17/mo annual), and Max (from $100/mo) plan tiers — subscription context for running Claude Code autonomously for one hour.
📄 Claude.ai pricing page showing Free, Pro ($17/mo annual), and Max (from $100/mo) plan tiers — subscription context for running Claude Code autonomously for one hour.
GitHub openai/codex showing latest release 0.133.0, dual codex-cli and codex-rs implementations, and the official
📄 GitHub openai/codex showing latest release 0.133.0, dual codex-cli and codex-rs implementations, and the official “lightweight coding agent that runs in your terminal” description.

Step 8 — Build a local monitoring dashboard

No official documentation was found for this step — proceed using the video’s approach and verify independently.

One Codex-specific note: a recent repository commit (tui: make codex-tui.log opt-in) means the TUI no longer writes a trade log by default. If your dashboard relies on codex-tui.log for the scrolling trade feed, enable it explicitly before the session starts. Also present in the repo root: an AGENTS.md file containing agent-specific configuration — review it to ensure Codex CLI interprets your autonomous task prompt as intended.

GitHub openai/codex root file listing showing AGENTS.md and the recent commit making codex-tui.log opt-in by default.
📄 GitHub openai/codex root file listing showing AGENTS.md and the recent commit making codex-tui.log opt-in by default.

Step 9 — Type go in both terminals simultaneously

No official documentation was found for this step — proceed using the video’s approach and verify independently.

One prerequisite the video skips: Claude Code requires an active Claude account, and a one-hour autonomous run at this trade frequency will consume significant tokens. Pro ($17/month) or Max ($100/month, 5–20× more usage than Pro) is the practical minimum — Free will not sustain it.

Step 10 — Monitor passively for sixty minutes

The video’s approach here matches the current docs exactly. Bookmark Polymarket’s public API Status page before the session starts — any undocumented outage mid-run contaminates the result. Polygon’s 110 TPS capacity means on-chain gas confirmation is not a meaningful bottleneck at typical Polymarket trade frequency.

Polymarket documentation footer showing the API Status monitoring link, Builder Program, and Help Center.
📄 Polymarket documentation footer showing the API Status monitoring link, Builder Program, and Help Center.

Step 11 — Pull final balances and calculate P&L

No official documentation was found for this step — proceed using the video’s approach and verify independently.

  1. Overview – Polymarket Documentation — Official developer docs covering the CLOB API, authentication, order placement, Python/TypeScript/Rust SDKs, and the US-specific portal notice.
  2. Claude Code – Claude — Official entry point for Claude Code with account authentication, plan tier details (Free, Pro, Max), and terminal/IDE/browser access options.
  3. GitHub – openai/codex — Codex CLI’s official repository with the latest release (0.133.0), AGENTS.md configuration file, codex-tui.log opt-in commit, and dual codex-cli/codex-rs implementations.
  4. Polygon | The Go-To Blockchain for Global Payments — Polygon’s homepage confirming POL as the current native gas token name and Polymarket as a listed trusted partner on the network.

Like it? Share with your friends!

0

What's Your Reaction?

hate hate
0
hate
confused confused
0
confused
fail fail
0
fail
fun fun
0
fun
geeky geeky
0
geeky
love love
0
love
lol lol
0
lol
omg omg
0
omg
win win
0
win

0 Comments

Your email address will not be published. Required fields are marked *