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.
Get the current price for any market in seconds.
import pmxt
api = pmxt.Polymarket()
markets = api.get_markets_by_slug('who-will-trump-nominate-as-fed-chair')
warsh = next((m for m in markets if m.outcomes[0].label == 'Kevin Warsh'), None)
print(warsh.outcomes[0].price) # price of 'Yes' outcomeNote: For TypeScript usage, see pmxtjs documentation.
pip install pmxtnpm install pmxtjs- Polymarket
- Kalshi
pmxt supports trading functionality (placing and cancelling orders).
To trade, you must provide your private credentials.
- Polymarket: Requires your Polygon Private Key. View Setup Guide
- Kalshi: Requires API Key & Private Key.
import pmxt from 'pmxtjs';
const exchange = new pmxt.Polymarket({
privateKey: process.env.POLYMARKET_PRIVATE_KEY
});
// Check Balance
const balance = await exchange.fetchBalance();
console.log('Balance:', balance);
// Place an Order
const order = await exchange.createOrder({
marketId: 'market-123',
outcomeId: 'token-id-456',
side: 'buy',
type: 'limit',
price: 0.50,
amount: 100
});
console.log('Order:', order);See the API Reference for detailed documentation and more examples.
Check out the directory for more use cases: