สเปกที่เครื่องอ่านได้ + Postman collection สร้าง SDK ของคุณเอง หรือนำเข้าเครื่องมือ HTTP ใดก็ได้
สเปก REST สาธารณะ — 209 paths / 240 operations ใน 21 กลุ่ม tag: Discovery, Builders, Apps, Attribution, Revenue, Orders, Auth, Subaccounts, Competitions, Composer, Weather, Liquidity, Data, Webhooks, Marketplace, Oracle, Sandbox, Audit, Portfolio, Copy trading, Provider Keys. Audit chain (/v1/audit/head, /root, /batches, /health, /anchor) เป็นสาธารณะและไม่ต้องใช้ auth. Endpoint สำหรับ Admin/team/settle มีอยู่ใน runtime แต่ถูกตัดออกจากสเปกสาธารณะโดยเจตนา. สร้างโค้ดด้วย openapi-generator (รองรับภาษาเป้าหมาย 50+ ภาษา).
| รูปแบบ | ไฟล์ | ขนาด | การใช้งาน |
|---|---|---|---|
| YAML | openapi.yaml | 273 KB | อ่านง่ายสำหรับมนุษย์ และ diff ง่าย |
| JSON | openapi.json | 388 KB | Redoc / Swagger UI / เครื่องมือ codegen |
# Codegen Python client
openapi-generator generate -i https://docs.predictasiax.com/downloads/openapi.json -g python -o pax-python-client
# Codegen TypeScript axios client
openapi-generator generate -i https://docs.predictasiax.com/downloads/openapi.json -g typescript-axios -o pax-ts-client
# Codegen Go client
openapi-generator generate -i https://docs.predictasiax.com/downloads/openapi.json -g go -o pax-go-client
สเปก WebSocket — ข้อความจากเซิร์ฟเวอร์ 78 รายการ (Ev*) + ข้อความจากไคลเอนต์ 7 รายการ (Cmd*: คำสั่ง 6 รายการและ ping keepalive) รวม 85 รายการใน components.messages แต่ละข้อความมี x-access: ช่อง public 39 ช่อง, ช่อง account 16 ช่อง (SUBSCRIBE หลัง AUTH), เหตุการณ์ push 12 รายการ (ส่งไปยัง sockets ที่ยืนยันตัวตนของคุณแล้ว) และคำตอบ control 11 รายการ คำสั่งไคลเอนต์: AUTH / SUBSCRIBE / UNSUBSCRIBE / LOCALE / RFQ_SUBSCRIBE / RFQ_UNSUBSCRIBE (คำกริยา RFQ ทั้งสองรายการใช้ลงทะเบียน socket สำหรับอัปเดต request-for-quote) รายการช่อง public และ account ตรงกับ ACL ของ gateway ที่ทำงานจริง
| รูปแบบ | ไฟล์ | ขนาด | การใช้งาน |
|---|---|---|---|
| YAML | asyncapi.yaml | 50 KB | อ่านง่ายสำหรับมนุษย์ และ diff ง่าย |
| JSON | asyncapi.json | 73 KB | AsyncAPI Studio, เครื่องมือ codegen |
# Codegen Node.js WebSocket client from AsyncAPI
npm i -g @asyncapi/generator
ag https://docs.predictasiax.com/downloads/asyncapi.json @asyncapi/nodejs-ws-template -o pax-ws-client
PredictAsiaX ได้เผยแพร่บน Postman ในรูปแบบ Public Workspace คุณสามารถ Fork ไปยัง Postman workspace ของคุณเอง และมันจะซิงค์อัตโนมัติเมื่อเราอัปเดต spec:
PredictAsiaX API · 1 collection + 2 environments (production + แซนด์บ็อกซ์).PAX Sandbox และตั้งค่า apiKey เป็น sk_live_* ของคุณจาก POST /v1/sandbox-keysดาวน์โหลดโดยตรง (mirror สำหรับ airgapped / การตรวจสอบ):
| ไฟล์ | วัตถุประสงค์ | ขนาด |
|---|---|---|
| postman.json | Collection — REST operations สาธารณะทั้งหมด 239 รายการ พร้อมตัวอย่าง body สร้างจาก openapi.json; ตั้งค่า apiKey ใน environment |
486 KB |
| pax-sandbox.postman_environment.json | สภาพแวดล้อมแซนด์บ็อกซ์ — baseUrl, apiKey, HMAC secrets |
<1 KB |
| pax-production.postman_environment.json | สภาพแวดล้อม Production — โครงสร้างเดียวกัน, URL สำหรับ prod | <1 KB |
https://docs.predictasiax.com/downloads/postman.json
https://docs.predictasiax.com/downloads/pax-sandbox.postman_environment.json
https://docs.predictasiax.com/downloads/pax-production.postman_environment.json
apiKey = คีย์แซนด์บ็อกซ์ของคุณ sk_live_* (จาก POST /v1/sandbox-keys, tier=sandbox) แล้วบันทึกPredictAsiaX ได้เผยแพร่ใน MCP Registry อย่างเป็นทางการที่ registry.modelcontextprotocol.io ภายใต้ชื่อ com.predictasiax/mcp แอปพลิเคชัน AI-agent (Claude Desktop, Cursor, Windsurf, custom agents) สามารถค้นหาเซิร์ฟเวอร์ผ่าน registry search ของ MCP client และเชื่อมต่อได้โดยตรง:
| ฟิลด์ | ค่า |
|---|---|
| ชื่อในทะเบียน | com.predictasiax/mcp |
| URL ของเซิร์ฟเวอร์ | https://mcp.predictasiax.com |
| Transport | SSE + HTTP ที่สามารถสตรีมได้ |
| การยืนยันตัวตน (Auth) | Bearer sk_live_* (สร้างด้วยตนเองที่ POST /v1/sandbox-keys); เครื่องมือ 19 ตัวที่อ่านข้อมูลสาธารณะ (ตลาด, Order Book, ค่าธรรมเนียม, เอกสาร) ไม่ต้องการข้อมูลรับรอง |
| เครื่องมือ (46) | market_search, market_get, market_orderbook, market_price_history, probability_movers, markets_top_volume, category_list, portfolio_read, portfolio_history, balance_get, positions_list, subaccount_list, place_order, cancel_order, cancel_all_orders, orders_open, orders_history, fee_estimate, mm_stipend_estimate, mm_stipend_history, liquidity_leaderboard, subaccount_create, subaccount_transfer, subaccount_close, composer_templates_list, composer_template_get, composer_proposal_submit, resolution_evidence, mm_quote_post, mm_quotes_list, rfq_create, rfq_accept, builder_me, builder_apps_list, builder_apikeys_list, tier_status, fee_ledger_read, webhook_endpoints_list, webhook_create, webhook_deliveries, access_request_create, access_request_status, docs_search, docs_read, sandbox_agent_examples, health — ใช้ namespace pax.* ผ่าน tools/list |
มี Native SDK ให้ใช้ ทั้งสองตัวมุ่งเป้าไปที่ gateway ที่ https://api.predictasiax.com (methods จะเพิ่มเส้นทาง /v1/…) พร้อมการยืนยันตัวตนด้วย Bearer หรือ HMAC (headers PAX-*), ตัวตรวจสอบ audit แบบออฟไลน์, การสร้าง Idempotency-Key อัตโนมัติเมื่อมีการเขียนข้อมูล และค่าเริ่มต้นที่ปลอดภัย (เฉพาะ HTTPS, จำกัดขนาด response แบบ streamed, ป้องกัน CRLF-header, จำกัดขนาด response body ที่ 10 MB)
| ภาษา | แพ็กเกจ | เวอร์ชัน | ติดตั้ง |
|---|---|---|---|
| Python | pax-api |
3.3.2 LIVE | pip install "pax-api>=3" |
| TypeScript / JavaScript | @predictasiax/api |
3.4.1 LIVE | npm i @predictasiax/api@3 |
| ไป | ผ่าน OpenAPI codegen | — | oapi-codegen -package pax https://docs.predictasiax.com/downloads/openapi.yaml |
| Rust | ผ่าน OpenAPI codegen | — | openapi-generator generate -g rust -i https://docs.predictasiax.com/downloads/openapi.json |
| อีก 50+ ภาษา | ผ่าน OpenAPI codegen | — | openapi-generator generate -g <lang> -i https://docs.predictasiax.com/downloads/openapi.json |
# npm i @predictasiax/api@3 (2.x cannot authenticate against the current gateway)
import { PaxClient } from '@predictasiax/api';
// 1. Public endpoints need no key; mint a sandbox key (api_key is shown once)
const pub = new PaxClient();
const minted = await pub.sandboxKeys.mint({ orgName: 'my-app' });
// 2. Use the key: Authorization: Bearer sk_live_...
// (or { apiKey, keyId: 'api_...' } to HMAC-sign with PAX-* headers instead)
const pax = new PaxClient({ apiKey: minted.api_key });
for await (const market of pax.markets.list({ category: 'crypto' })) {
console.log(market.id, market.title);
}
// Limit BUY of one outcome. Idempotency-Key and client_order_id are generated
// once per call and reused across retries.
const { data, requestId } = await pax.orders.place({
marketId: 'hadjar-f1-2026', side: 'yes', price: '0.05', size: '20',
}).withResponse();
console.log('Order:', data, 'Request:', requestId);
// Price an order first (public, nothing placed), then wait for the fill and the settlement.
// Both waits read the result over REST and ride out 429, 5xx and network errors.
const q = await pub.markets.quote('hadjar-f1-2026', { side: 'yes', amount: 25 });
console.log(q.fill?.avg_price, q.fill?.fee_usdt, q.fill?.filled_all);
const { status, filledSize } = await pax.orders.waitForFill(data, { marketId: 'hadjar-f1-2026', timeoutMs: 30_000 });
const res = await pub.markets.waitForSettlement('hadjar-f1-2026'); // until status "settled"
// Offline audit verification
console.log((await pub.audit.verify(110841)).ok);
// WebSocket streaming
import { PaxWSClient } from '@predictasiax/api';
const ws = new PaxWSClient({ apiKey: minted.api_key, subscribeOnConnect: ['fast_tick', 'account'] });
ws.on('fast_tick', (e) => console.log(e));
await ws.connect();
# pip install "pax-api>=3" (2.x cannot authenticate against the current gateway)
from pax_api import PaxClient
# 1. Public endpoints need no key; mint a sandbox key (api_key is shown once)
key = PaxClient().mint_sandbox_key(org_name="my-app")["data"]["api_key"]
# 2. Use the key: Authorization: Bearer sk_live_...
# (or PaxClient(api_key=key, key_id="api_...") to HMAC-sign instead)
pax = PaxClient(api_key=key)
print(pax.get_balance())
# 3. Limit BUY of one outcome; client_order_id + Idempotency-Key fixed across retries
order = pax.place_order(market_id="hadjar-f1-2026", side="yes", price="0.05", size="20")
# Price an order first (public, nothing placed), then wait for the fill and the settlement.
# Both waits read the result over REST and ride out 429, 5xx and connection errors.
q = PaxClient().quote("hadjar-f1-2026", side="yes", amount=25)["data"]
print(q["fill"])
r = pax.wait_for_fill(order, market_id="hadjar-f1-2026", timeout=30) # r["status"], r["filled_size"]
res = PaxClient().wait_for_settlement("hadjar-f1-2026") # until status "settled"
# Offline audit verification
print(PaxClient().verify_audit_event(110841)["ok"])
# WebSocket streaming (multiplexed subscriptions, sequence# gap detection)
from pax_api import PaxWSClient
ws = PaxWSClient(api_key=key)
ws.on("fast_tick", lambda evt: print("tick:", evt))
ws.subscribe(["fast_tick", "orderbook", "account"])
ws.run_forever()
ดาวน์โหลดโดยตรง (mirror สำหรับ airgapped / การตรวจสอบ; ไฟล์เดียวกับบน PyPI): pax_api-3.3.2-py3-none-any.whl (SHA-256 6be3f9ad00533b540728239b7ec133dcbfe8d118b3f3269b027765b659077bc3) · pax_api-3.3.2.tar.gz (SHA-256 c4ef72a0dbbe155f9a0c7ffd458211bb5de7198d5952b88a5bfe219fe3437c3a).
เริ่มใช้ local mock server ตามสเปก OpenAPI เพื่อพัฒนาแบบออฟไลน์:
npm i -g @stoplight/prism-cli
prism mock https://docs.predictasiax.com/downloads/openapi.json
# → mock server on http://localhost:4010
Prism สร้างการตอบกลับจำลองตามตัวอย่างใน OpenAPI — เหมาะสำหรับการทดสอบ CI หรือการพัฒนา client ก่อนที่จะได้รับสิทธิ์เข้าถึงแซนด์บ็อกซ์