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.2.tar.gz (17.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.2-py3-none-any.whl (14.9 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for polymarket_trade_executor-0.1.2.tar.gz
Algorithm Hash digest
SHA256 aa76d02654fbd79909578b7f17a5ce9c06a6c794a4af4a412c6c18160467d1c5
MD5 397270446d07a02bb31e6ecb7fb6c592
BLAKE2b-256 f21e331b196ce4e383267a96d49e3b2fd578c72d6566a0a32866d2211e6bda92

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for polymarket_trade_executor-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9ba17b78a8fa06a4a63d66b11779fe0ccd98d3e87d8a1bb3afd76838ffc45789
MD5 08544bda7826471d46d4b0b4bd75d21a
BLAKE2b-256 b385ade6f0b535e7cc11814badd043094d5933e9c680bfa027d2e6e609d9794c

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