pmxt
pmxt copied to clipboard
CCXT for prediction markets. PMXT is a unified API for trading on Polymarket, Kalshi, and more.
pmxt

The ccxt for prediction markets. A unified, language-agnostic API for accessing prediction market data across multiple exchanges — works from Python, TypeScript, or any HTTP client.
Supported Exchanges
Polymarket
Polymarket US 🇺🇸
Kalshi
Limitless
Myriad
Opinion
Metaculus
Smarkets
Hyperliquid
Gemini Titan
Feature Support & Compliance.
Why pmxt?
Different prediction market platforms have different APIs, data formats, and conventions. pmxt provides a single, consistent interface to work with all of them.
- Language-agnostic. Python and TypeScript SDKs today, with HTTP access for any other language. No lock-in to a single ecosystem.
- Open source (MIT). No API key required, no vendor dependency, no rate-limit business model. Self-host and run locally, or hit our hosted api.
- Drop-in Dome API replacement. Automatic codemod (
dome-to-pmxt) for teams migrating after the Polymarket acquisition. - Unified trading, not just data. Place orders across Polymarket, Kalshi, and Limitless with a single interface.
- MCP-native. Use pmxt directly from Claude, Cursor, and other AI agents.
Installation
Ensure that Node.js (>= 18) is installed and the node command is available on your PATH. The Python SDK requires Python >= 3.8.
Python
pip install pmxt
Node.js
npm install pmxtjs
CLI
npm install -g @pmxt/cli
pmxt polymarket markets --query Trump --limit 5
pmxt polymarket fetchMarkets --query Trump --limit 5
pmxt auth status
Running from Source
git clone https://github.com/pmxt-dev/pmxt.git
cd pmxt
npm install
npm run dev
MCP (for AI agents)
npx -y @pmxt/mcp
See @pmxt/mcp for setup with Claude, Cursor, and other MCP-compatible clients.
Migrating from Dome API
If you're currently using Dome API, pmxt is a drop-in replacement with a unified interface for Polymarket and Kalshi.
Check out pmxt as a Dome API alternative for a detailed migration guide, API comparison, and automatic codemod tool (dome-to-pmxt) to help you transition your code.
# Automatically migrate your codebase
npx dome-to-pmxt ./src
Quickstart
Prediction markets are structured in a hierarchy to group related information.
- Event: The broad topic (e.g., "Who will Trump nominate as Fed Chair?")
- Market: A specific tradeable question (e.g., "Will Trump nominate Kevin Warsh as the next Fed Chair?")
- Outcome: The actual share you buy (e.g., "Yes" or "No")
Python
import pmxt
api = pmxt.Exchange()
# 1. Search for the broad Event
events = api.fetch_events(query='Who will Trump nominate as Fed Chair?')
fed_event = events[0]
# 2. Find the specific Market within that event
warsh = fed_event.markets.match('Kevin Warsh')
print(f"Price: {warsh.yes.price}")
TypeScript
Note: Named imports do not work in ESM. Use
import pmxt from 'pmxtjs'(default import), notimport { Polymarket } from 'pmxtjs'.
import pmxt from 'pmxtjs';
const api = new pmxt.Exchange();
// 1. Search for the broad Event
const events = await api.fetchEvents({ query: 'Who will Trump nominate as Fed Chair?' });
const fedEvent = events[0];
// 2. Find the specific Market within that event
const warsh = fedEvent.markets.match('Kevin Warsh');
console.log(`Price: ${warsh.yes?.price}`);
Trading
pmxt supports unified trading across exchanges.
Setup
To trade, you must provide your private credentials during initialization. For detailed credential setup instructions, see the exchange-specific guides: Polymarket, Kalshi, Limitless.
Polymarket
exchange = pmxt.Polymarket(
private_key=os.getenv('POLYMARKET_PRIVATE_KEY'),
proxy_address=os.getenv('POLYMARKET_PROXY_ADDRESS'), # Optional: For proxy trading
signature_type='gnosis-safe' # Default
)
Kalshi
exchange = pmxt.Kalshi(
api_key=os.getenv('KALSHI_API_KEY'),
private_key=os.getenv('KALSHI_PRIVATE_KEY') # RSA Private Key
)
Limitless
exchange = pmxt.Limitless(
api_key=os.getenv('LIMITLESS_API_KEY'),
private_key=os.getenv('LIMITLESS_PRIVATE_KEY') # For order signing (EIP-712)
)
Trading Example (Python)
import pmxt
import os
# Initialize with credentials (e.g., Polymarket)
exchange = pmxt.Polymarket(
private_key=os.getenv('POLYMARKET_PRIVATE_KEY'),
proxy_address=os.getenv('POLYMARKET_PROXY_ADDRESS')
)
# 1. Check Balance
balance = exchange.fetch_balance()
print(f"Available balance: {balance[0].available}")
# 2. Fetch markets
markets = exchange.fetch_markets(query='Trump')
# 3. Place an Order (using outcome shorthand)
order = exchange.create_order(
outcome=markets[0].yes,
side='buy',
type='limit',
price=0.33,
amount=100
)
print(f"Order Status: {order.status}")
Documentation
See the API Reference for detailed documentation and more examples.
Examples
Check out the directory for more use cases: