Signature
client.buy(
token_id: str,
shares: float = None,
price: float = None,
usdc_amount: float = None,
order_type: str = "GTC"
) -> Dict
Parameters
| Parameter | Type | Description |
|---|
token_id | string | Required. The outcome token ID to buy |
shares | float | Number of shares to buy |
price | float | Limit price per share (0.01 - 0.99). Required for GTC orders |
usdc_amount | float | USDC to spend. For market orders only |
order_type | string | GTC (limit), FOK (fill or kill), or FAK (market). Default: GTC |
Returns
| Field | Type | Description |
|---|
success | bool | Whether the order was placed successfully |
orderID | string | The created order ID |
status | string | Order status (see below) |
takingAmount | string | Shares received (for BUY orders) |
makingAmount | string | USDC spent (for BUY orders) |
transactionsHashes | list | Transaction hashes from Polymarket |
errorMsg | string | Error message if order failed (optional) |
Status Values
GTC (limit) orders:
live: Order placed on the order book
PLACED: Order successfully created
Market orders (FOK/FAK):
matched: Order filled immediately
delayed: Order accepted but processing
unmatched: Order couldn’t be filled (FOK rejected, FAK partially filled)
Example
from polyhush import PolyhushClient
client = PolyhushClient(api_key="your-api-key")
# Limit order - sits on book until filled
result = client.buy(token_id="123...", shares=100, price=0.55)
print(f"Order {result['orderID']} status: {result['status']}")
# Market order - fills immediately at best available price
result = client.buy(token_id="123...", usdc_amount=50, order_type="FAK")
Market Order Minimums: FOK/FAK orders have minimum size requirements that vary by market. Very small orders (e.g., < $1) may be rejected. If your order fails with “minimum order size” error, increase the amount.
Order Types
| Type | Behavior |
|---|
GTC | Sits on order book until filled or cancelled |
FOK | Must fully fill immediately or cancel entirely |
FAK | Fills what’s available immediately (market order) |