E5D8 GitHub - pmxt-dev/pmxt: A unified API for trading across prediction markets.
[go: up one dir, main page]

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.

Installation

Python

pip install pmxt

Node.js

npm install pmxtjs

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.Polymarket()

# 1. Search for the broad Event
events = api.search_events('Who will Trump nominate as Fed Chair?')
fed_event = events[0]

# 2. Search for the specific Market within that event
warsh = fed_event.search_markets('Kevin Warsh')[0]

print(f"Price: {warsh.yes.price}")

TypeScript

import pmxt from 'pmxtjs';

const api = new pmxt.Polymarket();

// 1. Search for the broad Event
const events = await api.searchEvents('Who will Trump nominate as Fed Chair?');
const fedEvent = events[0];

// 2. Search for the specific Market within that event
const warsh = fedEvent.searchMarkets('Kevin Warsh')[0];

console.log(`Price: ${warsh.yes?.price}`);

Supported Exchanges

  • Polymarket
  • Kalshi

Trading

pmxt supports unified trading across exchanges.

Setup

To trade, you must provide your private credentials.

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

Example (Python)

import pmxt
import os

exchange = pmxt.Polymarket(
    private_key=os.getenv('POLYMARKET_PRIVATE_KEY')
)

# 1. Check Balance
balance = exchange.fetch_balance()
print(f"Available USDC: {balance[0].available}")

# 2. Place an Order
# Use unique outcome IDs from market.outcomes
order = exchange.create_order(
    market_id='market-123',
    outcome_id='outcome-456',
    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:

TypeScript Python

Stargazers repo roster for @pmxt-dev/pmxt

Packages

No packages published

Contributors 2

  •  
  •  
0