@moonpay/cli 1.56.1 → 1.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,111 +1,112 @@
1
1
  ---
2
2
  name: moonpay-polymarket
3
- description: Trade on Polymarket — search markets, buy/sell outcome shares, track positions and PnL. Polymarket runs on Polygon and settles in USDC.e. Use when the user names Polymarket explicitly, or wants politics, crypto, news, or general-events markets (Polymarket's strength).
3
+ description: Trade on Polymarket — search markets, buy/sell outcome shares, track positions and PnL. Polymarket runs on Polygon and settles in pUSD (Polymarket USD). Use when the user names Polymarket explicitly, or wants politics, crypto, news, or general-events markets (Polymarket's strength).
4
4
  tags: [trading, prediction-market, polymarket]
5
5
  ---
6
6
 
7
7
  # Polymarket
8
8
 
9
- The largest prediction-market venue. Settles on Polygon in USDC.e. Strong on **politics, news, crypto, and general events**.
9
+ The largest prediction-market venue. Settles on Polygon in **pUSD** (Polymarket USD, 1:1 USDC-backed, Polymarket-issued ERC-20). Strong on **politics, news, crypto, and general events**.
10
10
 
11
11
  ## Prerequisites
12
12
 
13
13
  1. Authenticate: `mp login --email <email>` then `mp verify --email <email> --code <code>`
14
- 2. EVM wallet (any chain): `mp wallet list` (or create with `mp wallet create --name "main"`). The same EVM address works for Polygon.
15
- 3. Register the wallet with Polymarket (one-time):
14
+ 2. EVM wallet (any chain): `mp wallet list` (or `mp wallet create --name "main"`).
15
+ 3. Fund the Polygon wallet with **pUSD** and a tiny amount of POL for gas. Use **moonpay-fund-polymarket** for the recommended path.
16
16
 
17
- ```bash
18
- mp prediction-market user create --provider polymarket --wallet <evm-address>
19
- ```
20
-
21
- 4. Fund the Polygon wallet with USDC.e and a tiny amount of POL for gas. Use **moonpay-fund-polymarket** for the recommended path.
17
+ A Polymarket proxy wallet is created lazily on first buy — no separate setup step.
22
18
 
23
19
  ## Browse and research
24
20
 
25
21
  ```bash
26
- # Search by keyword
27
- mp prediction-market market search --provider polymarket --query "bitcoin" --limit 10
28
-
29
- # Trending (by 24h volume, min $150k)
30
- mp prediction-market market trending list --provider polymarket --limit 10
31
-
32
- # Browse tags / categories
33
- mp prediction-market market tag list --provider polymarket
22
+ # Search events by keyword
23
+ mp prediction-market event search --provider polymarket --query "bitcoin" --limit 10
34
24
 
35
- # Filter by tag
36
- mp prediction-market market search --provider polymarket --query "*" --tagIds "crypto,politics"
37
-
38
- # Full event details (every market under the event, all outcomes + prices)
39
- mp prediction-market market event retrieve --provider polymarket --slug <event-slug>
40
-
41
- # Live price for a single outcome token
42
- mp prediction-market market price retrieve --provider polymarket --tokenId <token-id>
25
+ # Full event details (markets + outcomes with current prices, bid, ask, volume, liquidity)
26
+ mp prediction-market event retrieve --provider polymarket --slug <event-slug>
43
27
 
44
28
  # Price history for an outcome
45
- mp prediction-market market price-history list --provider polymarket --tokenId <token-id> --interval 1w
29
+ mp prediction-market market ohlcv list --provider polymarket --tokenId <outcome-id> --interval 1w
46
30
  ```
47
31
 
32
+ Current prices and bid/ask live on `event_retrieve.markets[].outcomes[]` — no separate `price retrieve` call needed.
33
+
48
34
  ## Buy / sell
49
35
 
36
+ Buy is a one-shot sign + broadcast. Sell is build → sign typed-data → submit (the submit step uses the user's EIP-712 signature so Polymarket can't move funds without explicit consent).
37
+
50
38
  ```bash
51
- # Buy YES shares
39
+ # Buy returns an unsigned Polygon tx, CLI signs + broadcasts.
52
40
  mp prediction-market position buy \
53
41
  --wallet main \
54
42
  --provider polymarket \
55
- --tokenId <outcome-token-id> \
43
+ --tokenId <outcome-id> \
56
44
  --price 0.65 \
57
45
  --size 100
58
46
 
59
- # Sell shares
47
+ # Sell — two-step. Step 1: build typedData. Step 2: CLI signs + submits.
60
48
  mp prediction-market position sell \
61
49
  --wallet main \
62
50
  --provider polymarket \
63
- --tokenId <outcome-token-id> \
64
- --price 0.70 \
51
+ --marketId <market-id> \
52
+ --outcomeId <outcome-id> \
65
53
  --size 50
66
54
  ```
67
55
 
56
+ `marketId` + `outcomeId` round-trip directly from `prediction-market position list`. The CLI handles the typedData sign + POST under the hood when `position sell` returns `typedData`.
57
+
68
58
  **Concepts:**
69
- - `tokenId` comes from `outcomeTokens[].tokenId` in market search results.
70
- - `price` is 0-1 (e.g., 0.65 = 65¢ per share, implies 65% probability).
59
+ - `outcomeId` is the CLOB outcome token id (also the ERC-1155 token id). Pass through unmodified from `event_retrieve.markets[].outcomes[].id` or `position_list[].outcomeId`.
60
+ - `marketId` is the market's conditionId `event_retrieve.markets[].id` or `position_list[].marketId`.
61
+ - `price` on buy is the **maximum acceptable price per share** (0–1). Orders fill at the current market price up to this ceiling, then cancel. Not a resting limit order.
71
62
  - `size` is the share count.
72
- - Cost = price × size (so 0.65 × 100 = $65 USDC.e).
73
- - If the outcome resolves YES, each share pays $1 → profit = (1 − price) × size.
74
- - `negRisk` markets use a different settlement framework the CLI handles this automatically.
63
+ - Worst-case cost = price × size (so 0.65 × 100 = $65 pUSD).
64
+ - If the outcome resolves YES, each share pays $1 → profit = (1 − fill price) × size.
65
+ - $1 minimum per order `size × price` must be $1 or swaps.xyz rejects with `POLYMARKET_AMOUNT_TOO_LOW`.
75
66
 
76
67
  ## Track + close positions
77
68
 
78
69
  ```bash
79
70
  mp prediction-market position list --provider polymarket --wallet <address>
80
71
  mp prediction-market position list --provider polymarket --wallet <address> --status closed
81
- mp prediction-market pnl retrieve --provider polymarket --wallet <address>
82
- mp prediction-market trade list --provider polymarket --wallet <address>
83
- mp prediction-market activity list --provider polymarket --wallet <address>
72
+ ```
73
+
74
+ Each position has `status` (`"open" | "redeemable" | "redeemed"`), `size`, `avgPrice`, `currentValue`, `unrealizedPnl`, plus `marketId` + `outcomeId` you pass back to sell or redeem.
75
+
76
+ Realized PnL on closed positions surfaces as `unrealizedPnl` on the redeemed/closed row (size = 0). Portfolio-level totals are a client-side sum across positions.
84
77
 
85
- # Redeem winning shares after a market resolves
86
- mp prediction-market position redeem --provider polymarket --wallet main --tokenId <token-id>
78
+ ### Redeem (winning positions after market resolution)
79
+
80
+ ```bash
81
+ mp prediction-market position redeem \
82
+ --wallet main \
83
+ --provider polymarket \
84
+ --marketId <conditionId> \
85
+ --outcomeId <outcome-id>
87
86
  ```
88
87
 
88
+ Same two-step flow as sell: `position redeem` returns EIP-712 typedData (`BoxPolymarketRedeemPosition`), the CLI signs with the user's EVM EOA, then submits via `polymarket_position_redeem`. This closes LABS-271 / SWA-1868 — Box can no longer trigger redemptions without an explicit per-action signature.
89
+
89
90
  ## Example flow
90
91
 
91
92
  ```bash
92
93
  # 1. Find
93
- mp prediction-market market search --provider polymarket --query "bitcoin 200k"
94
+ mp prediction-market event search --provider polymarket --query "bitcoin 200k"
94
95
 
95
- # 2. Drill into the event
96
- mp prediction-market market event retrieve --provider polymarket --slug <slug-from-search>
96
+ # 2. Drill into the event — current prices, bid/ask, volume all inline
97
+ mp prediction-market event retrieve --provider polymarket --slug <slug-from-search>
97
98
 
98
99
  # 3. Sanity-check the chart
99
- mp prediction-market market price-history list --provider polymarket --tokenId <yes-token-id> --interval 1w
100
+ mp prediction-market market ohlcv list --provider polymarket --tokenId <yes-outcome-id> --interval 1w
100
101
 
101
- # 4. Buy 50 YES at 40¢
102
- mp prediction-market position buy --wallet main --provider polymarket --tokenId <yes-token-id> --price 0.40 --size 50
102
+ # 4. Buy 50 YES at up to 40¢ (worst case $20 pUSD)
103
+ mp prediction-market position buy --wallet main --provider polymarket --tokenId <yes-outcome-id> --price 0.40 --size 50
103
104
 
104
105
  # 5. Confirm
105
106
  mp prediction-market position list --provider polymarket --wallet <address>
106
107
 
107
- # 6. Exit later at 60¢
108
- mp prediction-market position sell --wallet main --provider polymarket --tokenId <yes-token-id> --price 0.60 --size 50
108
+ # 6. Exit later at market price
109
+ mp prediction-market position sell --wallet main --provider polymarket --marketId <market-id> --outcomeId <yes-outcome-id> --size 50
109
110
  ```
110
111
 
111
112
  ## Price-history intervals
@@ -121,22 +122,18 @@ mp prediction-market position sell --wallet main --provider polymarket --tokenId
121
122
  ## Tips
122
123
 
123
124
  - Use `mp --json prediction-market ...` for programmatic output (the `--json` flag is global, BEFORE the subcommand).
124
- - Markets with higher volume have tighter spreads — check the `volume24h` field.
125
- - Verify `acceptingOrders: true` before trading; closed markets reject orders.
126
- - Polymarket = Polygon = USDC.e. NOT regular USDC. Bridging USDC → USDC.e is a separate step.
125
+ - Markets with higher volume have tighter spreads — check `marketData.volume['24h']`.
126
+ - Verify `status: "open"` before trading; closed/resolved markets reject orders.
127
+ - Polymarket = Polygon = **pUSD** (`0xc011a7e12a19f7b1f670d46f03b03f3342e82dfb`). NOT regular USDC, NOT USDC.e.
128
+ - $1 minimum per order.
127
129
  - A few cents of POL is enough for hundreds of trades.
128
130
 
129
- ## When to choose Polymarket vs Kalshi
130
-
131
- - **Polymarket** — politics, crypto, news, world events. Largest catalog, deepest liquidity.
132
- - **Kalshi** — sports, economic indicators, US-regulated events. Settles in regular USDC on Solana, no bridging required.
133
-
134
131
  ## Related skills
135
132
 
136
- - **moonpay-polymarket-feeds** — read-only data surface (search, event details, prices, history). Reach for this BEFORE web search when an agent needs Polymarket data
137
- - **moonpay-polymarket-strategy** — applied trading playbooks (mispricing detection, momentum, mean-reversion, catalyst confirmation) that compose feeds + buy/sell
138
- - **moonpay-kalshi** — sports + US-regulated markets on Solana
139
- - **moonpay-fund-polymarket** — fund USDC.e + POL on Polygon
133
+ - **moonpay-prediction-market** — venue chooser (Polymarket vs Kalshi)
134
+ - **moonpay-polymarket-feeds** — read-only data surface
135
+ - **moonpay-polymarket-strategy** — trading playbooks
136
+ - **moonpay-fund-polymarket** — fund pUSD + POL on Polygon
140
137
  - **moonpay-check-wallet** — check Polygon balances
141
- - **moonpay-swap-tokens** — bridge USDC → USDC.e on Polygon
138
+ - **moonpay-swap-tokens** — bridge USDC → pUSD on Polygon
142
139
  - **moonpay-trading-automation** — automate prediction-market strategies
@@ -14,33 +14,33 @@ This skill is **infrastructure knowledge** — what endpoints exist and how to u
14
14
 
15
15
  | Need | Command |
16
16
  |---|---|
17
- | Search markets by keyword / tag | `mp prediction-market market search --provider polymarket --query "..."` |
18
- | Trending markets (24h volume) | `mp prediction-market market trending list --provider polymarket --limit 10` |
19
- | Browse categories | `mp prediction-market market tag list --provider polymarket` |
20
- | Full event details (every sub-market, every outcome, best bid/ask) | `mp prediction-market market event retrieve --provider polymarket --slug <event-slug>` |
21
- | Current price for one outcome | `mp prediction-market market price retrieve --provider polymarket --tokenId <id>` |
22
- | Historical price series | `mp prediction-market market price history list --provider polymarket --tokenId <id> --interval <1hr\|1d\|1w\|1m\|max>` |
17
+ | Search events by keyword / tag | `mp prediction-market event search --provider polymarket --query "..." --tagIds <id1,id2>` |
18
+ | Full event details (every sub-market, every outcome, current price + bid/ask + volume + liquidity) | `mp prediction-market event retrieve --provider polymarket --slug <event-slug>` |
19
+ | Historical price series (OHLCV) | `mp prediction-market market ohlcv list --provider polymarket --tokenId <outcome-id> --interval <1hr\|1d\|1w\|1m\|max>` |
20
+
21
+ Current spot prices and bid/ask live INLINE on `event_retrieve.markets[].outcomes[]` no separate price-retrieve call.
23
22
 
24
23
  ## Reading the event response
25
24
 
26
- `market event retrieve` is the highest-leverage call. One round-trip gives you:
25
+ `event retrieve` is the highest-leverage call. One round-trip gives you:
27
26
 
28
27
  - The event metadata (slug, title, end date, total volume)
29
28
  - Every sub-market under the event (e.g., for an NFL game: "Bears moneyline," "Bears -3.5 spread," "Total over 47.5")
30
- - For each sub-market: the outcome tokens (`outcomeTokens[]`), each with:
31
- - `tokenId` — what you pass to `price retrieve` / `position buy`
32
- - `name` (e.g. "Yes" / "No")
33
- - `bestBid` / `bestAsk` top of book
34
- - `lastTradePrice`
35
- - `volume24h`
36
- - `acceptingOrders` — gate before any buy
29
+ - For each sub-market: `outcomes[]`, each with:
30
+ - `id` — what you pass to `position buy` (as `outcomeId`) or `market ohlcv list` (as `tokenId`)
31
+ - `label` (e.g. "Yes" / "No")
32
+ - `price` — current spot
33
+ - `bid` / `ask` — top of book
34
+ - `marketData.volume['24h']` — 24h volume
35
+ - `marketData.liquidity` — available liquidity
36
+ - `status` (`"open" | "closed" | "resolved"`) — gate before any buy; only `"open"` accepts orders
37
37
 
38
- For most strategies, this single call replaces 5+ individual price-retrieve calls. Use it as the entry point.
38
+ For most strategies, this single call replaces multiple individual calls. Use it as the entry point.
39
39
 
40
40
  ## Reading price history
41
41
 
42
42
  ```bash
43
- mp prediction-market market price history list --provider polymarket --tokenId <id> --interval 1w
43
+ mp prediction-market market ohlcv list --provider polymarket --tokenId <outcome-id> --interval 1w
44
44
  ```
45
45
 
46
46
  Interval options:
@@ -63,11 +63,12 @@ These would be net new `mp` commands. The agent should **not** invent them — s
63
63
 
64
64
  | Want | Status | Workaround |
65
65
  |---|---|---|
66
- | **Order-book depth** (full bid/ask ladder, not just best) | Not wrapped | `bestBid` / `bestAsk` from `market event retrieve` is the full picture today |
67
- | **Public trade tape** (every fill across all users on a market) | Not wrapped | Workaround: `lastTradePrice` from event retrieve, plus polled price-history at `1hr`, gives a coarse approximation |
68
- | **WebSocket / streaming** (live book diffs, live fills) | Not wrapped | Poll `market event retrieve` on a 5-30s interval inside an automation. The data is fresh enough for non-HFT strategies |
69
- | **Subgraph queries** (historical positions, splits, redemptions per wallet) | Not wrapped | `mp prediction-market activity list --wallet <addr>` covers user-scoped history; no public-by-wallet lookup yet |
70
- | **Aggregate market stats** (open interest, daily volume by tag, top movers) | Not wrapped | `trending list` covers top-by-volume; the rest needs a custom command |
66
+ | **Order-book depth** (full bid/ask ladder, not just best) | Not wrapped | `outcomes[].bid` / `outcomes[].ask` from `event retrieve` is best-of-book only |
67
+ | **Public trade tape** (every fill across all users on a market) | Not wrapped | Workaround: `outcomes[].price` from event retrieve, plus polled price-history at `1hr`, gives a coarse approximation |
68
+ | **WebSocket / streaming** (live book diffs, live fills) | Not wrapped | Poll `event retrieve` on a 5-30s interval inside an automation. The data is fresh enough for non-HFT strategies |
69
+ | **Subgraph queries** (historical positions, splits, redemptions per wallet) | Not wrapped | `mp prediction-market position list --status closed --wallet <addr>` covers user-scoped redeemed history; no public-by-wallet lookup yet |
70
+ | **Trending / volume-sorted discovery** | Not wrapped | Was dropped in v2 paginate `event search` and sort client-side by `marketData.volume['24h']` |
71
+ | **Aggregate market stats** (open interest, daily volume by tag, top movers) | Not wrapped | Not exposed today; would need a custom command |
71
72
 
72
73
  When the agent needs one of these and it isn't wrapped, the right answer is:
73
74
 
@@ -79,22 +80,22 @@ Don't reach for web search or raw HTTP for Polymarket data when one of the exist
79
80
 
80
81
  For strategies that fire every 5 min (or faster), don't re-pull the same event details on every fire. Use the resumed chat session memory:
81
82
 
82
- 1. First fire: pull `market event retrieve`, extract `outcomeTokens[]`, persist `tokenId` + `slug` + `endDate` in memory.
83
- 2. Subsequent fires: only call `market price retrieve --tokenId <cached-id>`. Don't re-pull the event details unless the market structure changed (rare).
84
- 3. If the market has resolved (current time > endDate), check `market event retrieve` once to confirm and stop the strategy.
83
+ 1. First fire: pull `event retrieve`, extract `outcomes[]`, persist `outcome.id` + `slug` + `endsAt` in memory.
84
+ 2. Subsequent fires: re-pull `event retrieve` only if you need fresh prices the same call returns updated bid/ask/price. No separate price endpoint to hit.
85
+ 3. If the market has resolved (current time > `endsAt` OR `status === "resolved"`), confirm via one `event retrieve` and stop the strategy.
85
86
 
86
87
  This keeps the agent fast and stays well under any rate limits.
87
88
 
88
89
  ## Tips
89
90
 
90
- - `--json` is a global flag, placed BEFORE the subcommand: `mp --json prediction-market market event retrieve ...`
91
- - Polymarket markets are EVM tokens on Polygon — `tokenId` is a long decimal string, NOT a regular UUID. Treat as opaque.
92
- - `negRisk` markets (multi-outcome events) split price math differently for any odds-based strategy, check the `negRisk` flag and document the assumption.
93
- - Polymarket settles in **USDC.e** on Polygon, NOT regular USDC. If you need to compute USD position values, treat USDC.e as $1.
91
+ - `--json` is a global flag, placed BEFORE the subcommand: `mp --json prediction-market event retrieve ...`
92
+ - Polymarket markets are EVM tokens on Polygon — `outcome.id` is a long decimal string, NOT a regular UUID. Treat as opaque, round-trip unchanged.
93
+ - The unified output strips venue-specific noise — no `negRisk`, `tickSize`, `conditionId`, or `outcomeTokens[]` fields. If you need those for low-level Polymarket-API work, call Gamma directly.
94
+ - Polymarket settles in **pUSD** on Polygon (Polymarket USD, `0xc011a7e12a19f7b1f670d46f03b03f3342e82dfb`, 1:1 USDC-backed), NOT regular USDC and NOT USDC.e. If you need to compute USD position values, treat pUSD as $1.
94
95
 
95
96
  ## Related skills
96
97
 
97
98
  - **moonpay-polymarket** — venue overview + buy/sell + position management
98
99
  - **moonpay-polymarket-strategy** — applied strategies that compose these feeds (mispricing detection, momentum, mean-reversion, catalyst confirmation)
99
100
  - **moonpay-prediction-market** — venue chooser (Polymarket vs Kalshi)
100
- - **moonpay-fund-polymarket** — bridging USDC → USDC.e on Polygon
101
+ - **moonpay-fund-polymarket** — bridging USDC → pUSD on Polygon
@@ -14,8 +14,8 @@ Each strategy below is intentionally small + composable. Pick one. Don't run thr
14
14
 
15
15
  - **Sample cadence**: 5 minutes for fast markets (sports during games, breaking news), 15 minutes for slower ones (politics, monthly macro). The agent's chat session holds state between fires — no `state.json` file needed.
16
16
  - **Sizing**: default $10 / position. Cap any single open position at 5% of the strategy bankroll. Strategies should ask the user for bankroll on first run.
17
- - **Entry guard**: never trade if `acceptingOrders === false` on the target market.
18
- - **Slippage cap**: skip if `(bestAsk - bestBid) / bestAsk > 0.05` (>5% spread = illiquid, get out).
17
+ - **Entry guard**: never trade if `status !== "open"` on the target market.
18
+ - **Slippage cap**: skip if `(outcomes[].ask - outcomes[].bid) / outcomes[].ask > 0.05` (>5% spread = illiquid, get out).
19
19
  - **Memory keys**: `bankroll`, `entry_price`, `entry_size`, `entry_at`, `position_open`, `target`, `stop`, `last_seen_price`, `last_action_at`.
20
20
 
21
21
  The **moonpay-trailing-stop**, **moonpay-take-profit-ladder**, and **moonpay-buy-the-dip** skills all already implement these patterns for spot tokens — same defaults, same memory shape, just different math. Borrow from them.
@@ -26,9 +26,9 @@ The **moonpay-trailing-stop**, **moonpay-take-profit-ladder**, and **moonpay-buy
26
26
 
27
27
  **Loop (every 15 min):**
28
28
 
29
- 1. Pull trending markets: `mp prediction-market market trending list --provider polymarket --limit 20`.
29
+ 1. Pull trending markets: `mp prediction-market event search --provider polymarket --query "*" --limit 20`.
30
30
  2. Filter to high-volume (`volume24h > $50k`) and active (`endDate > now + 24h`).
31
- 3. For each candidate, pull `market event retrieve` once and remember `(tokenId, lastTradePrice, bestAsk)`.
31
+ 3. For each candidate, pull `event retrieve` once and remember `(outcomeId, price, ask)`.
32
32
  4. Cross-reference with web search for last-hour news on the event topic.
33
33
  5. **Flag, don't trade.** Surface candidates as: market question, current YES odds, news headline, why they look mispriced.
34
34
  6. Use chat memory to skip markets you've already flagged this week unless the price has moved >10pp since the flag.
@@ -41,9 +41,9 @@ This is the catalyst-trader template's core. It's a research strategy — it sou
41
41
 
42
42
  **Loop (every 5 min):**
43
43
 
44
- 1. Pull `market price history list --tokenId <id> --interval 1hr`.
44
+ 1. Pull `market ohlcv list --tokenId <id> --interval 1hr`.
45
45
  2. Compute the last-15-minute price velocity (price now − price 3 buckets ago).
46
- 3. **Entry rule:** if velocity > +0.05 (5pp move in 15 min) AND volume confirms (compare `volume24h` vs the 7d average from a wider price-history pull), open a YES position at `bestAsk + 0.01` (1pp above best ask, taker-style).
46
+ 3. **Entry rule:** if velocity > +0.05 (5pp move in 15 min) AND volume confirms (compare `marketData.volume["24h"]` vs the 7d average from a wider price-history pull), open a YES position at `outcomes[].ask + 0.01` (1pp above best ask, taker-style).
47
47
  4. Persist entry price and timestamp in memory.
48
48
  5. **Exit rule (combine with mean-reversion below or trailing stop):** `moonpay-trailing-stop` skill, with trailing % set to 8% of the entry price.
49
49
 
@@ -55,9 +55,9 @@ This is the catalyst-trader template's core. It's a research strategy — it sou
55
55
 
56
56
  **Loop (every 5 min):**
57
57
 
58
- 1. Pull current price for your `tokenId`.
58
+ 1. Pull `event retrieve` for the current price of your `outcomeId`.
59
59
  2. Update high-water-mark (HWM) in memory.
60
- 3. **Exit rule:** if current price < HWM × 0.93 (-7% from peak) AND HWM > entry_price × 1.10 (you're already up 10% from entry), sell the entire position at `bestBid - 0.01`.
60
+ 3. **Exit rule:** if current price < HWM × 0.93 (-7% from peak) AND HWM > entry_price × 1.10 (you're already up 10% from entry), sell the entire position at `outcomes[].bid - 0.01`.
61
61
  4. Mark the position closed and stop the strategy.
62
62
 
63
63
  This is a take-profit, not a stop-loss — the entry condition (`HWM > entry × 1.10`) gates it on already being profitable. For pure stop-loss, use **moonpay-trailing-stop** directly.
@@ -68,11 +68,11 @@ This is a take-profit, not a stop-loss — the entry condition (`HWM > entry ×
68
68
 
69
69
  **Loop (every 5 min in the catalyst window):**
70
70
 
71
- 1. Pull `market event retrieve` for the target event.
71
+ 1. Pull `event retrieve` for the target event.
72
72
  2. Cross-reference real-time data:
73
73
  - For elections / votes: web search for "race called" / "AP projects" / official tally
74
74
  - For sports: web search for "final score" / time remaining
75
- 3. **Entry rule:** if the news strongly implies one outcome (e.g., race called) AND the market is still pricing < 0.95, BUY that outcome at `bestAsk` (or up to 0.92, whichever is lower).
75
+ 3. **Entry rule:** if the news strongly implies one outcome (e.g., race called) AND the market is still pricing < 0.95, BUY that outcome at `outcomes[].ask` (or up to 0.92, whichever is lower).
76
76
  4. **Exit:** hold to resolution. Each share resolves to $1, profit = (1 − entry_price) × shares.
77
77
  5. **Bail rule:** if it's been 30 min since the news call and the market hasn't moved past 0.85, the news might be wrong or the market knows something — exit at break-even or better.
78
78
 
@@ -84,7 +84,7 @@ This is the certainty-arbitrage template's core. It's high-conviction, short-dur
84
84
 
85
85
  **Status:** can't do today — needs full order-book depth (`market book retrieve`), which we don't wrap yet.
86
86
 
87
- **Workaround:** use `market event retrieve`'s `bestBid`/`bestAsk` per outcome to estimate, but the depth matters here — don't trade on it without the real ladder.
87
+ **Workaround:** use `event retrieve`'s `outcomes[].bid`/`outcomes[].ask` per outcome to estimate, but the depth matters here — don't trade on it without the real ladder.
88
88
 
89
89
  This is documented as a placeholder so a future PR knows what command to add and why.
90
90
 
@@ -100,10 +100,10 @@ When adding a new template, pick a strategy here, set the defaults, and write th
100
100
 
101
101
  ## Hard rules
102
102
 
103
- - Never run two strategies on the same `tokenId` simultaneously. They will fight each other.
103
+ - Never run two strategies on the same `outcomeId` simultaneously. They will fight each other.
104
104
  - Strategies must persist `position_open` in memory. On every fire, that's the FIRST thing to check.
105
105
  - After any sell that closes a position, stop the strategy. Don't auto-reopen — the user explicitly asks if they want another.
106
- - Sizing math is in USDC.e (Polygon's USDC). 1 USDC.e ≈ 1 USD; treat as $1.
106
+ - Sizing math is in pUSD (Polymarket USD on Polygon, 1:1 USDC-backed). 1 pUSD ≈ 1 USD; treat as $1.
107
107
  - Never override an exit rule because "it'll come back." That's the whole point of mechanical execution.
108
108
 
109
109
  ## Related skills
@@ -111,5 +111,5 @@ When adding a new template, pick a strategy here, set the defaults, and write th
111
111
  - **moonpay-polymarket-feeds** — read-only data surface (REQUIRED reading before this skill)
112
112
  - **moonpay-polymarket** — venue commands (buy / sell / register / positions)
113
113
  - **moonpay-trailing-stop** / **moonpay-take-profit-ladder** / **moonpay-buy-the-dip** — companion patterns for spot tokens; same memory shape
114
- - **moonpay-fund-polymarket** — bridging USDC → USDC.e
114
+ - **moonpay-fund-polymarket** — bridging USDC → pUSD on Polygon
115
115
  - **moonpay-trading-automation** — general headless automation patterns (cron / launchd)
@@ -11,11 +11,11 @@ Two venues. Different chains, different specialties. Pick by topic.
11
11
  | | Polymarket | Kalshi |
12
12
  |---|---|---|
13
13
  | Chain | Polygon | Solana |
14
- | Settles in | USDC.e | USDC |
15
- | Bridging needed? | Yes (USDC → USDC.e) | No |
14
+ | Settles in | pUSD (Polymarket USD) | USDC |
15
+ | Bridging needed? | Yes (USDC → pUSD on Polygon) | No |
16
16
  | Strong on | politics, crypto, news, world events | sports (NBA, NFL, MLB), macro, US-regulated |
17
17
  | Liquidity | largest catalog | growing fast on sports |
18
- | Min order | none enforced | `size × price` must be ≥ $1 |
18
+ | Min order | $1 minimum per order | `size × price` must be ≥ $1 |
19
19
 
20
20
  ## Pick a venue
21
21
 
@@ -27,7 +27,7 @@ Default routing rules — read first, then defer to the venue's skill:
27
27
  - User mentions **Bitcoin price target, crypto event, ETF approval** → **moonpay-polymarket**
28
28
  - User mentions **Polymarket** explicitly → **moonpay-polymarket**
29
29
  - User mentions **Kalshi** explicitly → **moonpay-kalshi**
30
- - Venue-agnostic ask ("what's spicy on prediction markets?") → check both with `mp prediction-market market trending list`, surface highlights
30
+ - Venue-agnostic ask ("what's spicy on prediction markets?") → check both with `mp prediction-market event search`, surface highlights
31
31
 
32
32
  ## Cross-venue commands
33
33
 
@@ -35,18 +35,14 @@ A few things are venue-shape-identical (the `--provider` flag picks):
35
35
 
36
36
  ```bash
37
37
  # Trending across either venue
38
- mp prediction-market market trending list --provider polymarket --limit 10
39
- mp prediction-market market trending list --provider kalshi --limit 10
40
38
 
41
39
  # Search across either venue
42
- mp prediction-market market search --provider polymarket --query "..."
43
- mp prediction-market market search --provider kalshi --query "..."
40
+ mp prediction-market event search --provider polymarket --query "..."
41
+ mp prediction-market event search --provider kalshi --query "..."
44
42
 
45
- # Position list / PnL / trades / activity (per-venue, same shape)
43
+ # Position list (per-venue, same shape)
46
44
  mp prediction-market position list --provider <venue> --wallet <addr>
47
- mp prediction-market pnl retrieve --provider <venue> --wallet <addr>
48
- mp prediction-market trade list --provider <venue> --wallet <addr>
49
- mp prediction-market activity list --provider <venue> --wallet <addr>
45
+ mp prediction-market position list --provider <venue> --wallet <addr> --status closed
50
46
  ```
51
47
 
52
48
  The actual buy/sell flow + funding requirements diverge — read **moonpay-polymarket** or **moonpay-kalshi** for the venue-specific recipe.
@@ -54,13 +50,13 @@ The actual buy/sell flow + funding requirements diverge — read **moonpay-polym
54
50
  ## Tips
55
51
 
56
52
  - `--json` is a global flag, BEFORE the subcommand.
57
- - `acceptingOrders: true` must be present before any buy — closed markets reject orders.
58
- - Don't fund Polymarket with regular USDC — it's USDC.e on Polygon (a different mint). See **moonpay-fund-polymarket**.
59
- - Kalshi's $1 minimum: 1 share at 30¢ won't fill; 4 shares at 30¢ ($1.20) will.
53
+ - `status === "open"` must hold before any buy — closed/resolved markets reject orders.
54
+ - Don't fund Polymarket with regular USDC — it's pUSD on Polygon (a different mint, Polymarket-issued, 1:1 USDC-backed). See **moonpay-fund-polymarket**.
55
+ - Polymarket and Kalshi both enforce a $1 minimum order: 1 share at 30¢ won't fill; 4 shares at 30¢ ($1.20) will.
60
56
 
61
57
  ## Related skills
62
58
 
63
59
  - **moonpay-polymarket** — full Polymarket trading workflow
64
60
  - **moonpay-kalshi** — full Kalshi trading workflow
65
- - **moonpay-fund-polymarket** — fund USDC.e + POL on Polygon
61
+ - **moonpay-fund-polymarket** — fund pUSD + POL on Polygon
66
62
  - **moonpay-check-wallet** — check positions across chains