# Building a Polymarket AI Trading Bot From Scratch <!-- ref: @content/youtube/all-about-ai/building-a-polymarket-ai-trading-bot-from-scratch tags: [Polymarket, trading bot, Claude Code, AI coding agents, Polygon wallet, prediction markets, live trading] version: 2 updated_at: 2026-11-24T06:03:58.004Z --> **[Watch on YouTube](https://www.youtube.com/watch?v=0ZJXpMZobjY)** # Building a Polymarket AI Trading Bot From Scratch *Synthesized from All About AI, 2026-05-12; speakers are not named in the source.* The speaker is unnamed in the transcript and appears alone on the channel. The video is a live build-and-run of a short-horizon trading bot that uses Claude Code, with the speaker describing the setup and trades as experimental. ## Core Thesis The speaker shows that a coding agent can build a Polymarket trading bot in a session, with the agent reading the Polymarket documentation, creating a wallet, researching a leaderboard trader's behavior, and writing the bot and a live dashboard. The speaker frames the result as a fun experiment, not a reliable income source, and says a bot like this needs extensive testing before real money is committed. ## Key Insights - **Target market.** The bot trades the five-minute Bitcoin up-or-down markets on Polymarket, which the speaker calls the highest-frequency market available there. - **Setup.** The agent reads the Polymarket documentation (the gamma API), stores the wallet's private key in an environment file without printing it, and checks the balance. The wallet was funded with USDC.e and a small amount of POL on the Polygon network for gas. - **Research step.** Background agents studied a leaderboard trader's history. The agent summarized the trader's approach as late-window scalping: buying positions priced above 0.9 and holding them to resolution. - **Allowance gotcha.** Before live trading, the CTF exchange needs token allowance to move USDC, which the speaker says should have been set up earlier. The fix is an account with MetaMask, with trading enabled, token spending approved and auto-redeem enabled. - **Parameters.** The entry price cap was discussed at 0.95 to 0.97. The trade window was tightened to the last 35 seconds, skipping the final 8 seconds, leaving about a 20-second window. Only one position was held open at a time. - **Dashboard.** A React dashboard shows recent trades, total equity, a live decision log and a five-second terminal flash when a trade is placed. - **Results, as stated.** The run started at $30 and was about $34 after roughly two hours, with a peak near 7% up. The speaker stresses the sample is small and that losses could erase gains. ## Actionable Takeaways 1. Start any trading bot in dry-run mode and check the order-allowance step before going live. 2. Give the coding agent the exchange's documentation first, then ask it to build the client. 3. Keep private keys in an environment file and never print them to the terminal. 4. Cap the entry price and restrict the trade window before enabling live orders. 5. Treat a short live run as a test, not as evidence of an edge. ## Notable Quotes > "I don't really care about the results." — the speaker (not named in the transcript) > "I'm just learning, having fun, and playing around with agents." — the speaker (not named in the transcript) --- *Related: `@content/youtube/zazencodes/build-your-own-ai-software-factory-with-claude-code` · `@content/youtube/sean-kochel/opus-4-7-is-insanely-powerful-and-insanely-expensive` · `@content/youtube/yifan-bth/i-reverse-engineered-claude-code-learn-these-agent-tricks` · `@content/youtube/yifan-bth/the-complete-claude-code-workflow-90-skip-this` · `@content/youtube/tiago-forte/stop-overthinking-ai-use-this-4-step-framework`* --- *You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).* *Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*