Heisenberg SDK
One typed client for the entire intelligence API — markets, trades, wallet 360, smart money, H-Score leaderboards, CLV, and real-time trades — for TypeScript and Python, generated from a single spec so both languages stay identical.
pip install heisenberg_ainpm install heisenberg-aiQuickstart
import { Heisenberg } from 'heisenberg-ai';
const hb = new Heisenberg({ token: process.env.HEISENBERG_TOKEN });
// Free tier — no subscription needed.
const markets = await hb.polymarket.markets({ min_volume: 1000, closed: false, limit: 5 });
const profile = await hb.wallets.profile('0xabc…', { window_days: 15 });
// A Query is awaitable (first page) or async-iterable (auto-paginates).
for await (const trade of hb.polymarket.trades({ condition_id: '0x…' })) {
// …
}from heisenberg import Heisenberg
hb = Heisenberg(token="…") # or set HEISENBERG_TOKEN
markets = hb.polymarket.markets({"min_volume": 1000, "closed": False, "limit": 5}).page()
profile = hb.wallets.profile("0xabc…", {"window_days": 15}).page()
for trade in hb.polymarket.trades({"condition_id": "0x…"}): # auto-paginates
...Two ways in
Venues
hb.polymarket, hb.kalshi, hb.hyperliquid — each exposes the capabilities that venue supports (.markets, .trades, …). Same shape everywhere.
Intelligence
hb.wallets, hb.smartMoney, hb.leaderboards, hb.sports, hb.social — curated, typed methods over the highest-value signals.
Real-time
hb.stream.trades({…}) streams live Polymarket trades with automatic reconnect and resubscribe.
Read-only
Typed reads over HTTPS with your bearer token — no custody or signing to manage. The token is only ever sent in the Authorization header.
What the client handles for you
- Native param types → the API's string wire format (booleans, dates).
- Envelope unwrapping and auto-pagination.
- Encoded JSON response columns decoded transparently.
- Retries with backoff on 429/5xx.
- Typed errors — including
PlanErrorfor gated endpoints, which preserves the API message and tells you which plan unlocks it.
Method → endpoint reference
Every SDK method calls one API endpoint (agent). Names below are TypeScript; Python uses the snake_case equivalent (e.g. hb.smartMoney → hb.smart_money, closingLine → closing_line). Click an endpoint to open its full API reference.
Polymarket hb.polymarket
| markets(params) | Polymarket Markets | #574 |
| trades(params) | Polymarket Trades | #556 |
| candlesticks(params) | Polymarket Candlesticks | #568 |
| orderbook(params) | Polymarket Orderbook | #572 |
| priceJumps(params) | Polymarket Price Jumps | #596 |
Kalshi hb.kalshi
| markets(params) | Kalshi Markets | #565 |
| trades(params) | Kalshi Trades | #573 |
Hyperliquid hb.hyperliquid
| walletTrades(params) | Hyperliquid Wallet Trades | #612 |
| marketTrades(params) | Hyperliquid Market Trades | #613 |
| perpetualMarkets(params) | Hyperliquid Perpetual Markets | #616 |
| spotMarkets(params) | Hyperliquid Spot Markets | #617 |
| outcomeMarkets(params) | Hyperliquid Outcome Markets | #615 |
Wallets hb.wallets
| profile(wallet, params) | Wallet 360 | #581 |
| pnl(wallet, params) | Polymarket PnL | #569 |
| statsAllTime(wallet) | Wallet Stats All Time | #586 |
Smart money hb.smartMoney
| positions(params) | Smart Money Positionsgated | #591 |
| pulse(conditionId, params) | Market Pulse: Summarygated | #593 |
| pulsePositions(conditionId, params) | Market Pulse: Positionsgated | #594 |
Leaderboards hb.leaderboards
| polymarketPnl(params) | Polymarket PnL Leaderboard | #579 |
| heisenberg(params) | Heisenberg Leaderboard | #584 |
| sport(params) | Sports Bettor Leaderboardgated | #595 |
Markets hb.markets
| insights(conditionId, params) | Polymarket Market 360 | #575 |
Sports hb.sports
| closingLine(conditionId) | Closing Linegated | #602 |
| pnl(wallet, params) | Sport PnLgated | #601 |
| bettorProfile(wallet, params) | Sport Bettor Profilegated | #599 |
| hScore(wallet) | Sport H-Score Forecastgated | #605 |
| hScoreHistory(wallet, params) | Sport H-Score Historygated | #606 |
| marketInsights(params) | Sport Market Insightsgated | #600 |
Audience hb.audience
| polylink(wallets) | Polylinkgated | #607 |
Social hb.social
| pulse(params) | Social Pulse | #585 |
Related
- Authentication — get a token and understand plans.
- API Reference — every endpoint, params, and response fields.
- WebSockets — the raw stream behind
hb.stream. - Work with AI (MCP) — no-code access to the same data.
- Pricing & Plans — what unlocks the gated endpoints.