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

> Mounted Polymarket and Kalshi discovery/trade-history data for autonomous agents.

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

**Prediction-market discovery data for autonomous agents.** One `AISA_API_KEY` reads mounted Polymarket and Kalshi endpoints for market discovery, event lookup, activity, and Kalshi trade history.

## 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-data
```

## What can agents do with it?

<CardGroup cols={2}>
  <Card title="Market discovery" icon="magnifying-glass">
    "Find Polymarket and Kalshi markets related to a topic."
  </Card>

  <Card title="Event lookup" icon="calendar-days">
    "Browse Polymarket event groups and associated markets."
  </Card>

  <Card title="Trade history" icon="chart-line">
    "Pull recent Kalshi trade records with optional ticker and block-trade filters."
  </Card>

  <Card title="Activity checks" icon="wave-pulse">
    "Inspect Polymarket activity for a specific user over a time range."
  </Card>

  <Card title="Liquidity triage" icon="droplet">
    "Use volume and liquidity fields from market discovery responses to prioritize deeper venue checks."
  </Card>

  <Card title="Research workflows" icon="shuffle">
    "Build candidate sets before using venue-native tools for pricing, orderbooks, or execution."
  </Card>
</CardGroup>

## Core capabilities

* **Market discovery** — fetch Polymarket and Kalshi markets with provider-supported filters.
* **Event index** — fetch Polymarket event/group data.
* **Trade history** — fetch Kalshi trades using `limit`, `cursor`, `ticker`, `min_ts`, `max_ts`, and `is_block_trade`.
* **Activity lookup** — fetch Polymarket user activity with `user` and optional time/market filters.

<Warning>
  AIsa currently mounts the endpoints listed below. Older examples for AIsa-hosted price, orderbook, wallet, candlestick, and matching-market endpoints were removed because authenticated probes returned `api endpoint not found`.
</Warning>

## Quick start

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

### Polymarket

```bash theme={null}
# Market discovery
curl "https://api.aisa.one/apis/v1/polymarket/markets?limit=5" \
  -H "Authorization: Bearer $AISA_API_KEY"

# Events
curl "https://api.aisa.one/apis/v1/polymarket/events?limit=5" \
  -H "Authorization: Bearer $AISA_API_KEY"

# Activity for a specific user address
curl "https://api.aisa.one/apis/v1/polymarket/activity?user=WALLET_ADDRESS&limit=5" \
  -H "Authorization: Bearer $AISA_API_KEY"
```

### Kalshi

```bash theme={null}
# Market discovery
curl "https://api.aisa.one/apis/v1/kalshi/markets?limit=5&status=open" \
  -H "Authorization: Bearer $AISA_API_KEY"

# Trades
curl "https://api.aisa.one/apis/v1/kalshi/trades?limit=5&is_block_trade=false" \
  -H "Authorization: Bearer $AISA_API_KEY"
```

## Python client

```bash theme={null}
# Polymarket
python3 scripts/prediction_market_client.py poly markets --limit 5
python3 scripts/prediction_market_client.py poly events --limit 5
python3 scripts/prediction_market_client.py poly activity --user WALLET_ADDRESS --limit 5

# Kalshi
python3 scripts/prediction_market_client.py kalshi markets --limit 5 --status open
python3 scripts/prediction_market_client.py kalshi trades --limit 5 --is-block-trade false
```

## Endpoint reference

| Endpoint               | Method | Purpose                                                                       |
| ---------------------- | ------ | ----------------------------------------------------------------------------- |
| `/polymarket/markets`  | GET    | [Polymarket markets](/api-reference/prediction-market/get_polymarket-markets) |
| `/polymarket/events`   | GET    | [Polymarket events](/api-reference/prediction-market/get_polymarket-events)   |
| `/polymarket/activity` | GET    | [Activity](/api-reference/prediction-market/get_polymarket-activity)          |
| `/kalshi/markets`      | GET    | [Kalshi markets](/api-reference/prediction-market/get_kalshi-markets)         |
| `/kalshi/trades`       | GET    | [Kalshi trades](/api-reference/prediction-market/get_kalshi-trades)           |

## 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. `export AISA_API_KEY="your-key"` and install the skill:
   ```bash theme={null}
   npm install -g @aisa-one/cli
   aisa skills install prediction-market-data
   ```

## Related

<CardGroup cols={3}>
  <Card title="Prediction Market API reference" icon="chart-simple" href="/api-reference/prediction-market/get_polymarket-markets">
    Mounted Polymarket and Kalshi discovery endpoints.
  </Card>

  <Card title="Arbitrage skill" icon="scale-balanced" href="/agent-skills/prediction-market-arbitrage">
    Candidate discovery for cross-platform market research.
  </Card>

  <Card title="Error Codes" icon="triangle-exclamation" href="/api-reference/errors">
    Handling upstream exchange errors.
  </Card>
</CardGroup>
