Skip to main content
View on GitHub → Unified prediction-market data for autonomous agents. One AISA_API_KEY reads markets and prices across Polymarket and Kalshi — search events, track implied probabilities, inspect orderbooks, and analyze wallet positions.

Install

aisa skills install prediction-market-data

What can agents do with it?

Probability queries

“What are the current odds of a Fed rate cut in June across markets?”

Sentiment tracking

“Monitor election-related markets and flag price swings >5%.”

Trading analysis

“Pull historical trades and OHLC for this market over the last 30 days.”

Portfolio tracking

“What’s the P&L on this Polymarket wallet across granularities?”

Orderbook depth

“Check the top-of-book liquidity before placing a trade.”

Cross-platform match

“Find the Kalshi and Polymarket markets for the same NFL game.”

Core capabilities

  • Market discovery — search Polymarket and Kalshi by keyword, status, category
  • Price tracking — current “Yes”/“No” prices (implied probabilities)
  • Historical data — trade history, orderbook snapshots, candlesticks
  • Wallet analytics — positions and P&L by granularity (Polymarket)
  • Event index — Polymarket event lookup
  • Sports matching — find equivalent markets across platforms (NFL, MLB, NBA, etc.)

Workflow pattern

Most endpoints require IDs pulled from the search responses:
1

Search for markets

Call /polymarket/markets or /kalshi/markets with a keyword.
2

Extract the identifier

Polymarket → token_id. Kalshi → market_ticker.
3

Pass to downstream endpoints

Use that identifier for price, orderbook, trades, or candlestick queries.

Quick start

export AISA_API_KEY="your-key"

Polymarket

# Market discovery
curl "https://api.aisa.one/apis/v1/polymarket/markets?search=election&status=active" \
  -H "Authorization: Bearer $AISA_API_KEY"

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

# Market price (implied probability) for a token_id
curl "https://api.aisa.one/apis/v1/polymarket/market-price/TOKEN_ID" \
  -H "Authorization: Bearer $AISA_API_KEY"

# Orderbook snapshot
curl "https://api.aisa.one/apis/v1/polymarket/orderbooks?token_id=TOKEN_ID" \
  -H "Authorization: Bearer $AISA_API_KEY"

# Candlesticks
curl "https://api.aisa.one/apis/v1/polymarket/candlesticks?token_id=TOKEN_ID" \
  -H "Authorization: Bearer $AISA_API_KEY"

# Activity / orders / positions
curl "https://api.aisa.one/apis/v1/polymarket/activity?wallet=WALLET_ADDRESS" \
  -H "Authorization: Bearer $AISA_API_KEY"

# Wallet P&L by granularity
curl "https://api.aisa.one/apis/v1/polymarket/wallet-pnl?wallet=WALLET_ADDRESS&granularity=day" \
  -H "Authorization: Bearer $AISA_API_KEY"

Kalshi

# Market discovery
curl "https://api.aisa.one/apis/v1/kalshi/markets?search=rates" \
  -H "Authorization: Bearer $AISA_API_KEY"

# Market price
curl "https://api.aisa.one/apis/v1/kalshi/market-price/KX-123" \
  -H "Authorization: Bearer $AISA_API_KEY"

# Trades & orderbook
curl "https://api.aisa.one/apis/v1/kalshi/trades?ticker=KX-123" \
  -H "Authorization: Bearer $AISA_API_KEY"
curl "https://api.aisa.one/apis/v1/kalshi/orderbooks?ticker=KX-123" \
  -H "Authorization: Bearer $AISA_API_KEY"

Cross-platform sports matching

# All sports
curl "https://api.aisa.one/apis/v1/matching-markets/sports" \
  -H "Authorization: Bearer $AISA_API_KEY"

# By sport (nfl, mlb, nba, etc.)
curl "https://api.aisa.one/apis/v1/matching-markets/sports/nba?date=2025-08-16" \
  -H "Authorization: Bearer $AISA_API_KEY"

Python client

# Polymarket
python3 scripts/prediction_market_client.py poly markets --search "recession"
python3 scripts/prediction_market_client.py poly events
python3 scripts/prediction_market_client.py poly market-price --token-id TOKEN_ID
python3 scripts/prediction_market_client.py poly orderbook --token-id TOKEN_ID
python3 scripts/prediction_market_client.py poly candlesticks --token-id TOKEN_ID
python3 scripts/prediction_market_client.py poly wallet --address WALLET
python3 scripts/prediction_market_client.py poly wallet-pnl --address WALLET --granularity day

# Kalshi
python3 scripts/prediction_market_client.py kalshi markets --search "interest rates"
python3 scripts/prediction_market_client.py kalshi market-price --ticker KX-123
python3 scripts/prediction_market_client.py kalshi trades --ticker KX-123
python3 scripts/prediction_market_client.py kalshi orderbook --ticker KX-123

# Matching
python3 scripts/prediction_market_client.py matching sports --sport nba --date 2025-08-16

Endpoint reference

EndpointMethodPurpose
/polymarket/marketsGETPolymarket markets
/polymarket/eventsGETPolymarket events
/polymarket/market-price/{id}GETMarket price
/polymarket/orderbooksGETOrderbook
/polymarket/candlesticksGETCandlesticks
/polymarket/activityGETActivity
/polymarket/ordersGETOrders
/polymarket/positionsGETPositions
/polymarket/walletGETWallet
/polymarket/wallet-pnlGETWallet P&L
/kalshi/marketsGETKalshi markets
/kalshi/market-price/{ticker}GETKalshi price
/kalshi/tradesGETKalshi trades
/kalshi/orderbooksGETKalshi orderbook
/matching-markets/sportsGETAll sports
/matching-markets/sports/{sport}GETBy sport

Get started

  1. Sign up at 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:
    aisa skills install prediction-market-data
    

Prediction Market API reference

Every Polymarket, Kalshi, and matching-markets endpoint.

Arbitrage skill

Cross-platform arb detection built on the same data.

Error Codes

Handling upstream exchange errors.