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

# Prediction Market Arbitrage ZH

> 基于当前已挂载的 Polymarket 和 Kalshi discovery endpoint 做跨市场候选研究。

[View on GitHub ->](https://github.com/AIsa-team/agent-skills/tree/main/prediction-market-arbitrage-zh)

**预测市场跨平台研究。** 用 AIsa 查询当前已挂载的 Polymarket 和 Kalshi 市场发现数据，识别可能相同或相关的事件；如需实时价格、订单簿深度或交易执行，请继续使用交易所官方 API 或交易系统验证。

## Install

First, install the AIsa CLI if you have not already:

```bash theme={null}
npm install -g @aisa-one/cli
```

Then install the skill:

```bash theme={null}
aisa skills install prediction-market-arbitrage-zh
```

## What can agents do with it?

<CardGroup cols={2}>
  <Card title="Cross-market discovery" icon="shuffle">
    Find related Polymarket and Kalshi markets for the same topic.
  </Card>

  <Card title="Candidate pairing" icon="arrows-left-right">
    Compare titles, slugs, tickers, event names, and close times.
  </Card>

  <Card title="Liquidity triage" icon="droplet">
    Use discovery response volume/liquidity fields to decide where to investigate further.
  </Card>

  <Card title="Chinese summaries" icon="language">
    Produce Chinese-language research notes from mounted market data.
  </Card>
</CardGroup>

## 配置

```bash theme={null}
export AISA_API_KEY="your-key"
```

在 [aisa.one](https://aisa.one) 获取 Key（按量付费）。

## 工作流程

跨平台研究步骤：

1. **发现候选市场**：查询 `/polymarket/markets`、`/polymarket/events` 和 `/kalshi/markets`。
2. **人工/程序化配对**：按标题、slug、ticker、event\_ticker、队伍/赛事名、结束时间等字段找可能等价的市场。
3. **外部验证价格与深度**：AIsa 当前未挂载 price/orderbook/matching endpoint；交易前请用交易所官方 API 或交易系统验证实时价格、订单簿和可成交规模。

<Warning>
  旧版 AIsa-hosted price、orderbook、matching-market 示例已移除，因为鉴权实测返回 `api endpoint not found`。不要把 discovery 数据直接当成可执行报价。
</Warning>

## 快速示例

### 1. 查询 Polymarket 候选市场

```bash theme={null}
python3 scripts/prediction_market_client.py polymarket markets --limit 5
python3 scripts/prediction_market_client.py polymarket events --limit 5
```

### 2. 查询 Kalshi 候选市场

```bash theme={null}
python3 scripts/prediction_market_client.py kalshi markets --status open --limit 5
python3 scripts/prediction_market_client.py kalshi trades --limit 5 --is-block-trade false
```

### 3. 配对并外部验证

用 Polymarket `slug`/`question`/`conditionId` 和 Kalshi `ticker`/`event_ticker`/`title` 做候选配对。若要判断是否有价差，继续调用交易所官方 API 获取实时 YES/NO 价格与订单簿深度。

## 命令参考

### prediction\_market\_client.py — 已挂载市场数据

```bash theme={null}
# Polymarket discovery
python3 scripts/prediction_market_client.py polymarket markets [--limit <数值>]
python3 scripts/prediction_market_client.py polymarket events [--limit <数值>]
python3 scripts/prediction_market_client.py polymarket activity --user <钱包地址> [--limit <数值>]

# Kalshi discovery/trades
python3 scripts/prediction_market_client.py kalshi markets [--status unopened|open|paused|closed|settled] [--limit <数值>]
python3 scripts/prediction_market_client.py kalshi trades [--ticker <ticker>] [--is-block-trade true|false] [--limit <数值>]
```

## 理解套利

真正的套利需要实时、可成交的互斥结果报价，并考虑手续费、滑点、订单簿深度和平台风险。当前 AIsa Prediction Market surface 适合做候选发现，不应单独用于下单判断。

## 安全与权限

**需要：** `AISA_API_KEY` 环境变量。

所有 AIsa 调用均为**只读**，通过 HTTPS GET 请求 `api.aisa.one`。不执行交易、不连接钱包、除 API Key 外不发送个人数据。

完整文档：[AIsa API 参考](https://aisa.one/docs/api-reference)。

## Get started

1. Sign up at [aisa.one](https://aisa.one) (new accounts start with \$2 free credit).
2. Generate an API key from the console.
3. Set your key and install the skill:
   ```bash theme={null}
   export AISA_API_KEY="your-key"
   npm install -g @aisa-one/cli
   aisa skills install prediction-market-arbitrage-zh
   ```
4. Start a new agent session so the runtime loads the updated skill instructions.

## Related

<CardGroup cols={3}>
  <Card title="Prediction Market Arbitrage" icon="scale-balanced" href="/agent-skills/prediction-market-arbitrage">
    English-language cross-market research workflow.
  </Card>

  <Card title="Prediction Market Data ZH" icon="chart-simple" href="/agent-skills/prediction-market-data-zh">
    Chinese-language market data workflow.
  </Card>

  <Card title="Prediction Market API" icon="code" href="/api-reference/prediction-market/get_polymarket-markets">
    Mounted Polymarket and Kalshi endpoint reference.
  </Card>
</CardGroup>
