> ## Documentation Index
> Fetch the complete documentation index at: https://docs.polynode.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Python Trading and Fees

> Use Python's V2 trading defaults and keep protocol fees, builder attribution, and application fees distinct.

Install the optional trading dependencies. Quote the extra so shells such as zsh do not treat brackets as a filename pattern:

For optional zero-builder attribution backed by the signing wallet, see [User-owned execution](/sdks/user-owned-execution). For an injected-wallet application, follow [Connect Wallet to order](/sdks/user-owned-web-app).

```bash theme={null}
python -m pip install "polynode[trading]>=0.14.1,<0.15"
```

Polymarket V2 is the default:

```python theme={null}
import os
from polynode.trading import ExchangeVersion, PolyNodeTrader, TraderConfig

trader = PolyNodeTrader(TraderConfig(
    polynode_key=os.environ["POLYNODE_API_KEY"],
    exchange_version=ExchangeVersion.V2,  # Optional: already the default
))

ready = await trader.ensure_ready(os.environ["POLYGON_PRIVATE_KEY"])
print("funder address", ready.funder_address)
```

`ensure_ready()` can deploy or approve wallet contracts and is state-changing for a new wallet. After the returned funder address is funded, `order(...)` places a real order:

```python theme={null}
import os
from polynode.trading import OrderParams

try:
    result = await trader.order(OrderParams(
        token_id=os.environ["POLYMARKET_TOKEN_ID"],
        side="BUY",
        price=0.55,
        size=10,
        type="GTC",
        post_only=True,
    ))
    if not result.success:
        raise RuntimeError(result.error or "Order rejected")
    print(result.order_id)
finally:
    trader.close()
```

V2 protocol fees are applied by Polymarket at match time. Do not add legacy `fee_rate_bps`, `nonce`, or `taker` fields to a V2 signed order. `builder_code` attributes eligible volume; it does not itself charge an application fee. `fee_config` is separate and disabled unless you configure it.

Read [Trading and fees](/sdks/trading) before running state-changing examples. It covers funding, cancellation, builder overrides, V2 fee behavior, position operations, and cleanup.
