# pmxt [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=The%20ccxt%20for%20prediction%20markets.&url=https://github.com/pmxt-dev/pmxt&hashtags=predictionmarkets,trading) [![DOI](https://zenodo.org/badge/1130657894.svg)](https://doi.org/10.5281/zenodo.19111315) **The [ccxt](https://github.com/ccxt/ccxt) for prediction markets.** Hosted unified API for prediction markets β€” trade Polymarket, Kalshi, Opinion, and more from one API key. Open-source SDK and self-host option included. plot
CCXT for Prediction Markets - A unified API for prediction market data across exchanges. | Product Hunt GitHub watchers Total Downloads
GitHub forks License
GitHub stars version

Discord

### Supported Exchanges

Polymarket Polymarket      Polymarket US Polymarket US πŸ‡ΊπŸ‡Έ      Kalshi Kalshi      Limitless Limitless      Probable      Myriad Myriad      Opinion Opinion      Metaculus Metaculus      Smarkets Smarkets      Hyperliquid Hyperliquid      Gemini Titan Gemini Titan      Rain Rain

[Feature Support & Compliance](core/COMPLIANCE.md). ## 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. - **Hosted API.** Get a key at [pmxt.dev/dashboard](https://pmxt.dev/dashboard), construct a client, trade. PMXT handles custody, signing infrastructure, and on-chain settlement. - **Open source (MIT).** Self-host the local server for full control β€” your keys, your machine, no PMXT in the loop. See [Self-hosted](#self-hosted). - **Language-agnostic.** Python and TypeScript SDKs today, with HTTP access for any other language. No lock-in to a single ecosystem. - **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](https://pmxt.dev/mcp).** Use pmxt directly from Claude, Cursor, and other AI agents. ## Installation Ensure that [`Node.js`](https://nodejs.org) (>= 18) is installed and the `node` command is available on your PATH. The Python SDK requires Python >= 3.8. ### Python ```bash pip install pmxt ``` ### Node.js ```bash npm install pmxtjs ``` ### CLI ```bash 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 ```bash git clone https://github.com/pmxt-dev/pmxt.git cd pmxt npm install npm run dev ``` ### MCP (for AI agents) ```bash npx -y @pmxt/mcp ``` See [@pmxt/mcp](https://github.com/pmxt-dev/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](https://pmxt.dev/dome-api-alternative) for a detailed migration guide, API comparison, and automatic codemod tool (`dome-to-pmxt`) to help you transition your code. ```bash # Automatically migrate your codebase npx dome-to-pmxt ./src ``` ## Quickstart Get your API key at [pmxt.dev/dashboard](https://pmxt.dev/dashboard). For reads, only `pmxt_api_key` and `wallet_address` are required. For trading, also pass `private_key` β€” the SDK auto-wraps it into an EIP-712 signer. ### Python ```python import pmxt # Reads β€” pmxt_api_key + wallet_address only client = pmxt.Polymarket( pmxt_api_key="pmxt_live_...", wallet_address="0xYourWalletAddress", ) positions = client.fetch_positions() balance = client.fetch_balance() markets = client.fetch_markets(query="nba") # Trading β€” also pass private_key trader = pmxt.Polymarket( pmxt_api_key="pmxt_live_...", wallet_address="0xYourWalletAddress", private_key="0xYourPrivateKey", ) order = trader.create_order( market_id="market-uuid", outcome_id="outcome-uuid", side="buy", order_type="market", amount=5.0, denom="usdc", slippage_pct=30.0, ) ``` ### TypeScript > **Note:** Named imports do not work in ESM. Use `import pmxt from 'pmxtjs'` (default import) for the namespaced form, or import `Polymarket` from `pmxtjs` only via the CJS build. ```typescript import { Polymarket } from "pmxtjs"; // Reads β€” pmxtApiKey + walletAddress only const client = new Polymarket({ pmxtApiKey: "pmxt_live_...", walletAddress: "0xYourWalletAddress", }); const positions = await client.fetchPositions(); const balance = await client.fetchBalance(); // Trading β€” also pass privateKey const trader = new Polymarket({ pmxtApiKey: "pmxt_live_...", walletAddress: "0xYourWalletAddress", privateKey: "0xYourPrivateKey", }); const order = await trader.createOrder({ marketId: "market-uuid", outcomeId: "outcome-uuid", side: "buy", type: "market", amount: 5.0, denom: "usdc", slippage_pct: 30.0, } as any); ``` ### Prediction market hierarchy 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"*) ## Trading pmxt supports unified trading across exchanges. The hosted API is the default β€” see Quickstart above for the basic flow. ### Hosted trading (recommended) With a PMXT API key, you only need your wallet address and a private key to sign orders. PMXT handles custody, signer infrastructure, and on-chain settlement. ```python import pmxt trader = pmxt.Polymarket( pmxt_api_key="pmxt_live_...", wallet_address="0xYourWalletAddress", private_key="0xYourPrivateKey", ) # 1. Check balance balance = trader.fetch_balance() print(f"Available balance: {balance[0].available}") # 2. Fetch markets markets = trader.fetch_markets(query='Trump') # 3. Place an order order = trader.create_order( market_id=markets[0].market_id, outcome_id=markets[0].yes.outcome_id, side='buy', order_type='market', amount=5.0, denom='usdc', slippage_pct=30.0, ) print(f"Order status: {order.status}") ``` ### Self-hosted trading (advanced) Use this when you self-host the local server. See [Self-hosted](#self-hosted) for setup. You provide venue credentials directly β€” no `pmxt_api_key` required. For detailed credential setup instructions, see the exchange-specific guides: [Polymarket](core/docs/SETUP_POLYMARKET.md), [Kalshi](core/docs/SETUP_KALSHI.md), [Limitless](core/docs/SETUP_LIMITLESS.md). #### Polymarket ```python 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 ```python exchange = pmxt.Kalshi( api_key=os.getenv('KALSHI_API_KEY'), private_key=os.getenv('KALSHI_PRIVATE_KEY') # RSA Private Key ) ``` #### Limitless ```python exchange = pmxt.Limitless( api_key=os.getenv('LIMITLESS_API_KEY'), private_key=os.getenv('LIMITLESS_PRIVATE_KEY') # For order signing (EIP-712) ) ``` ## Self-hosted To self-host pmxt-core on your own machine: `pip install pmxt-core` (Python) or `npm install pmxt-core` (Node.js), then construct any venue client without `pmxt_api_key`. The SDK spawns a local PMXT service; you supply venue credentials directly. See the [self-hosted guide](https://pmxt.dev/docs/guides/self-hosted) for details. ## Documentation See the [API Reference](https://www.pmxt.dev/docs) for detailed documentation and more examples. ## Examples Check out the directory for more use cases: [TypeScript](https://github.com/pmxt-dev/pmxt/tree/main/sdks/typescript/examples) [Python](https://github.com/pmxt-dev/pmxt/tree/main/sdks/python/examples) ## Sponsors
Nearbase OnDB.ai OnDB.ai
[![Stargazers repo roster for @pmxt-dev/pmxt](https://reporoster.com/stars/pmxt-dev/pmxt)](https://github.com/pmxt-dev/pmxt/stargazers)