# Current hosted venues are funded once on Polygon — see /guides/escrow-lifecycle.
# Hosted writes need: pmxt_api_key + wallet_address + private_key (signs EIP-712 locally).
# Pass an outcome straight from client.fetch_markets() — no UUID lookup needed.
import pmxt
client = pmxt.Polymarket(
pmxt_api_key="YOUR_PMXT_API_KEY",
wallet_address="0xYourWallet", # EVM address — its Polygon USDC funds the escrow
private_key="0x...", # any EVM key controlling that address
)
market = client.fetch_markets({"query": "trump 2028"})[0]
yes = next(o for o in market.outcomes if o.label.lower() == "yes")
order = client.build_order(
outcome=yes,
side="buy",
type="limit",
amount=10,
price=0.55,
)
print(order.id, order.status){
"built_order_id": "<string>",
"side": "buy",
"typed_data": {},
"quote": {
"best_price": 123,
"expected_avg_price": 123,
"expected_slippage_pct": 123,
"estimated_cost_or_proceeds": 123,
"fillable": true,
"liquidity": 123,
"fee_amount": 123,
"tick_size": "<string>"
},
"pull_typed_data": {},
"resolved": {
"venue": "polymarket",
"token_id": "<string>",
"neg_risk": true,
"tick_size": 123,
"opinion_market_id": 123
}
}{
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
}
}{
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
}
}{
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
}
}{
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
}
}{
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
}
}Build Order
Build an order without placing it. Returns the order’s typed-data payload (for the wallet to sign) plus a built_order_id to pass to submitOrderHosted once it’s signed.
Use this when you want a human to approve each trade before it submits — for example, surfacing the order details in a wallet popup. For everything else, use createOrderHosted, which builds + signs + submits in one call.
# Current hosted venues are funded once on Polygon — see /guides/escrow-lifecycle.
# Hosted writes need: pmxt_api_key + wallet_address + private_key (signs EIP-712 locally).
# Pass an outcome straight from client.fetch_markets() — no UUID lookup needed.
import pmxt
client = pmxt.Polymarket(
pmxt_api_key="YOUR_PMXT_API_KEY",
wallet_address="0xYourWallet", # EVM address — its Polygon USDC funds the escrow
private_key="0x...", # any EVM key controlling that address
)
market = client.fetch_markets({"query": "trump 2028"})[0]
yes = next(o for o in market.outcomes if o.label.lower() == "yes")
order = client.build_order(
outcome=yes,
side="buy",
type="limit",
amount=10,
price=0.55,
)
print(order.id, order.status){
"built_order_id": "<string>",
"side": "buy",
"typed_data": {},
"quote": {
"best_price": 123,
"expected_avg_price": 123,
"expected_slippage_pct": 123,
"estimated_cost_or_proceeds": 123,
"fillable": true,
"liquidity": 123,
"fee_amount": 123,
"tick_size": "<string>"
},
"pull_typed_data": {},
"resolved": {
"venue": "polymarket",
"token_id": "<string>",
"neg_risk": true,
"tick_size": 123,
"opinion_market_id": 123
}
}{
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
}
}{
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
}
}{
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
}
}{
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
}
}{
"error": {
"message": "<string>",
"code": "HOSTED_TRADING_ERROR",
"retryable": true,
"exchange": "<string>",
"detail": {}
}
}Authorizations
Body
Hosted build-order request. Identify the target outcome by passing venue + venue_outcome_id from client.fetch_markets() (the SDK does this automatically when you pass outcome= to create_order or build_order).
Maximum acceptable slippage as a percent. Use aggressive defaults (30 for buys, 99.9 for sells) until the upstream economic validator tightens -- lower values frequently trip precision checks. Ignored for market orders, which pin worst-price to the domain extreme; the server defaults to 20 when omitted.
0 <= x <= 100Response
Built order with typed data to sign.
Hosted build-order response. The caller must sign typed_data locally (and pull_typed_data if present) and POST the signatures back via submitOrderHosted before the order expires.
Was this page helpful?

