Skip to content

pmxt-dev/pmxt

Repository files navigation

pmxt Tweet

The ccxt for prediction markets. A unified API for accessing prediction market data across multiple exchanges.

plot

Polymarket      Kalshi      Manifold Markets      Metaculus      PredictIt

Discord

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.

Quick Example

Get the current price for any market in seconds:

import pmxt from 'pmxtjs';

async function main() {
  const poly = new pmxt.Polymarket();
  const [market] = await poly.searchMarkets('Trump');

  console.log(`${market.title} - ${market.outcomes[0].label}: ${market.outcomes[0].price * 100}%`);
}

main();

Installation

npm install pmxtjs

Note for ESM Users

pmxt is currently CommonJS-only. If you're using "type": "module" in your package.json, use the default import:

import pmxt from 'pmxtjs';
const poly = new pmxt.Polymarket();

Named exports like import { Polymarket } from 'pmxtjs' will not work in ESM projects. See the API Reference for more details.

Supported Exchanges

  • Polymarket
  • Kalshi

Trading

pmxt supports trading functionality (placing and cancelling orders).

Setup

To trade, you must provide your private credentials.

  • Polymarket: Requires your Polygon Private Key. View Setup Guide
  • Kalshi: Requires API Key & Private Key.

Trading Example

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);

Documentation

See the API Reference for detailed documentation and more examples.

Examples

Check out the examples directory for more use cases:

  • Market search
  • Order book data
  • Historical prices
  • Event price tracking
  • Recent trades

Stargazers repo roster for @qoery-com/pmxt