预测市场 API
通过 Predexon 获取实时预测市场数据。58 个端点,分 11 组:Polymarket (29)、体育 (4)、跨平台 (6)、Kalshi (3)、Binance (2)、dFlow (3)、钱包身份 (3)、UMA Oracle (2)、Limitless (2)、Opinion (2)、Predict.Fun (2)。
基础 URL: https://api.jarvisclaw.ai/v1/marketplace/prediction
https://api.jarvisclaw.ai/v1/prediction/… 是等价别名 —— 路径相同,计费相同。
服务 ID 是 prediction
不是 predexon。使用 predexon 会返回 404 service 'predexon' not found。
认证
两种方式均支持,所有请求都通过 x402 链上结算:
| 方式 | Header | 描述 |
|---|---|---|
| API Key | Authorization: Bearer sk-... | 平台自动从你的 HD 钱包签名 x402 |
| 私钥 (x402) | SDK 自动处理 | Agent 直接用自己的钱包签名 x402 |
详见 Agent 支付 (x402)。
定价
下表为每次调用的参考价。精确扣费金额请读每次响应中的 price.amount。
| 端点 | 价格 |
|---|---|
| 大部分 GET(Polymarket、Kalshi、Binance candles/ticks、体育、Limitless、Opinion、Predict.Fun、UMA) | $0.001 |
GET /dflow/wallet/*、GET /polymarket/wallet/*、GET /binance/*、GET /pairs、GET /arbitrage、GET /correlation、GET /compare | $0.005 |
GET /dflow/trades、GET /matching-markets、GET /markets/search | $0.0095 |
POST /polymarket/wallet/identities | $0.0095 |
| 其他 POST | $0.005 |
四个端点已上调价格
/dflow/trades、/matching-markets、/markets/search 和 POST /polymarket/wallet/identities 此前标价 $0.001–$0.005,现已统一为 $0.0095。旧文档和缓存的价目表可能仍显示低价。
全部端点(58 个)
下列路径均相对于基础 URL。其中 3 个需要上游存在特定市场数据才会返回内容,已标注。
Polymarket(29 个)
| 端点 | 描述 |
|---|---|
| GET /polymarket/markets | 市场列表(?sort=volume&limit=50) |
| GET /polymarket/markets/keyset | keyset 分页市场列表(?pagination_key=) |
| GET /polymarket/events | 事件列表(?status=open&limit=20) |
| GET /polymarket/events/keyset | keyset 分页事件列表 |
| GET /polymarket/crypto-updown | 加密涨跌类市场 |
| GET /polymarket/market-price/:token_id | 单个代币当前价格 |
| GET /polymarket/candlesticks/:condition_id | 按 condition 的 K 线 |
| GET /polymarket/candlesticks/token/:token_id | 按 token 的 K 线 (需该 token 有交易历史) |
| GET /polymarket/volume-chart/:condition_id | 成交量曲线(?start_time=&end_time=) |
| GET /polymarket/orderbooks | 订单簿快照(?token_id=&start_time=&end_time=) |
| GET /polymarket/trades | 交易列表(?condition_id=) |
| GET /polymarket/activity | 钱包活动流(?wallet=) |
| GET /polymarket/markets/:token_id/volume | 单个 token 成交量 |
| GET /polymarket/markets/:condition_id/open_interest | 单个市场未平仓量 |
| GET /polymarket/positions | 持仓列表 |
| GET /polymarket/leaderboard | 交易者排行(?limit=100&sort_by=total_pnl) |
| GET /polymarket/leaderboard/market/:condition_id | 单市场排行 |
| GET /polymarket/cohorts/stats | 交易者分群统计 |
| GET /polymarket/market/:condition_id/top-holders | 市场最大持仓者 |
| GET /polymarket/market/:condition_id/smart-money | 聪明钱持仓(?min_total_pnl=) |
| GET /polymarket/markets/smart-activity | 跨市场聪明钱活动 |
| GET /polymarket/wallet/:wallet | 钱包概览 |
| GET /polymarket/wallet/:wallet/markets | 该钱包交易过的市场 |
| GET /polymarket/wallet/:wallet/similar | 行为相似的钱包 |
| GET /polymarket/wallet/pnl/:wallet | 钱包盈亏(?granularity=day) |
| GET /polymarket/wallet/positions/:wallet | 钱包持仓 |
| GET /polymarket/wallet/volume-chart/:wallet | 钱包成交量曲线 |
| GET /polymarket/wallets/profiles | 钱包画像列表 |
| GET /polymarket/wallets/filter | 按条件筛选钱包 |
smart-money 至少需要传一个筛选参数且不低于阈值:min_realized_pnl ≥ 1000、 min_total_pnl ≥ 1000、min_roi ≥ 0.15、min_trades ≥ 100、min_volume ≥ 10000。
体育(4 个)
| 端点 | 描述 |
|---|---|
| GET /sports/categories | 支持的运动类别 |
| GET /sports/markets | 体育市场(?category=baseball) |
| GET /sports/markets/:game_id | 单场赛事的市场(如 mlb-ari-wsh-2026-06-06) |
| GET /sports/outcomes/:predexon_id | 按 Predexon ID 查结果(如 px-jdtq5b6...) |
跨平台(6 个)
| 端点 | 描述 |
|---|---|
| GET /matching-markets | 跨平台匹配单个市场 (需该市场已被纳入匹配库) |
| GET /matching-markets/pairs | 全部已知跨平台配对 |
| GET /markets/search | 跨平台关键词搜索(?q=bitcoin) |
| GET /markets | 统一市场列表 |
| GET /markets/listings | 统一挂牌列表 |
| GET /outcomes/:predexon_id | 按 Predexon ID 查结果 |
matching-markets 只接受其中一个标识符:polymarket_condition_id、polymarket_market_slug、 polymarket_market_id、kalshi_market_ticker、limitless_slug、predict_market_id、 predict_condition_id、predict_token_id、opinion_market_id、opinion_condition_id、 opinion_token_id。
Kalshi(3 个)
| 端点 | 描述 |
|---|---|
| GET /kalshi/markets | Kalshi 市场列表 |
| GET /kalshi/trades | 交易记录(?ticker=KXBTC) |
| GET /kalshi/orderbooks | 订单簿(?ticker=&start_time=&end_time=) |
Binance(2 个)
| 端点 | 描述 |
|---|---|
| GET /binance/candles/:symbol | K 线(?interval=1h&start_time=&end_time=) |
| GET /binance/ticks/:symbol | Tick 数据(?start_time=&end_time=) |
interval=1m 最多支持 7 天范围,interval=1h 可以更长。
dFlow(3 个)
| 端点 | 描述 |
|---|---|
| GET /dflow/trades | 某钱包的交易(?wallet=) |
| GET /dflow/wallet/positions/:wallet | 钱包持仓 |
| GET /dflow/wallet/pnl/:wallet | 钱包盈亏(?granularity=day) |
dFlow 使用 Solana base58 地址,不是 0x EVM 地址。
钱包身份(3 个)
| 端点 | 描述 |
|---|---|
| GET /polymarket/wallet/identity/:wallet | 解析单个钱包身份 |
| POST /polymarket/wallet/identities | 批量解析 — body {"addresses":["0x…","0x…"]} |
| GET /polymarket/wallet/:wallet/cluster | 与该钱包同簇的地址 |
UMA Oracle(2 个)
| 端点 | 描述 |
|---|---|
| GET /polymarket/uma/markets | 由 UMA 乐观预言机结算的市场 |
| GET /polymarket/uma/market/:condition_id | 单个 UMA 市场 (仅 UMA 结算市场有数据) |
Limitless(2 个)
| 端点 | 描述 |
|---|---|
| GET /limitless/markets | Limitless 市场列表 |
| GET /limitless/orderbooks | 订单簿(?market_slug=&start_time=&end_time=) |
Opinion(2 个)
| 端点 | 描述 |
|---|---|
| GET /opinion/markets | Opinion 市场列表 |
| GET /opinion/orderbooks | 订单簿(?market_id=&start_time=&end_time=) |
Predict.Fun(2 个)
| 端点 | 描述 |
|---|---|
| GET /predictfun/markets | Predict.Fun 市场列表 |
| GET /predictfun/orderbooks | 订单簿(?market_id=&start_time=&end_time=) |
核心端点详情
GET /polymarket/markets
列出 Polymarket 市场。查询参数原样透传给 Predexon;实测可用的有 sort(如 volume)和 limit。 需要深翻页时用 /polymarket/markets/keyset 配合上一页返回的 pagination_key。
GET /polymarket/wallet/:wallet
钱包概览。持仓和盈亏另有独立端点:/polymarket/wallet/positions/:wallet 和 /polymarket/wallet/pnl/:wallet(支持 ?granularity=day)。这些钱包端点为 $0.005/次。
GET /polymarket/orderbooks
订单簿快照,需要 ?token_id=,并用 start_time / end_time(Unix 秒)限定时间范围。
GET /matching-markets
传入某一平台的市场标识符,返回其他平台上的等价市场。只有该市场已被纳入匹配库时才有数据; 用 /matching-markets/pairs(无参数)可以列出全部已知配对。/matching-markets 为 $0.0095/次, /pairs 为 $0.001/次。
GET /markets/search
跨平台关键词搜索,必填 ?q=(如 bitcoin)。其余参数透传给上游。该端点为 $0.0095,不是 $0.001。
GET /polymarket/leaderboard
交易者排行。实测可用参数为 limit 和 sort_by(如 sort_by=total_pnl)。 单市场排行在 /polymarket/leaderboard/market/:condition_id。
聪明钱筛选是另一个端点 —— /polymarket/market/:condition_id/smart-money —— 至少需要一个 高于阈值的筛选参数,否则返回错误。
错误
网关层错误是扁平结构 —— 只有一个 error 字符串,没有嵌套的 code:
{ "error": "service 'prediction' is at capacity, please retry in a moment" }| HTTP | 含义 | 处理 |
|---|---|---|
| 401 | 缺少或无效的 API Key / x402 签名 | 检查 Authorization,或让 SDK 重新签名 |
| 402 | 结算失败 —— 钱包无法支付上游 | 充值后重试 |
| 403 | 余额不足,或支付被拒 | 充值,或检查你的支出限额 |
| 404 | 服务或上游路径不存在 | 对照上面的端点表核对路径 |
| 429 | 并发请求过多 | 退避后重试 |
| 502 | 上游服务失败 | 重试;持续失败说明上游宕机 |
| 503 | 服务暂时不可用 | 稍后重试 |
Predexon 自身返回的错误(市场 ID 不存在、地址格式错误、市场已结束)会原样透传, 所以那些错误的结构是上游的,不是 JarvisClaw 的。
代码示例
# 按成交量列出 Polymarket 市场
curl "https://api.jarvisclaw.ai/v1/marketplace/prediction/polymarket/markets?sort=volume&limit=50" \
-H "Authorization: Bearer sk-your-api-key"
# 钱包概览,然后查盈亏
curl "https://api.jarvisclaw.ai/v1/marketplace/prediction/polymarket/wallet/0xAbC123def456" \
-H "Authorization: Bearer sk-your-api-key"
curl "https://api.jarvisclaw.ai/v1/marketplace/prediction/polymarket/wallet/pnl/0xAbC123def456?granularity=day" \
-H "Authorization: Bearer sk-your-api-key"
# Kalshi 市场列表
curl "https://api.jarvisclaw.ai/v1/marketplace/prediction/kalshi/markets" \
-H "Authorization: Bearer sk-your-api-key"
# 跨平台搜索($0.0095)
curl "https://api.jarvisclaw.ai/v1/marketplace/prediction/markets/search?q=bitcoin" \
-H "Authorization: Bearer sk-your-api-key"import requests
BASE = "https://api.jarvisclaw.ai/v1/marketplace/prediction"
HEADERS = {"Authorization": "Bearer sk-your-api-key"}
# 1. 按成交量取市场
markets = requests.get(f"{BASE}/polymarket/markets",
headers=HEADERS, params={"sort": "volume", "limit": 50}).json()
# 2. 钱包概览与盈亏
wallet = requests.get(f"{BASE}/polymarket/wallet/0xAbC123def456", headers=HEADERS).json()
pnl = requests.get(f"{BASE}/polymarket/wallet/pnl/0xAbC123def456",
headers=HEADERS, params={"granularity": "day"}).json()
# 3. 跨平台搜索($0.0095)
results = requests.get(f"{BASE}/markets/search",
headers=HEADERS, params={"q": "bitcoin"}).json()
# 响应结构直接来自 Predexon,各端点不同 —— 取字段前先打印确认
print(markets, wallet, pnl, results)from jarvisclaw import MarketplaceClient
# x402 Agent 钱包 — 用 Base 上的 USDC 按次付费
client = MarketplaceClient(private_key="0x<evm-private-key>")
# 每次调用各自结算:多数 GET $0.001,
# /markets/search、/matching-markets、/dflow/trades 为 $0.0095
markets = client.call("prediction", "/polymarket/markets",
params={"sort": "volume", "limit": 50})
# 单市场聪明钱 —— 必须带一个高于阈值的筛选参数
smart = client.call("prediction",
"/polymarket/market/0xdd22472e.../smart-money",
params={"min_total_pnl": 100000})
# dFlow 用 Solana base58 地址,不是 0x
dflow = client.call("prediction",
"/dflow/wallet/pnl/4jaZ5McRcVCiRmz2Z8xd2BDCjWaAys2WD4K5Q1YHbcxP",
params={"granularity": "day"})
# 批量钱包身份解析(POST,$0.0095)
ids = client.call("prediction", "/polymarket/wallet/identities", method="POST", json={
"addresses": ["0x56687bf4...", "0x1f2dd6d4..."],
})
print(markets, smart, dflow, ids)package main
import (
"context"
"fmt"
jc "github.com/api-jarvisclaw/go-sdk/v2"
)
func main() {
ctx := context.Background()
mc, _ := jc.NewMarketplaceClient(jc.WithAPIKey("sk-your-api-key"))
// 按成交量取市场
markets, _ := mc.Call(ctx, "prediction", "/polymarket/markets", jc.WithParams(map[string]any{
"sort": "volume",
"limit": 50,
}))
fmt.Println("市场:", markets)
// Kalshi 市场列表
kalshi, _ := mc.Call(ctx, "prediction", "/kalshi/markets", nil)
fmt.Println("Kalshi:", kalshi)
// 跨平台搜索($0.0095)
results, _ := mc.Call(ctx, "prediction", "/markets/search", jc.WithParams(map[string]any{
"q": "bitcoin",
}))
fmt.Println("搜索:", results)
}package main
import (
"context"
"fmt"
jc "github.com/api-jarvisclaw/go-sdk/v2"
)
func main() {
ctx := context.Background()
mc, _ := jc.NewMarketplaceClient(jc.WithPrivateKey("0x<evm-private-key>"))
// Agent 自动付费查询
markets, _ := mc.Call(ctx, "prediction", "/polymarket/markets", jc.WithParams(map[string]any{
"sort": "volume",
"limit": 50,
}))
fmt.Println("热门市场:", markets)
// 钱包持仓
positions, _ := mc.Call(ctx, "prediction", "/polymarket/wallet/positions/0xAbC123def456", nil)
fmt.Println("持仓:", positions)
// 跨平台配对(无参数)— $0.001
pairs, _ := mc.Call(ctx, "prediction", "/matching-markets/pairs", nil)
fmt.Println("配对:", pairs)
}限制
- 只读数据 — 仅提供市场数据查询,不支持下单交易
- 无 WebSocket — 只能轮询,没有流式接口
- 地址格式按平台区分 — Polymarket 与钱包身份端点用
0xEVM 地址,dFlow 用 Solana base58;不解析 ENS - 跨平台匹配为尽力而为 —
/matching-markets仅在市场已进入匹配库时才有数据 - 价格格式不同 — Polymarket:小数 (0.00–1.00),Kalshi:美分 (0–100)
- 并发上限 — 大量并行调用可能返回 429,退避后重试即可
- 时间参数是 Unix 秒 —
start_time/end_time,不是 ISO 字符串;Binanceinterval=1m最多 7 天 - 响应结构来自上游 — 网关原样透传 Predexon 的 JSON,各端点字段不同