Skip to main content

Polyscript SDK — write Polymarket strategies in Python (stub package for IDE / type hints; real execution via Polyscript Editor or Desktop)

Project description

Polyscript

Python SDK for Polymarket — write trading strategies as decorator-based scripts.

import polyscript as bot

@bot.on_start
async def boot():
    print(f"wallet = {bot.account.address()}")
    bal = await bot.account.balance()
    print(f"balance = {bal.usdc} USDC")

@bot.tick(every="2s")
async def t():
    mid = await bot.market.midpoint("0xabc...")
    if mid < 0.50:
        await bot.order.place(
            asset_id="0xabc...", side="buy",
            size="10", price="0.45",
        )

@bot.on_fill
async def f(fill):
    print(f"filled {fill.size} @ {fill.price}")

Install

pip install polyscript

This package is a stub — provides type hints, dataclasses, and decorator registration for IDE support. To actually run strategies you need:

  • Polyscript Editor — Tauri desktop app for writing + running scripts locally
  • Polyscript Desktop — production host for automated trading

Both bundle the Rust SDK (the actual Polymarket integration). The stub package lets you author scripts with full IDE/type checker support before running them in the host app.

If you try to call an SDK method without a host, you'll see:

ImportError: polyscript.rust not bundled — install and use Polyscript Editor or Polyscript Desktop ...

What's included

  • Decorators: @bot.on_start, @bot.on_stop, @bot.tick(every=...), @bot.background, @bot.on_fill, @bot.on_order, @bot.on_market_resolved, @bot.on_market_opened
  • Namespaces: bot.account, bot.market, bot.markets, bot.order, bot.position, bot.bridge, bot.relayer, bot.stream
  • Models: Balance, Book, BookLevel, Order, OrderStatus, Position, Side, Fill — frozen dataclasses with computed properties

Docs

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

polyscript-0.1.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

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

polyscript-0.1.0-py3-none-any.whl (24.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: polyscript-0.1.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for polyscript-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2930378d4723b4621cea91778fd71e9948dd40580702e871f982d7085532e420
MD5 02fb4fb1542dfce6df201230335364e1
BLAKE2b-256 80703b83a651cc15319952219a33ea15560b6475de16b9d4e369c93e16580c8f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: polyscript-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 24.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for polyscript-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8e20692433e2469608f3e10a9abbf65552efa9cf9f6bbe1571a5e48405427a38
MD5 7867979fcf9c6ab39138691430027e7e
BLAKE2b-256 d88fe2c3e26dcf8008ed768f2250ec7e3a564d489f6424c5322307a89d0d195c

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