HomeAboutResearchProductsDocs

Building a Polymarket Bot, Part 5

Polymarket
Trading-Engine
Ethereum

Dec 25, 2025

Building a Polymarket Bot, Part 5: NegRisk Foundations

📒 Docs · ☎️ Telegram · 𝕏 @ZEITFinance · 𝕏 @autonomous_af

← Previous: Part 4, Getting Filled

ZEIT FINANCE · Building a Polymarket Bot

Part 5 — NegRisk Foundations


Introduction

In Part 4, we learned how to execute orders. Now, we need to understand the asset class itself.

If you are building a bot for Polymarket's election-style markets (multi-candidate, winner-take-all), you will quickly encounter a confusing gap between what you see and how the system behaves:

  • On the CLOB: Everything looks like separate, independent binary markets (Trump/USDC, Harris/USDC).
  • Economically: They are deeply connected—because only one candidate can win.

Then you hear about "NegRisk Convert," and it sounds like alchemy: turning "NO" shares into "YES shares + Cash."

This is basically correct. But to use it safely, you need a clean mental model that combines the standard mechanics with the NegRisk Overlay. This article provides the three "Laws of Motion" that govern how value moves through these markets.


1. In Plain English: The Horse Race Analogy

Before the math, here is the intuition.

Imagine a horse race with 3 horses: A, B, and C.

Without NegRisk: Betting "NO" on Horse A just means "I think A loses." The system doesn't know that this implies anything about B or C. You could theoretically bet "NO" on all three horses and lose money on every bet, which makes no sense.

With NegRisk: The system understands that exactly one horse must win.

This unlocks a powerful logic: If you bet "NO" on Horse A and "NO" on Horse B, you have effectively bet "YES" on Horse C.

NegRisk is simply the machinery that makes this logic tradeable. It allows you to take a pile of "NO" tickets (betting against the favorites) and instantly swap them for a "YES" ticket (betting on the underdog), often releasing cash in the process.

The Negrisk Horse Race Analogy: Betting NO on Losers = Betting YES on the Winner

The Negrisk Horse Race Analogy: Betting "NO" on losers equals betting "YES" on the winner


2. The Bedrock: CTF Basics

Under the hood, every outcome share is an on-chain token representing a claim on collateral. You don't need to know the hashing details, but you do need to know the standard lifecycle of a binary market.

Law 1: Split (Minting)

Collateral → Full Set (YES + NO)

This is how positions are created.

  • Action: You deposit $1.00 USDC.
  • Result: You receive 1 YES Share + 1 NO Share.
  • Logic: Since one outcome must happen, the sum of a YES and NO share is always worth exactly $1.00 at settlement.
CTF Basics: Split (Minting) - Collateral to YES and NO tokens

Split (Mint): $1.00 USDC collateral becomes 1 YES + 1 NO token

Law 2: Merge (Redemption)

Full Set (YES + NO) → Collateral

This is the reverse.

  • Action: You burn 1 YES Share + 1 NO Share.
  • Result: You receive $1.00 USDC back.
  • Constraint: This is all-or-nothing. You cannot merge partial sets. You must hold both tokens to unlock the collateral.
CTF Basics: Merge (Redeem) - YES and NO tokens back to Collateral

Merge (Redeem): 1 YES + 1 NO token becomes $1.00 USDC collateral

The CTF Problem

Standard CTF treats every market as an isolated universe. It has no way to express: "If Trump wins, Harris must lose." In a pure CTF world, a 5-candidate election is just 5 disconnected binary markets. This creates massive capital inefficiency because you have to fully collateralize every single market separately.

Enter NegRisk.


3. The NegRisk Overlay

NegRisk (Negative Risk) is a protocol layer that groups multiple binary markets into a single Mutually Exclusive Event, ensuring that exactly one outcome resolves to YES.

This introduces a third Law of Motion, which allows value to teleport between the disconnected markets.

Law 3: Convert

NO Shares → YES Shares (+ Cash)

Convert is a primitive that allows you to transform "NO" positions into their equivalent "YES" portfolio without touching the order book.

But why does this work? It isn't magic; it's basic accounting.

NegRisk Foundations: The Three Laws of Motion & Conversion Mechanics

NegRisk Foundations: The Three Laws of Motion & Conversion Mechanics

Convert Primitive: NO shares to YES shares and Cash

Convert: Transforming NO shares into YES shares and cash extraction


4. The Economic Insight: The "Floor"

The reason you can extract cash from a basket of NO shares is that the basket contains a Guaranteed Floor.

Let's use a simple 3-candidate example: A, B, C. Exactly one wins. Consider what happens if you hold one share each of NO(A) and NO(B).

Let's simulate the resolution:

If A wins:

  • NO(A) pays $0.
  • NO(B) pays $1 (because B lost).
  • Total Payout: $1.00.

If B wins:

  • NO(A) pays $1 (because A lost).
  • NO(B) pays $0.
  • Total Payout: $1.00.

If C wins:

  • NO(A) pays $1.
  • NO(B) pays $1.
  • Total Payout: $2.00.

The Insight

No matter who wins, this portfolio is guaranteed to pay out at least $1.00. NegRisk convert simply acknowledges this reality. It lets you extract that guaranteed $1.00 floor immediately as cash, leaving you with the remaining upside (which is mathematically identical to YES(C)).

💡 Key Insight: The guaranteed floor is what makes cash extraction possible. When you convert multiple NO positions, you're unlocking the collateral that's guaranteed to pay out regardless of which outcome wins.


5. The Mechanics of Conversion

When you call convert, the output is determined by how much "floor" your basket contains.

The Formula

  • n = Total outcomes in the group (e.g., 5 candidates).
  • k = Number of distinct NO outcomes you are converting.
  • a = Amount of shares per leg.

The Output

  • YES Shares: You receive (n - k) YES shares (the candidates you didn't include).
  • Cash (USDC): You receive (k - 1) × a in USDC.

Worked Example: The 3-Candidate Race

Assume candidates A, B, C (n=3). You hold 10 shares each of various NO positions.

Scenario A: The Swap (k=1)

You convert 10 NO(A).

  • Math: k=1.
  • USDC Out: (1 - 1) × 10 = 0.
  • YES Out: You get YES shares for everyone else (B and C).
  • Result: 10 NO(A) → 10 YES(B) + 10 YES(C).

Takeaway: A single NO leg has a floor of $0 (if A wins). No cash is released.

Scenario B: The Cash Extraction (k=2)

You convert 10 NO(A) + 10 NO(B).

  • Math: k=2.
  • USDC Out: (2 - 1) × 10 = 10 USDC.
  • YES Out: You get YES shares for the remaining candidate (C).
  • Result: 10 NO(A) + 10 NO(B) → 10 YES(C) + $10.00.

Takeaway: You effectively "merged" the guaranteed floor of your NO positions to unlock $10 collateral, leaving you with the pure upside (YES C).

⚠️ Critical Rule: Cash extraction only occurs when k ≥ 2. Converting a single NO position swaps it for YES positions but releases no cash.


6. Where does the Cash come from? (WrappedCollateral)

You might wonder: "Standard CTF only releases collateral when I have a full set. How is NegRisk giving me $10 back when I only had NO shares?"

The Answer: Plumbing. NegRisk markets do not use raw USDC as collateral. They use WrappedCollateral, a specialized token that holds the underlying USDC.

When you convert:

  1. The NegRisk adapter burns your input NO tokens.
  2. It calculates the Guaranteed Floor value of your portfolio (as proven in Section 4).
  3. It instructs the WrappedCollateral contract to release the underlying USDC corresponding to that floor.

This is why convert works: the floor is mathematically guaranteed, so the protocol can safely unlock that portion of the collateral without requiring a full set.


7. The Hidden Trap: Invisible "Other" Outcomes

There is one final, critical nuance that burns many new bot builders.

When you look at a NegRisk market on the Polymarket website—for example, "Next Republican Nominee"—you might see a list of 5 candidates. It is incredibly easy to assume that these 5 names represent 100% of the possible outcomes.

This is often false.

Every NegRisk group is initialized on-chain with a fixed number of outcome slots (n). To make the user interface cleaner, the frontend frequently hides one or more of these slots, treating them as an implicit placeholder for "Other," "None of the Above," or "Field."

Why This Matters

If you do not account for the invisible outcome, your risk calculations will be catastrophic.

Imagine a market showing candidates A, B, and C.

You decide to execute a "No Arb" strategy (which we will cover in Part 6). You buy NO(A), NO(B), and NO(C), believing you have covered every possibility and locked in free money.

The Reality: The market was actually initialized with n=4 outcomes on-chain. The fourth, hidden outcome is "Other."

If a surprise candidate wins, the hidden "Other" slot resolves to YES.

Consequently, A, B, and C all resolve to NO.

Your pile of "NO" shares, which you thought was a risk-free hedge, is now worthless. They all settle to $0.

🚨 Bot Builder Rule: Never assume the frontend displays the complete set of outcomes. Always check the on-chain metadata or API response to determine the true total number of outcome slots (n) in a NegRisk group. Your math must account for the invisible slot.


Summary: The Combined Model

To build profitable strategies, you must simulate these transitions in your head:

  1. Split: 1.00 → YES + NO (Entry)
  2. Merge: YES + NO → 1.00 (Exit)
  3. Convert: k × NO → YES + (k-1) Cash (Transformation)

These three Laws of Motion form the foundation of all NegRisk strategies. Understanding them deeply is the difference between profitable automation and catastrophic losses.

Law 1: Split

Collateral → Full Set (YES + NO)

🔄
Law 2: Merge

Full Set (YES + NO) → Collateral

Law 3: Convert

NO Shares → YES Shares + Cash


What's Next

Now that we understand the laws of motion, we can turn them into code. Part 6 will cover The Strategy Implementation: We will look at the three basic strategies:

  1. Yes Arb: Buying the entire field when the probability sum drops below 100%.
  2. No Arb: Buying "No" on every candidate to exploit the n-1 payout rule.
  3. Convert Arb: The liquidity teleport—buying cheap "No" shares, converting them to "Yes," and selling into a premium.

Continue the Series


Links


This article is Part 5 of the ZEIT Finance series on building Polymarket trading bots. ZEIT Finance turns prediction markets into perpetual assets.

HomeAboutResearchProducts

© 2026 Autonomous Finance. All rights reserved.