Skip to main content

Trade executor for Polymarket CLOB API - supports orders, split, merge, redeem

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polymarket_trade_executor-0.1.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polymarket_trade_executor-0.1.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file polymarket_trade_executor-0.1.0.tar.gz.

File metadata

File hashes

Hashes for polymarket_trade_executor-0.1.0.tar.gz
Algorithm Hash digest
SHA256 375f278877dc644756bba87a51b59dcfd92b0bc1bdd931b490fac58ce0f622de
MD5 b77d39f1ed54347a931ce6e03b685644
BLAKE2b-256 25b50f0fa6b36f34b312557a83b3976abf4cd633b1d56ef8c0f53154b3a43fe5

See more details on using hashes here.

File details

Details for the file polymarket_trade_executor-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for polymarket_trade_executor-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ecce1af3dabc2c39ee1dbb305b1da4db8bbf0982d34852df7cdcd5dc3bcff1ce
MD5 0d9b616eefef328160c0c673f64edc24
BLAKE2b-256 1da841af924b38bd39fe7c350a3f0211959f0af7860f514f9f685a0ec76097cf

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page