Documentation Index
Fetch the complete documentation index at: https://docs-t.aionmarket.com/llms.txt
Use this file to discover all available pages before exploring further.
Charge the 1% platform trading fee for a Polymarket order via Safe AllowanceModule.
Overview
After a successful Polymarket trade, the platform charges a 1% fee on the order’s notional value (orderSize × price). Fees are denominated in pUSD on Polygon.
Fee collection is handled automatically by a server-side cron (every 3 seconds), but agents can also trigger it explicitly via this endpoint.
Fee Calculation
fee = orderSize × price × 0.01
Example: 100 contracts at 0.55→notional=55 → fee = $0.55 pUSD
0xeA44cAF1f893729342dC5D8903F658E8D3e2379B
Prerequisites
- Agent registered and order placed via
POST /markets/trade
- Safe AllowanceModule enabled on user’s Polygon Safe wallet
- Fireblocks platform address added as delegate in the AllowanceModule
- Sufficient pUSD allowance set on the AllowanceModule for the platform delegate
Path Parameters
| Parameter | Type | Required | Description |
|---|
orderHashId | string | Yes | Polymarket CLOB order hash (e.g. 0xabc123...) |
Response
Fireblocks transaction ID for tracking the fee transfer
Fee amount charged in pUSD (6 decimals)
Transaction status — typically PENDING initially, confirmed by Fireblocks webhook
Examples
curl -X POST "https://pm-t1.bxingupdate.com/bvapi/aiagent/charge-fee/polymarket/0xabc123def456" \
-H "Authorization: Bearer YOUR_API_KEY"
from aion_sdk import AionMarketClient
client = AionMarketClient(
api_key="YOUR_API_KEY",
base_url="https://pm-t1.bxingupdate.com/bvapi",
)
# After placing a successful Polymarket trade
result = client.trade({...})
order_hash_id = result.get("orderId")
# Charge the 1% platform fee
fee_result = client.charge_polymarket_fee(order_hash_id)
print(f"Fee: ${fee_result['feeAmount']}")
print(f"Transaction: {fee_result['transactionId']}")
print(f"Status: {fee_result['status']}")
Error Responses
| Status | Code | Description |
|---|
| 400 | ORDER_NOT_FOUND | Order hash not found in system |
| 400 | SAFE_NOT_CONFIGURED | User’s Safe wallet address not configured |
| 400 | INVALID_FEE_AMOUNT | Calculated fee is zero or negative |
| 400 | ALLOWANCE_INSUFFICIENT | Safe AllowanceModule has insufficient pUSD allowance |
| 500 | FIREBLOCKS_ERROR | Fireblocks API call failed |
Notes
- Polymarket fees are also collected automatically by a cron job every 3 seconds
- If the fee has already been charged (order
handleStatus = 1), calling this endpoint again is a no-op
- The
transactionId can be used to poll Fireblocks for final confirmation status
- Agent commission (10% of fee) is recorded automatically when fee is charged
Authorization
string
header
default:YOUR_API_KEY
required
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Polymarket CLOB order hash (e.g. 0xabc123...)
Fireblocks transaction ID
Fee amount in USDC.e (6 decimals)
Available options:
PENDING,
COMPLETED,
FAILED