> ## Documentation Index
> Fetch the complete documentation index at: https://docs.limitless.exchange/llms.txt
> Use this file to discover all available pages before exploring further.

# Cross-Market Market Making

> Quote a market on Limitless and hedge your fills on Polymarket to stay delta-neutral — a runnable, open-source market-making skill

Quote the **same** prediction market on two venues at once: rest BUY quotes on
**Limitless** (the maker side, where you capture the spread and earn maker
rebates) and hedge any fill straight back on **Polymarket** so your net position
stays \~flat. You're earning the cross-venue spread, not taking a directional
bet.

This ships as the **`cross-market-mm`** strategy in
[**agents-starter**](https://github.com/limitless-labs-group/agents-starter) —
a runnable skill you can take from clone → dry-run → live → flat. Its
[`SKILL.md`](https://github.com/limitless-labs-group/agents-starter/blob/main/src/strategies/cross-market-mm/SKILL.md)
is the canonical guide; this page is the Limitless-framed quickstart.

> [!NOTE]
>
> This is for **traders, builders, and AI agents** running their own
> market-making bot. Limitless is the venue you quote on; Polymarket is a
> secondary hedge venue with a one-time setup. If you're building a platform
> where other users trade through your product, see
> [Programmatic API](https://docs.limitless.exchange/developers/programmatic-api.md) instead.

> [!WARNING]
>
> Moves real money on two chains (Base + Polygon). Use a **dedicated wallet**,
> keep order sizes small, and always start in `DRY_RUN`. Profit depends on fill
> rate and the Limitless maker reward programs, not on the bot alone — read the
> economics below and in the repo before expecting profit.

## How it works

```
Polymarket book  ──▶  quote one margin step inside it on Limitless (BUY YES + BUY NO)
get filled on Limitless  ──▶  BUY the offsetting side on Polymarket (FAK)  ──▶  delta-flat
```

Limitless is where the spread is captured. Your resting quotes are **maker
liquidity** — and [makers pay no Limitless fee](https://docs.limitless.exchange/user-guide/fees.md) — so they earn
from [maker rebates](https://docs.limitless.exchange/user-guide/maker-rebates.md) when filled and
[LP rewards](https://docs.limitless.exchange/user-guide/lp-rewards.md) for resting near the midpoint. Polymarket is
where directional risk is flattened; that hedge is a taker order, so the strategy
also doubles as a Polymarket volume engine.

## The wallet model — one key

Everything is controlled by **one dedicated EOA private key**. That key signs on
both chains; funds live in a few places:

| Identity | What it is | Holds |
| - | - | - |
| **Your EOA** (`PRIVATE_KEY`) | the key you control | Base USDC + a little ETH (Limitless collateral + gas) |
| **Limitless** | trades from the EOA directly ([EIP-712](https://docs.limitless.exchange/developers/eip712-signing.md)) | — (uses the EOA's USDC) |
| **Polymarket deposit wallet** | a **key-less** ERC-1271 proxy derived from your EOA | **pUSD** (the hedge collateral) |

> [!WARNING]
>
> When you connect this EOA to the Limitless app (e.g. to mint the API token), decline the one-time "choose your trading wallet" prompt if it offers 1-click (smart wallet) trading. Accepting it puts the profile in smart-wallet mode, and every order the bot signs is rejected. Already accepted it? See [Trading wallet mode](https://docs.limitless.exchange/developers/eip712-signing.md#trading-wallet-mode-whose-address-signs).

You never manage a second key — the deposit wallet is validated by your EOA's
signature. The only other credentials are **two API tokens** (not wallet keys):
a Limitless [scoped HMAC token](https://docs.limitless.exchange/developers/authentication.md) and a Polymarket
relayer API key (for the one-time deposit-wallet setup).

> [!NOTE]
>
> Polymarket's CLOB rejects orders from a Gnosis Safe maker, so even existing
> Safe users trade via the deposit-wallet flow (signature type 3). pUSD must
> live **in the deposit wallet** — it's a separate address from your Polymarket
> UI login, so it won't show in the UI. `npm run cross-market-mm:status` is how you
> see it.

## Quick start — dry-run in under 10 minutes (no real money)

Watch the full cross-venue loop — quote on Limitless, compute and log the
Polymarket hedge, return delta-flat — signing nothing and funding nothing. You
only need a Limitless [scoped HMAC token](https://docs.limitless.exchange/developers/authentication.md) for this.

**1. Clone + install**

```bash theme={null}
git clone https://github.com/limitless-labs-group/agents-starter.git
cd agents-starter && npm install
cp .env.example .env && chmod 600 .env
# set PRIVATE_KEY (any dedicated EOA), LMTS_TOKEN_ID, LMTS_TOKEN_SECRET. Leave DRY_RUN=true.
```

**2. Pick an equivalent pair**

```bash theme={null}
npm run cross-market-mm:find-pairs        # liquidity-ranked cross-venue shortlist
cp src/strategies/cross-market-mm/config.example.yaml ./cross-market-mm.config.yaml
# paste one pair into market_pairs; order_size: 5; dry_run: true
```

Verify both sides resolve on identical criteria — same asset, threshold, UTC
moment, source. Title overlap is not enough.

**3. Watch the cross-venue loop**

```bash theme={null}
SIMULATE_FILL=YES:5 DRY_RUN=true npm run cross-market-mm   # Ctrl-C, then:
npm run cross-market-mm:analyze
```

A synthetic Limitless fill flows through the real hedger, which fires the
offsetting Polymarket hedge (logged, not sent) and returns the book to
delta-flat — the whole strategy, for \$0.

## Go live (one-time, \~20–30 minutes — honest)

Going live means funding two chains and deploying the Polymarket deposit wallet.
Most of the time is moving funds, not running commands.

**1. Deploy the deposit wallet (gasless)**

Add a Polymarket relayer key to `.env` (`RELAYER_API_KEY` +
`RELAYER_API_KEY_ADDRESS`), then:

```bash theme={null}
npm run cross-market-mm:setup-poly
```

Derives + deploys your deposit wallet and approves pUSD (buy) **and** CTF
(sell) on Polymarket's v2 exchanges. Prints the address — set it as
`poly_funder` with `poly_signature_type: 3`.

**2. Fund**

Base: **USDC** + \~\$1–2 **ETH** → your EOA. Polygon: **pUSD** → the
**deposit-wallet** address (not your EOA / Safe / UI login). Confirm with
`npm run cross-market-mm:status`.

**3. Approve the Limitless exchange (one-time, per exchange)**

```bash theme={null}
npm start approve <your-limitless-slug>
```

[NegRisk markets](https://docs.limitless.exchange/user-guide/negrisk-overview.md) use a separate exchange, so
they need their own approval. Preflight tells you if it's missing.
Markets on [new trading venues](https://docs.limitless.exchange/developers/venue-system.md#new-trading-venues)
also need a USDC approval to the venue's `feeModule`.

**4. Preflight, then go live**

```bash theme={null}
npm run cross-market-mm:preflight        # validates auth, funding, sig type, approvals, pairs
# set dry_run: false, then:
npm run cross-market-mm
```

A green preflight means the next live run places real orders with no
surprise rejections.

## Lifecycle commands

| Command | What it does |
| - | - |
| `npm run cross-market-mm:find-pairs` | Liquidity-ranked shortlist of equivalent cross-venue pairs |
| `npm run cross-market-mm:setup-poly` | One-time: deploy the Polymarket deposit wallet + approvals |
| `npm run cross-market-mm:preflight` | Validate auth, funding, sig type, approvals, pairs (gate before live) |
| `npm run cross-market-mm` | Run the bot (`DRY_RUN` by default) |
| `npm run cross-market-mm:status` | Cross-venue portfolio: Limitless + the deposit wallet's pUSD/positions + net delta |
| `npm run cross-market-mm:close` | Exit to flat on **both** venues |
| `npm run cross-market-mm:analyze` | Summarize a run (orders, fills, how flat it stayed, hedges) |

## Safety

* **Loss circuit-breaker** (`max_loss_usd`, default \$10): halts on drawdown.
* **Flatten on stop:** Ctrl+C or a tripped breaker cancels all orders **and**
  sells inventory to flat on both venues — a stop never leaves unhedged
  directional risk.
* **Settled reads:** fills and hedges re-read a settled position before acting,
  so a lagged read can't double-fill or double-hedge.
* **Dedicated wallet, small `order_size`, `DRY_RUN` default.** If anything looks
  wrong: halt, flatten, check `status`.

## Economics & rewards

Your Limitless quotes are **maker liquidity, and makers pay no Limitless fee**
([fees](https://docs.limitless.exchange/user-guide/fees.md) apply to takers only). Your only direct cost is the
Polymarket FAK hedge's taker fee. Revenue comes from three places:

* **Cross-venue spread** — the margin you quote inside the Polymarket book,
  captured when both legs fill.
* **[Maker rebates](https://docs.limitless.exchange/user-guide/maker-rebates.md)** — when a taker fills your
  resting order, a share of their taker fee is rebated to makers pro-rata, paid
  daily in USDC. Only **executed fills** earn. Current config rebates **100% of
  eligible taker fees on Daily, Hourly Crypto, and 15-minute Crypto** markets.
* **[LP rewards](https://docs.limitless.exchange/user-guide/lp-rewards.md)** — daily USDC for orders resting
  within a spread of the midpoint, above a per-market minimum size — paid for
  quote *presence*, not fills. Closer to mid + more size = larger share.

> [!NOTE]
>
> To actually earn the reward programs, **size up and target eligible markets**.
> `order_size: 5` is a smoke-test size — below typical LP-reward minimums and
> too small for meaningful rebate credit. Short-window crypto (Hourly /
> 15-minute) is both 100%-rebate-eligible and the cleanest cross-venue match.
> Reward parameters are the program's current config and can change.

## Honest caveats

* **You need liquidity on *both* venues at once** — Limitless takers to fill
  your maker quotes, and a Polymarket book to hedge into. The venues don't
  always overlap; the cleanest matches are crypto price markets, recurring macro
  prints, and [NegRisk](https://docs.limitless.exchange/user-guide/negrisk-overview.md) winner markets (sports
  finals, elections). `find-pairs` ranks candidates, but you confirm the
  resolution criteria match.
* **The binding constraint is fill rate, not fees.** Rebates and LP rewards only
  pay where your maker liquidity is actually used — eligible markets with real
  taker flow on both venues. Far-dated winner futures look balanced but trade
  thinly; short-window crypto is where the flow and the eligibility line up.

## Learn more

> [card] [Build a trading agent](https://docs.limitless.exchange/developers/build-a-trading-agent.md)
>
> The single-venue starter and the three built-in Limitless strategies.

> [card] [Authentication](https://docs.limitless.exchange/developers/authentication.md)
>
> Scoped HMAC tokens — the Limitless credential this skill uses.

> [card] [Maker rebates & LP rewards](https://docs.limitless.exchange/user-guide/maker-rebates.md)
>
> Daily USDC for maker liquidity — the real profit engine when sized to qualify.

> [card] [Migrate from Polymarket](https://docs.limitless.exchange/developers/migrate-from-polymarket.md)
>
> Concept + endpoint mapping if you're coming from Polymarket.

The full guide, troubleshooting, and reproducible demo live in the repo:
[`SKILL.md`](https://github.com/limitless-labs-group/agents-starter/blob/main/src/strategies/cross-market-mm/SKILL.md),
[`QUICKSTART.md`](https://github.com/limitless-labs-group/agents-starter/blob/main/src/strategies/cross-market-mm/QUICKSTART.md),
[`DEPLOY.md`](https://github.com/limitless-labs-group/agents-starter/blob/main/src/strategies/cross-market-mm/DEPLOY.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.