The ccxt for prediction markets. A unified API for accessing prediction market data across multiple exchanges.
Different prediction market platforms have different APIs, data formats, and conventions. pmxt provides a single, consistent interface to work with all of them.
Ensure that Node.js is installed and the node command is available on your PATH.
pip install pmxtnpm install pmxtjsPrediction 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")
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. Filter for the specific Market within that event
warsh = api.filter_markets(fed_event.markets, 'Kevin Warsh')[0]
print(f"Price: {warsh.yes.price}")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. Filter for the specific Market within that event
const warsh = api.filterMarkets(fedEvent.markets, 'Kevin Warsh')[0];
console.log(`Price: ${warsh.yes?.price}`);pmxt supports unified trading across exchanges.
To trade, you must provide your private credentials during initialization.
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
)exchange = pmxt.Kalshi(
api_key=os.getenv('KALSHI_API_KEY'),
private_key=os.getenv('KALSHI_PRIVATE_KEY') # RSA Private Key
)exchange = pmxt.Limitless(
api_key=os.getenv('LIMITLESS_API_KEY'),
private_key=os.getenv('LIMITLESS_PRIVATE_KEY') # For order signing (EIP-712)
)import pmxt
import os
# Initialize with credentials (e.g., Polymarket)
exchange = pmxt.Exchange(...)
# 1. Check Balance
balance = exchange.fetch_balance()
print(f"Available balance: {balance[0].available}")
# 2. Place an Order
# Use market.market_id and outcome.outcome_id from your market data
order = exchange.create_order(
market_id='market-123', # From market.market_id
outcome_id='outcome-456', # From outcome.outcome_id
side='buy',
type='limit',
price=0.33,
amount=100
)
print(f"Order Status: {order.status}")See the API Reference for detailed documentation and more examples.
Check out the directory for more use cases: