@moonpay/cli 1.0.1 → 1.1.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.
- package/dist/{chunk-NOBCV3XS.js → chunk-652MWD3Z.js} +1 -1
- package/dist/chunk-S3Q54OLJ.js +33 -0
- package/dist/index.js +2 -2
- package/dist/{mcp-TYPKPFL3.js → mcp-EV6CWYRZ.js} +1 -1
- package/dist/{store-Y2RKC4CG.js → store-LYXJI4J6.js} +1 -1
- package/package.json +1 -1
- package/skills/moonpay-check-wallet/SKILL.md +4 -1
- package/skills/moonpay-fund-polymarket/SKILL.md +24 -1
- package/skills/moonpay-missions/SKILL.md +28 -4
- package/skills/moonpay-prediction-market/SKILL.md +157 -0
- package/dist/chunk-3BX6JCWH.js +0 -33
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
3
|
-
import{a as R,b as S,c as T,d as j,e as k}from"./chunk-
|
|
3
|
+
import{a as R,b as S,c as T,d as j,e as k}from"./chunk-S3Q54OLJ.js";import{a as C,c as Y,i as A,m as H,u as J}from"./chunk-652MWD3Z.js";import{g as v}from"./chunk-XJWHTFJ5.js";import"./chunk-LMDE72OE.js";H();import{Command as re}from"commander";var z=!process.env.NO_COLOR&&process.stdout.isTTY===!0;function $(e){return t=>z?`${e}${t}\x1B[0m`:t}var p={bold:$("\x1B[1m"),dim:$("\x1B[2m"),green:$("\x1B[32m"),yellow:$("\x1B[33m"),cyan:$("\x1B[36m"),red:$("\x1B[31m")};function O(e){if(e==null)return!0;let t=typeof e;return t==="string"||t==="number"||t==="boolean"}function _(e){return e==null?"-":String(e)}function N(e,t=0){let n=" ".repeat(t);return O(e)?`${n}${_(e)}`:Array.isArray(e)?e.length===0?`${n}${p.dim("(empty)")}`:e.every(O)?e.map(r=>`${n}- ${_(r)}`).join(`
|
|
4
4
|
`):e.map(r=>{if(typeof r!="object"||r===null)return`${n}- ${_(r)}`;let o=Object.entries(r),a=[],[c,f]=o[0];O(f)?a.push(`${n}- ${p.bold(c)}: ${_(f)}`):(a.push(`${n}- ${p.bold(c)}:`),a.push(N(f,t+2)));for(let[m,y]of o.slice(1))O(y)?a.push(`${n} ${p.bold(m)}: ${_(y)}`):(a.push(`${n} ${p.bold(m)}:`),a.push(N(y,t+2)));return a.join(`
|
|
5
5
|
`)}).join(`
|
|
6
6
|
|
|
@@ -14,5 +14,5 @@ ${N(a,t+1)}`).join(`
|
|
|
14
14
|
|
|
15
15
|
Run \`mp skill install\` to install AI skills for Claude Code.
|
|
16
16
|
|
|
17
|
-
`+T).version(C).option("--json","Output as JSON instead of YAML");function se(){return h.opts().json?"json":"yaml"}function D(e){console.log(F(e,se()))}function U(){let e=oe();e&&process.stderr.write(e)}h.command("mcp").description("Start MCP server over stdio (for Claude Desktop, Claude Code, etc.)").action(async()=>{let{startMcpServer:e}=await import("./mcp-
|
|
17
|
+
`+T).version(C).option("--json","Output as JSON instead of YAML");function se(){return h.opts().json?"json":"yaml"}function D(e){console.log(F(e,se()))}function U(){let e=oe();e&&process.stderr.write(e)}h.command("mcp").description("Start MCP server over stdio (for Claude Desktop, Claude Code, etc.)").action(async()=>{let{startMcpServer:e}=await import("./mcp-EV6CWYRZ.js");await e()});function M(e,t){let n=e;for(let r of t){let o=n.commands.find(a=>a.name()===r);o||(o=n.command(r)),n=o}return n}function Z(e,t=""){let n=[];for(let[r,o]of Object.entries(e)){let a=t?`${t}-${r}`:r,c=o;for(;c._def.typeName==="ZodEffects";)c=c._def.schema;let f=c;f._def.typeName==="ZodNullable"&&(f=f._def.innerType),f._def.typeName==="ZodObject"&&f.shape?n.push(...Z(f.shape,a)):n.push({flatKey:a,field:o,path:a.split("-")})}return n}function ie(e,t){let n={};for(let{flatKey:r,path:o}of t){let a=r.replace(/-([a-z])/g,(f,m)=>m.toUpperCase()),c=a in e?e[a]:e[r];if(o.length===1)n[o[0]]=c;else{let f=n;for(let m=0;m<o.length-1;m++)(!f[o[m]]||typeof f[o[m]]!="object")&&(f[o[m]]={}),f=f[o[m]];f[o[o.length-1]]=c}}return n}function ae(e,t){for(let n of t){let r=n.schema.name.split("_"),o=r.pop(),c=M(e,r).command(o).description(n.schema.description),f=n.schema.input.shape??{},m=Z(f),y=[],b=[],w=[];for(let{flatKey:u,field:i}of m){let s=i.description??u,l=i;for(;l._def.typeName==="ZodEffects";)l=l._def.schema;let g=l._def.typeName,d=l;d._def.typeName==="ZodNullable"&&(d=d._def.innerType),d._def.typeName==="ZodNumber"&&b.push(u),d._def.typeName==="ZodRecord"&&w.push(u),g==="ZodBoolean"?c.option(`--${u}`,s,!1):g==="ZodNullable"?(c.option(`--${u} <${u}>`,s),y.push(u)):c.requiredOption(`--${u} <${u}>`,s)}c.action(async u=>{n.schema.name.startsWith("consent_")||await j.handler({});for(let s of y){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());u[l]===void 0&&(u[l]=null)}for(let s of b){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());u[l]!=null&&typeof u[l]=="string"&&(u[l]=Number(u[l]))}for(let s of w){let l=s.replace(/-([a-z])/g,(g,d)=>d.toUpperCase());if(typeof u[l]=="string")try{u[l]=JSON.parse(u[l])}catch{console.error(`Invalid JSON for --${s}`),process.exit(1)}}let i=ie(u,m);try{let s=await n.handler(i);D(s)}catch(s){console.error(s.message),process.exit(1)}})}}function ce(e){if(e.$ref&&e.definitions){let t=e.$ref.replace("#/definitions/","");return e.definitions[t]}return e}function le(e){return Array.isArray(e.type)?e.type.includes("null"):e.anyOf?e.anyOf.some(t=>t.type==="null"):!1}function fe(e){return Array.isArray(e.type)?e.type.includes("object"):e.anyOf?e.anyOf.some(t=>t.type==="object"):e.type==="object"}function ue(e){return Array.isArray(e.type)?e.type.some(t=>t==="number"||t==="integer"):e.anyOf?e.anyOf.some(t=>t.type==="number"||t.type==="integer"):e.type==="number"||e.type==="integer"}function me(e){let t=e.wallet,n=e.chain;if(typeof t!="string"||typeof n!="string")return;let r=J(t);if(!r)return;let o=v[n];if(!o)return;let a=r.addresses[o];a&&(e.wallet=a)}var q=new Set(["swaps_transaction_build","token_transfer","transaction_register","virtual-account_offramp_initiate","prediction-market_position_buy","prediction-market_position_sell","commerce_cart_update","commerce_checkout_start","commerce_checkout_pay"]);function pe(e,t){for(let n of t){if(q.has(n.name))continue;let r=n.name.split("_"),o=r.pop(),a=M(e,r);if(a.commands.find(i=>i.name()===o))continue;let c=a.command(o).description(n.description),f=ce(n.inputSchema),m=f.properties??{},y=new Set(f.required??[]),b=[],w=[],u=[];for(let[i,s]of Object.entries(m)){let l=s.description??i,g=le(s),d=fe(s);ue(s)&&w.push(i),d?(u.push(i),y.has(i)&&!g?c.requiredOption(`--${i} <json>`,`${l} (as JSON)`):(c.option(`--${i} <json>`,`${l} (as JSON)`),b.push(i))):g||!y.has(i)?(c.option(`--${i} <${i}>`,l),b.push(i)):c.requiredOption(`--${i} <${i}>`,l)}c.action(async i=>{await j.handler({});for(let s of b)i[s]===void 0&&(i[s]=null);for(let s of w)i[s]!=null&&typeof i[s]=="string"&&(i[s]=Number(i[s]));for(let s of u)if(typeof i[s]=="string")try{i[s]=JSON.parse(i[s])}catch{console.error(`Invalid JSON for --${s}`),process.exit(1)}try{me(i);let s=A(),l=await R(s,n.name,i);D(l),U()}catch(s){console.error(s.message),process.exit(1)}})}}ae(h,k);pe(h,S);h.command("tools").description("List available tools").action(()=>{let e=[...k.map(n=>({name:n.schema.name,description:n.schema.description})),...S.filter(n=>!k.some(r=>r.schema.name===n.name)&&!q.has(n.name)).map(n=>({name:n.name,description:n.description}))].sort((n,r)=>n.name.localeCompare(r.name)),t=[];for(let n of e){let r=n.name.replace(/_/g," ");t.push(` ${p.green(r.padEnd(28))} ${p.dim(n.description)}`)}t.push(""),t.push(p.dim(`${e.length} tools`)),console.log(t.join(`
|
|
18
18
|
`)),U()});h.parse();
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{a as d,b as y,e as l}from"./chunk-
|
|
2
|
+
import{a as d,b as y,e as l}from"./chunk-S3Q54OLJ.js";import{a as u,c as x,i as f,m as N}from"./chunk-652MWD3Z.js";import"./chunk-XJWHTFJ5.js";import"./chunk-LMDE72OE.js";import{Server as T}from"@modelcontextprotocol/sdk/server/index.js";import{StdioServerTransport as v}from"@modelcontextprotocol/sdk/server/stdio.js";import{CallToolRequestSchema as q,ListToolsRequestSchema as A}from"@modelcontextprotocol/sdk/types.js";import{zodToJsonSchema as M}from"zod-to-json-schema";N();x();var h=new Map(l.map(s=>[s.schema.name,s]));function k(s){let n=s.inputSchema;if(n.$ref&&n.definitions){let c=n.$ref.replace("#/definitions/","");return n.definitions[c]??n}return n}async function _(){let s=new T({name:"moonpay",version:u},{capabilities:{tools:{listChanged:!0}}}),n=l.map(e=>({name:e.schema.name,description:e.schema.description,inputSchema:M(e.schema.input)})),c=new Map;for(let e of y){if(h.has(e.name))continue;let t=k(e);c.set(e.name,t.properties??{}),n.push({name:e.name,description:e.description,inputSchema:{type:"object",properties:t.properties??{},...t.required?{required:t.required}:{},...t.additionalProperties!==void 0?{additionalProperties:t.additionalProperties}:{}}})}let g=new Map(n.map(e=>[e.name,e]));s.setRequestHandler(A,async()=>({tools:n.map(e=>({name:e.name,description:e.description,inputSchema:e.inputSchema}))})),s.setRequestHandler(q,async e=>{let{name:t,arguments:o={}}=e.params;if(!g.has(t))return{content:[{type:"text",text:`Unknown tool: ${t}`}],isError:!0};try{let i=h.get(t);if(i){let p=i.schema.input.shape??{};for(let[m,a]of Object.entries(p))o[m]===void 0&&a._def.typeName==="ZodNullable"&&(o[m]=null);let r=await i.handler(o);return{content:[{type:"text",text:JSON.stringify(r,null,2)}]}}let b=c.get(t)??{};for(let[p,r]of Object.entries(b))o[p]===void 0&&(Array.isArray(r.type)?r.type.includes("null"):r.anyOf?.some(R=>R.type==="null"))&&(o[p]=null),(r.type==="number"||r.type==="integer"||Array.isArray(r.type)&&r.type.some(a=>a==="number"||a==="integer")||r.anyOf?.some(a=>a.type==="number"||a.type==="integer"))&&typeof o[p]=="string"&&(o[p]=Number(o[p]));let w=f(),O=await d(w,t,o);return{content:[{type:"text",text:JSON.stringify(O,null,2)}]}}catch(i){return{content:[{type:"text",text:i instanceof Error?i.message:String(i)}],isError:!0}}});let S=new v;await s.connect(S)}export{_ as startMcpServer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
process.noDeprecation = true; import { createRequire as __createRequire } from "module"; const require = __createRequire(import.meta.url);
|
|
2
|
-
import{A as n,B as o,C as p,D as q,E as r,F as s,G as t,H as u,I as v,n as a,o as b,p as c,q as d,r as e,s as f,t as g,u as h,v as i,w as j,x as k,y as l,z as m}from"./chunk-
|
|
2
|
+
import{A as n,B as o,C as p,D as q,E as r,F as s,G as t,H as u,I as v,n as a,o as b,p as c,q as d,r as e,s as f,t as g,u as h,v as i,w as j,x as k,y as l,z as m}from"./chunk-652MWD3Z.js";import"./chunk-XJWHTFJ5.js";import"./chunk-LMDE72OE.js";export{m as addHardwareWallet,t as addWallet,d as createWallet,j as deleteWallet,l as exportSecret,h as findWallet,i as findWalletOrThrow,a as getVaultPath,e as importMnemonic,f as importPrivateKey,g as listWallets,r as loadWallets,p as lwsSignMessage,o as lwsSignTransaction,c as migrateWallets,v as mutateWallets,n as refreshHardwareAddresses,s as removeWallet,k as renameWallet,b as requireMigrationCheck,q as resolveSigningKey,u as saveWallets};
|
package/package.json
CHANGED
|
@@ -26,7 +26,9 @@ mp wallet list
|
|
|
26
26
|
|
|
27
27
|
## Supported chains
|
|
28
28
|
|
|
29
|
-
`solana`, `ethereum`, `base`, `polygon`, `arbitrum`, `optimism`
|
|
29
|
+
`solana`, `ethereum`, `base`, `polygon`, `arbitrum`, `optimism`, `bnb`, `avalanche`, `tron`, `bitcoin`, `ton`
|
|
30
|
+
|
|
31
|
+
Bitcoin uses a separate command: `mp bitcoin balance retrieve --wallet <btc-address>`
|
|
30
32
|
|
|
31
33
|
## Workflow
|
|
32
34
|
|
|
@@ -55,3 +57,4 @@ Use `mp -f table token balance list ...` for a quick table view, or `mp -f json
|
|
|
55
57
|
|
|
56
58
|
- **moonpay-auth** — Set up wallets if none exist.
|
|
57
59
|
- **moonpay-discover-tokens** — Research specific tokens in the portfolio.
|
|
60
|
+
- **moonpay-prediction-market** — Check prediction market positions and PnL.
|
|
@@ -127,7 +127,29 @@ Confirm both POL and USDC.e are present.
|
|
|
127
127
|
|
|
128
128
|
### 7. Trade on Polymarket
|
|
129
129
|
|
|
130
|
-
Once funded,
|
|
130
|
+
Once funded, trade directly via MoonPay CLI:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Search markets
|
|
134
|
+
mp prediction-market market search --provider polymarket --query "bitcoin"
|
|
135
|
+
|
|
136
|
+
# Get trending markets
|
|
137
|
+
mp prediction-market market trending list --provider polymarket
|
|
138
|
+
|
|
139
|
+
# Register wallet (one-time)
|
|
140
|
+
mp prediction-market user create --provider polymarket --wallet <evm-address>
|
|
141
|
+
|
|
142
|
+
# Buy shares
|
|
143
|
+
mp prediction-market position buy --wallet main --provider polymarket --tokenId <token-id> --price 0.65 --size 100
|
|
144
|
+
|
|
145
|
+
# Check positions
|
|
146
|
+
mp prediction-market position list --provider polymarket --wallet <evm-address>
|
|
147
|
+
|
|
148
|
+
# Check PnL
|
|
149
|
+
mp prediction-market pnl retrieve --provider polymarket --wallet <evm-address>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Or use the Polymarket CLI for advanced order types:
|
|
131
153
|
|
|
132
154
|
```bash
|
|
133
155
|
polymarket markets search "query" # find markets
|
|
@@ -146,6 +168,7 @@ polymarket clob balance # check trading balance
|
|
|
146
168
|
|
|
147
169
|
## Related skills
|
|
148
170
|
|
|
171
|
+
- **moonpay-prediction-market** — Full prediction market trading guide
|
|
149
172
|
- **moonpay-swap-tokens** — Bridge commands and supported chains
|
|
150
173
|
- **moonpay-check-wallet** — Check Polygon balances
|
|
151
174
|
- **moonpay-buy-crypto** — Buy POL or ETH with fiat
|
|
@@ -105,15 +105,38 @@ mp virtual-account retrieve
|
|
|
105
105
|
|
|
106
106
|
If they have one, show the status and next step. If not, explain what it is and that they can set one up with `mp virtual-account create`.
|
|
107
107
|
|
|
108
|
-
## Mission 8:
|
|
108
|
+
## Mission 8: Prediction Markets
|
|
109
109
|
|
|
110
|
-
**Goal:**
|
|
110
|
+
**Goal:** Browse prediction markets and understand how they work.
|
|
111
111
|
|
|
112
112
|
```bash
|
|
113
|
+
mp prediction-market market trending list --provider polymarket --limit 5
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Pick an interesting market and get details:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
mp prediction-market market event retrieve --provider polymarket --slug <slug-from-trending>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Explain: prediction markets let you buy shares on outcomes. Price = implied probability. Shares pay $1 if the outcome resolves YES. Supports Polymarket (Polygon/USDC.e) and Kalshi (Solana/USDC).
|
|
123
|
+
|
|
124
|
+
## Mission 9: Skills
|
|
125
|
+
|
|
126
|
+
**Goal:** Show what skills are available and how to manage them.
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# List all bundled skills
|
|
113
130
|
mp skill list
|
|
131
|
+
|
|
132
|
+
# View a specific skill's instructions
|
|
133
|
+
mp skill retrieve --name moonpay-prediction-market
|
|
134
|
+
|
|
135
|
+
# Install all skills to Claude Code's skills directory
|
|
136
|
+
mp skill install
|
|
114
137
|
```
|
|
115
138
|
|
|
116
|
-
Explain: skills are guides that teach agents how to use the CLI.
|
|
139
|
+
Explain: skills are guides that teach agents how to use the CLI for specific tasks. `mp skill list` shows all available skills. `mp skill retrieve --name <skill>` shows the full instructions for a specific skill. `mp skill install` copies all skills to `~/.claude/skills/` so Claude Code loads them automatically.
|
|
117
140
|
|
|
118
141
|
## Debrief
|
|
119
142
|
|
|
@@ -125,6 +148,7 @@ Summarize everything:
|
|
|
125
148
|
- Generated a fiat buy link
|
|
126
149
|
- Signed a message for verification
|
|
127
150
|
- Explored virtual accounts
|
|
128
|
-
-
|
|
151
|
+
- Browsed prediction markets
|
|
152
|
+
- Discovered and installed skills
|
|
129
153
|
|
|
130
154
|
End with: "You're all set. Run `mp --help` to see all commands, or ask me anything."
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: moonpay-prediction-market
|
|
3
|
+
description: Trade on prediction markets (Polymarket, Kalshi). Search markets, buy/sell positions, track PnL, and view trade history.
|
|
4
|
+
tags: [trading, prediction-market, polymarket, kalshi]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Prediction markets
|
|
8
|
+
|
|
9
|
+
## Goal
|
|
10
|
+
|
|
11
|
+
Search prediction markets, buy and sell outcome shares, track positions and PnL.
|
|
12
|
+
|
|
13
|
+
Supports two providers:
|
|
14
|
+
- **Polymarket** — runs on Polygon (USDC.e). Requires an EVM wallet.
|
|
15
|
+
- **Kalshi** — runs on Solana (USDC). Requires a Solana wallet.
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
1. Authenticate: `mp login --email <email>` then `mp verify --email <email> --code <code>`
|
|
20
|
+
2. Have a local wallet: `mp wallet list` (create with `mp wallet create --name "main"` if needed)
|
|
21
|
+
3. Register your wallet with the provider (one-time setup):
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# For Polymarket (use your EVM/Polygon address)
|
|
25
|
+
mp prediction-market user create --provider polymarket --wallet <evm-address>
|
|
26
|
+
|
|
27
|
+
# For Kalshi (use your Solana address)
|
|
28
|
+
mp prediction-market user create --provider kalshi --wallet <solana-address>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
4. Fund the wallet — Polymarket needs USDC.e on Polygon, Kalshi needs USDC on Solana. See the **moonpay-fund-polymarket** or **moonpay-buy-crypto** skills.
|
|
32
|
+
|
|
33
|
+
## Browse and research markets
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Search markets by keyword
|
|
37
|
+
mp prediction-market market search --provider polymarket --query "bitcoin" --limit 10
|
|
38
|
+
|
|
39
|
+
# Get trending markets (sorted by 24h volume, min $150K)
|
|
40
|
+
mp prediction-market market trending list --provider polymarket --limit 10
|
|
41
|
+
|
|
42
|
+
# Browse market categories/tags
|
|
43
|
+
mp prediction-market market tag list --provider polymarket
|
|
44
|
+
|
|
45
|
+
# Filter markets by tag
|
|
46
|
+
mp prediction-market market search --provider polymarket --query "*" --tagIds "crypto,politics"
|
|
47
|
+
|
|
48
|
+
# Get full event details (all markets, outcomes, prices)
|
|
49
|
+
mp prediction-market market event retrieve --provider polymarket --slug <event-slug>
|
|
50
|
+
|
|
51
|
+
# Check current price for an outcome token
|
|
52
|
+
mp prediction-market market price retrieve --provider polymarket --tokenId <token-id>
|
|
53
|
+
|
|
54
|
+
# View price history for an outcome
|
|
55
|
+
mp prediction-market market price-history list --provider polymarket --tokenId <token-id> --interval 1w
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Buy and sell positions
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
# Buy shares of an outcome
|
|
62
|
+
mp prediction-market position buy \
|
|
63
|
+
--wallet main \
|
|
64
|
+
--provider polymarket \
|
|
65
|
+
--tokenId <outcome-token-id> \
|
|
66
|
+
--price 0.65 \
|
|
67
|
+
--size 100
|
|
68
|
+
|
|
69
|
+
# Sell shares
|
|
70
|
+
mp prediction-market position sell \
|
|
71
|
+
--wallet main \
|
|
72
|
+
--provider polymarket \
|
|
73
|
+
--tokenId <outcome-token-id> \
|
|
74
|
+
--price 0.70 \
|
|
75
|
+
--size 50
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Key concepts:**
|
|
79
|
+
- `tokenId` comes from `outcomeTokens[].tokenId` in market search results
|
|
80
|
+
- `price` is 0-1 (e.g., 0.65 = 65 cents per share, implies 65% probability)
|
|
81
|
+
- `size` is the number of shares
|
|
82
|
+
- Cost = price x size (e.g., 0.65 x 100 = $65 USDC)
|
|
83
|
+
- If the outcome resolves YES, each share pays $1. Profit = (1 - price) x size
|
|
84
|
+
|
|
85
|
+
## Track positions and performance
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# View open positions
|
|
89
|
+
mp prediction-market position list --provider polymarket --wallet <address>
|
|
90
|
+
|
|
91
|
+
# View closed positions
|
|
92
|
+
mp prediction-market position list --provider polymarket --wallet <address> --status closed
|
|
93
|
+
|
|
94
|
+
# Get PnL summary
|
|
95
|
+
mp prediction-market pnl retrieve --provider polymarket --wallet <address>
|
|
96
|
+
|
|
97
|
+
# View trade history
|
|
98
|
+
mp prediction-market trade list --provider polymarket --wallet <address>
|
|
99
|
+
|
|
100
|
+
# View all activity (trades, splits, merges, redemptions)
|
|
101
|
+
mp prediction-market activity list --provider polymarket --wallet <address>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Workflow
|
|
105
|
+
|
|
106
|
+
1. **Discover**: Search or browse trending markets.
|
|
107
|
+
2. **Research**: Get event details, check prices, review price history.
|
|
108
|
+
3. **Trade**: Buy shares on outcomes you believe are mispriced.
|
|
109
|
+
4. **Monitor**: Track positions and PnL.
|
|
110
|
+
5. **Exit**: Sell positions when your thesis changes, or wait for resolution.
|
|
111
|
+
|
|
112
|
+
## Example: trade a market
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# 1. Find a market
|
|
116
|
+
mp prediction-market market search --provider polymarket --query "bitcoin 100k"
|
|
117
|
+
|
|
118
|
+
# 2. Get event details (note the outcomeTokens)
|
|
119
|
+
mp prediction-market market event retrieve --provider polymarket --slug <slug-from-search>
|
|
120
|
+
|
|
121
|
+
# 3. Check price history
|
|
122
|
+
mp prediction-market market price-history list --provider polymarket --tokenId <yes-token-id> --interval 1w
|
|
123
|
+
|
|
124
|
+
# 4. Buy 50 "Yes" shares at 40 cents
|
|
125
|
+
mp prediction-market position buy --wallet main --provider polymarket --tokenId <yes-token-id> --price 0.40 --size 50
|
|
126
|
+
|
|
127
|
+
# 5. Check your position
|
|
128
|
+
mp prediction-market position list --provider polymarket --wallet <address>
|
|
129
|
+
|
|
130
|
+
# 6. Sell later at a higher price
|
|
131
|
+
mp prediction-market position sell --wallet main --provider polymarket --tokenId <yes-token-id> --price 0.60 --size 50
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Price history intervals
|
|
135
|
+
|
|
136
|
+
| Interval | Description |
|
|
137
|
+
|----------|-------------|
|
|
138
|
+
| `1hr` | Last hour |
|
|
139
|
+
| `1d` | Last day |
|
|
140
|
+
| `1w` | Last week |
|
|
141
|
+
| `1m` | Last month |
|
|
142
|
+
| `max` | All time |
|
|
143
|
+
|
|
144
|
+
## Tips
|
|
145
|
+
|
|
146
|
+
- Use `mp -f json prediction-market ...` for programmatic output
|
|
147
|
+
- Markets with higher volume and liquidity have tighter spreads
|
|
148
|
+
- Check `acceptingOrders` — closed markets cannot be traded
|
|
149
|
+
- `negRisk` markets use a different settlement framework — the CLI handles this automatically
|
|
150
|
+
- Polymarket uses USDC.e on Polygon; Kalshi uses USDC on Solana
|
|
151
|
+
|
|
152
|
+
## Related skills
|
|
153
|
+
|
|
154
|
+
- **moonpay-fund-polymarket** — Fund your Polymarket wallet with USDC.e and POL
|
|
155
|
+
- **moonpay-check-wallet** — Check Polygon/Solana balances
|
|
156
|
+
- **moonpay-swap-tokens** — Bridge tokens to Polygon
|
|
157
|
+
- **moonpay-trading-automation** — Automate trading strategies
|