> ## 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.

<Info>
  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](/developers/programmatic-api) instead.
</Info>

<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.
</Warning>

## 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](/user-guide/fees) — so they earn
from [maker rebates](/user-guide/maker-rebates) when filled and
[LP rewards](/user-guide/lp-rewards) 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](/developers/eip712-signing)) | — (uses the EOA's USDC)                               |
| **Polymarket deposit wallet** | a **key-less** ERC-1271 proxy derived from your EOA                  | **pUSD** (the hedge collateral)                       |

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](/developers/authentication) 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.
</Note>

## Quickstart — 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](/developers/authentication) for this.

<Steps>
  <Step title="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.
    ```
  </Step>

  <Step title="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.
  </Step>

  <Step title="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.
  </Step>
</Steps>

## 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.

<Steps>
  <Step title="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`.
  </Step>

  <Step title="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`.
  </Step>

  <Step title="Approve the Limitless exchange (one-time, per exchange)">
    ```bash theme={null}
    npm start approve <your-limitless-slug>
    ```

    [Neg-risk markets](/user-guide/negrisk-overview) use a separate exchange, so
    they need their own approval. Preflight tells you if it's missing.
  </Step>

  <Step title="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.
  </Step>
</Steps>

## 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](/user-guide/fees) 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](/user-guide/maker-rebates)** — 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](/user-guide/lp-rewards)** — 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.
</Note>

## 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 [neg-risk](/user-guide/negrisk-overview) 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

<CardGroup cols={2}>
  <Card title="Build a trading agent" icon="robot" href="/developers/build-a-trading-agent">
    The single-venue starter and the four built-in Limitless strategies.
  </Card>

  <Card title="Authentication" icon="key" href="/developers/authentication">
    Scoped HMAC tokens — the Limitless credential this skill uses.
  </Card>

  <Card title="Maker rebates & LP rewards" icon="hand-holding-dollar" href="/user-guide/maker-rebates">
    Daily USDC for maker liquidity — the real profit engine when sized to qualify.
  </Card>

  <Card title="Migrate from Polymarket" icon="right-left" href="/developers/migrate-from-polymarket">
    Concept + endpoint mapping if you're coming from Polymarket.
  </Card>
</CardGroup>

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),
[`GO-LIVE.md`](https://github.com/limitless-labs-group/agents-starter/blob/main/src/strategies/cross-market-mm/GO-LIVE.md),
[`DEMO.md`](https://github.com/limitless-labs-group/agents-starter/blob/main/src/strategies/cross-market-mm/DEMO.md).
