Skip to main content

Polymarket Trade Executor

Trade execution library for Polymarket CLOB API.

Installation

pip install polymarket-trade-executor

For merge/split/redeem (gasless transactions):

pip install polymarket-trade-executor[relayer]

Quick Start

import asyncio
from polymarket_trade_executor import TradeExecutor, OrderSide

async def main():
    executor = TradeExecutor(
        host="https://clob.polymarket.com",
        private_key="0x...",
        funder="0x...",  # optional
        # For merge/split/redeem (optional)
        builder_api_key="xxx",
        builder_secret="xxx",
        builder_passphrase="xxx",
    )
    
    # Get balance
    balance = await executor.get_balance()
    print(f"Balance: ${balance:.2f}")
    
    # Place market order
    result = await executor.place_market_order(
        asset_id="token_id_here",
        side=OrderSide.BUY,
        amount=10.0,
    )
    
    if result:
        print(f"Order: {result.order_id} - {result.size_matched} tokens @ ${result.price}")

asyncio.run(main())

Features

Feature Requires Builder API
place_order / place_market_order ❌
post_orders (batch) ❌
get_balance / get_token_balance ❌
buy_market / sell_all (with retry) ❌
split_positions ✅
merge_positions / merge_all ✅
redeem_positions ✅

Simulation Mode

from polymarket_trade_executor import SimulateTradeExecutor

executor = SimulateTradeExecutor(starting_balance=1000.0)
# Same API as TradeExecutor, no real API calls

License

MIT

Metadata

Release files for polymarket-trade-executor 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for polymarket-trade-executor 0.1.3
File Size Uploaded
polymarket_trade_executor-0.1.3.tar.gz 17.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for polymarket-trade-executor 0.1.3
File Interpreter ABI Platform
polymarket_trade_executor-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 32.1 kB

Release files / polymarket_trade_executor-0.1.3.tar.gz

Download URL polymarket_trade_executor-0.1.3.tar.gz
Size 17.2 kB
Tags Source
SHA-256 checksum
How to use checksums
f670661e522efffd7bf1766f34c75bba5ecd093d1d668b5d95274800310ffbef
BLAKE2b-256 checksum
How to use checksums
1135f10b48849cf8738041bb73be0e7fd26cbe59c1f0017de7f3d5fe84384cac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Release files / polymarket_trade_executor-0.1.3-py3-none-any.whl

Download URL polymarket_trade_executor-0.1.3-py3-none-any.whl
Size 14.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f83268468b7440149e002c3a4392c15947185be90cfe4b6c0a94f059fd676d1c
BLAKE2b-256 checksum
How to use checksums
55e2dd1b3bb760223837d9d17701535cec1b22b7a7498977a7db7d2cd2e569db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.6

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page