Metadata-Version: 2.4
Name: polyscript
Version: 0.1.0
Summary: Polyscript SDK — write Polymarket strategies in Python (stub package for IDE / type hints; real execution via Polyscript Editor or Desktop)
Author-email: Polyscript <admin@polyscript.io>
License: MIT
Project-URL: Homepage, https://polyscript.io
Keywords: polymarket,trading,prediction-market,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# Polyscript

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

```python
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

```bash
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

- https://polyscript.io
