Query AIsa API and Polymarket prediction markets via Kalshi .
Configuration
export AISA_API_KEY="your-key"
Get a Key at aisa.one ($0.01 per query, pay-as-you-go).
Workflow
Steps to query prediction market data:
- Search marketsGet the ID (must start from this step)
- Extract the ID from the returned results(
token_id、condition_idormarket_ticker) - Query details by ID(prices, order books, candlesticks, etc.)
Quick Examples
Polymarket: search → get prices
# 第一步:搜索市场,提取 token_id(side_a.id 或 side_b.id)
python3 scripts/prediction_market_client.py polymarket markets --search "election" --status open --limit 5
# 第二步:用第一步的 token_id 获取价格
python3 scripts/prediction_market_client.py polymarket price <token_id>
Kalshi: search → get prices
# 第一步:搜索市场,提取 market_ticker
python3 scripts/prediction_market_client.py kalshi markets --search "fed rate" --status open --limit 5
# 第二步:用第一步的 market_ticker 获取价格
python3 scripts/prediction_market_client.py kalshi price <market_ticker>
Cross-platform sports markets
python3 scripts/prediction_market_client.py sports by-date nba --date 2025-04-01
ID Reference
Most commands require obtaining an ID from the markets return, so be sure to search first.
| Platform | ID field | Location to obtain |
|---|---|---|
| Polymarket | token_id |
In the markets output, side_a.id or side_b.id |
| Polymarket | condition_id |
In the markets output, condition_id |
| Kalshi | market_ticker |
In the markets output, market_ticker |
Command Reference
Polymarket
python3 scripts/prediction_market_client.py polymarket markets [--search <关键词>] [--status open|closed] [--min-volume <数值>] [--limit <数值>]
python3 scripts/prediction_market_client.py polymarket price <token_id> [--at-time <unix时间戳>]
python3 scripts/prediction_market_client.py polymarket activity --user <钱包地址> [--market-slug <slug>] [--limit <数值>]
python3 scripts/prediction_market_client.py polymarket orders [--market-slug <slug>] [--token-id <id>] [--user <钱包地址>] [--limit <数值>]
python3 scripts/prediction_market_client.py polymarket orderbooks --token-id <id> [--start <毫秒>] [--end <毫秒>] [--limit <数值>]
python3 scripts/prediction_market_client.py polymarket candlesticks <condition_id> --start <unix时间戳> --end <unix时间戳> [--interval 1|60|1440]
python3 scripts/prediction_market_client.py polymarket positions <钱包地址> [--limit <数值>]
python3 scripts/prediction_market_client.py polymarket wallet (--eoa <地址> | --proxy <地址>) [--with-metrics]
python3 scripts/prediction_market_client.py polymarket pnl <钱包地址> --granularity <day|week|month>
Kalshi
python3 scripts/prediction_market_client.py kalshi markets [--search <关键词>] [--status open|closed] [--min-volume <数值>] [--limit <数值>]
python3 scripts/prediction_market_client.py kalshi price <market_ticker> [--at-time <unix时间戳>]
python3 scripts/prediction_market_client.py kalshi trades [--ticker <ticker>] [--start <unix时间戳>] [--end <unix时间戳>] [--limit <数值>]
python3 scripts/prediction_market_client.py kalshi orderbooks --ticker <ticker> [--start <毫秒>] [--end <毫秒>] [--limit <数值>]
Cross-platform sports markets
python3 scripts/prediction_market_client.py sports matching (--polymarket-slug <slug> | --kalshi-ticker <ticker>)
python3 scripts/prediction_market_client.py sports by-date <运动类型> --date <YYYY-MM-DD>
Supports:nfl、mlb、cfb、nba、nhl、cbb、pga、tennis。
Understanding Odds
Prices are decimals:0.65 = 65% implied probability. A "Yes" price = the probability of the event occurring. Higher volume = greater liquidity.
Security and Permissions
Requires: AISA_API_KEY environment variable.
All operations areread-only, via HTTPS GET requests to api.aisa.one. No trades are executed, no wallets are connected, and no personal data is sent other than the API Key. Each response includes usage.cost and usage.credits_remaining。
Full documentation:AIsa API Reference。