> For the complete documentation index, see [llms.txt](https://whitepaper.aitech.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://whitepaper.aitech.io/agentforge/tools/polymarket_trade.md).

# polymarket\_trade

### Polymarket Trade

Polymarket Trade provides trading operations for Polymarket prediction markets. It can create orders, cancel orders, list open orders, check balances, view active positions, and derive API keys.

In Agent Forge, the Polymarket Trade integration is intended for workflows that need to manage orders programmatically. Because trading operations can have financial impact, configure credentials carefully and test workflows before using them in production.

### Usage Instructions

Provide the required private key and Polymarket API credentials, then choose a trading operation. Creating an order requires a token ID, side, price, size, order type, and funder address.

{% hint style="warning" %}
Trading actions can move funds or modify live orders. Use dedicated wallets, limit permissions where possible, and verify all workflow inputs before deploying automated trading workflows.
{% endhint %}

### Tools

#### Orders

* `polymarket_trade_create_order` - Create an order
* `polymarket_trade_cancel_order` - Cancel a specific order
* `polymarket_trade_cancel_all_orders` - Cancel all open orders

#### Account

* `polymarket_trade_get_open_orders` - List open orders
* `polymarket_trade_get_account_balance` - Get account balance
* `polymarket_trade_get_balance` - Get token balance
* `polymarket_trade_get_active_positions` - Get active positions

#### Setup

* `polymarket_trade_derive_api_keys` - Derive Polymarket API credentials from a private key

### Common Inputs

| Parameter       | Type   | Required           | Description                                             |
| --------------- | ------ | ------------------ | ------------------------------------------------------- |
| `privateKey`    | string | Yes                | Ethereum private key for signing                        |
| `apiKey`        | string | Most operations    | Polymarket L2 API key                                   |
| `apiSecret`     | string | Most operations    | Polymarket L2 API secret                                |
| `apiPassphrase` | string | Most operations    | Polymarket L2 API passphrase                            |
| `funderAddress` | string | Operation-specific | Proxy wallet or funder address                          |
| `signatureType` | string | No                 | Signature type, such as EOA, Poly Proxy, or Gnosis Safe |
| `tokenId`       | string | Operation-specific | CLOB token ID                                           |
| `side`          | string | For create order   | `BUY` or `SELL`                                         |
| `price`         | string | For create order   | Order price between 0 and 1                             |
| `size`          | string | For create order   | Order size in shares                                    |
| `orderType`     | string | For create order   | `GTC`, `GTD`, `FOK`, or `FAK`                           |
| `orderId`       | string | For cancel order   | Order ID to cancel                                      |
| `market`        | string | No                 | Market condition ID filter                              |

### Output

| Parameter  | Type | Description                   |
| ---------- | ---- | ----------------------------- |
| `response` | json | Polymarket Trade API response |

### Notes

* Category: `tools`
* Type: `polymarket_trade`
* Derived API keys are stored as environment variables instead of being printed to workflow output.
