Tải xuống

Quy cách đọc được bằng máy + bộ sưu tập Postman. Tự tạo SDK của bạn bằng codegen, hoặc nhập vào bất kỳ công cụ HTTP nào.

OpenAPI 3.1 (REST)

Quy cách REST công khai — 209 paths / 240 operations trong 21 nhóm tag: Discovery, Builders, Apps, Attribution, Revenue, Orders, Auth, Subaccounts, Competitions, Composer, Weather, Liquidity, Data, Webhooks, Marketplace, Oracle, Sandbox, Audit, Portfolio, Copy trading, Provider Keys. Chuỗi Audit (/v1/audit/head, /root, /batches, /health, /anchor) là công khai và không yêu cầu xác thực. Các endpoint admin/team/settle tồn tại trong runtime nhưng được loại bỏ có chủ đích khỏi quy cách công khai. Codegen bằng openapi-generator (hỗ trợ 50+ ngôn ngữ đích).

Định dạngTệpKích thướcSử dụng
YAML openapi.yaml 273 KB Đọc được bằng người, dễ diff
JSON openapi.json 388 KB Redoc / Swagger UI / công cụ 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

AsyncAPI 2.6 (WebSocket)

Quy định WebSocket — 78 thông điệp máy chủ (Ev*) + 7 thông điệp client (Cmd*: sáu lệnh và một ping keepalive), tổng cộng 85 trong components.messages. Mỗi thông điệp mang x-access: 39 kênh public, 16 kênh account (SUBSCRIBE sau AUTH), 12 sự kiện push (gửi đến các socket đã xác thực của bạn) và 11 phản hồi control. Lệnh client: AUTH / SUBSCRIBE / UNSUBSCRIBE / LOCALE / RFQ_SUBSCRIBE / RFQ_UNSUBSCRIBE (hai động từ RFQ đăng ký socket cho các cập nhật request-for-quote). Danh sách kênh public và account khớp với ACL của gateway trực tiếp.

Định dạngTệpKích thướcSử dụng
YAML asyncapi.yaml 50 KB Đọc được bằng người, dễ diff
JSON asyncapi.json 73 KB AsyncAPI Studio, công cụ 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

Bộ sưu tập Postman

PredictAsiaX được công bố trên Postman dưới dạng Public Workspace. Hãy fork nó vào Postman workspace của bạn và nó sẽ tự động đồng bộ mỗi khi chúng tôi cập nhật spec:

Tải trực tiếp (bản sao cho môi trường cách ly / xem xét kiểm toán):

TệpMục đíchKích thước
postman.json Bộ sưu tập — tất cả 239 thao tác REST công khai với các body ví dụ, được tạo từ openapi.json; đặt apiKey trong môi trường 486 KB
pax-sandbox.postman_environment.json Môi trường sandbox — baseUrl, apiKey, bí mật HMAC <1 KB
pax-production.postman_environment.json Môi trường production — cùng cấu trúc, URL production <1 KB

Nhập vào Postman

  1. Mở Postman → Import (góc trên bên trái).
  2. Kéo cả 3 tệp (bộ sưu tập + 2 môi trường), hoặc dán các URL:
    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
  3. Bộ chọn môi trường ở góc trên bên phải → chọn PAX Sandbox.
  4. Tab Environment → điền apiKey = khóa sandbox sk_live_* của bạn (từ POST /v1/sandbox-keys, tier=sandbox). Lưu.
  5. Mở bất kỳ yêu cầu nào → nhấn Send. Xong.
Postman → cURL: Sau khi cấu hình một yêu cầu trong Postman, nhấp vào nút Code (góc trên bên phải của bảng yêu cầu) để sao chép đoạn mã cURL, Python, Node hoặc Go tương đương.

Máy chủ MCP

PredictAsiaX được công bố trong MCP Registry chính thức với tên com.predictasiax/mcp. Các ứng dụng AI-agent (Claude Desktop, Cursor, Windsurf, các agent tùy chỉnh) có thể phát hiện máy chủ thông qua tìm kiếm registry của MCP client và kết nối trực tiếp:

TrườngGiá trị
Tên đăng kýcom.predictasiax/mcp
URL máy chủhttps://mcp.predictasiax.com
Giao thức truyền tảiSSE + HTTP có thể luồng
Xác thựcBearer sk_live_* (tự tạo tại POST /v1/sandbox-keys); 19 công cụ đọc dữ liệu công khai (thị trường, sổ lệnh, phí, tài liệu) không cần thông tin xác thực
Công cụ (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 — có namespace pax.* thông qua tools/list

SDKs

Có sẵn các SDK native. Cả hai đều nhắm đến gateway tại https://api.predictasiax.com (các method thêm các đường dẫn /v1/…) với xác thực Bearer hoặc HMAC (các header PAX-*), trình xác minh kiểm toán ngoại tuyến, tự động tạo Idempotency-Key cho các thao tác ghi, và các mặc định an toàn (chỉ HTTPS, giới hạn phản hồi dạng stream, bảo vệ header CRLF, giới hạn kích thước thân phản hồi 10 MB).

Ngôn ngữGóiPhiên bảnCài đặt
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
Gothông qua OpenAPI codegen—oapi-codegen -package pax https://docs.predictasiax.com/downloads/openapi.yaml
Rustthông qua OpenAPI codegen—openapi-generator generate -g rust -i https://docs.predictasiax.com/downloads/openapi.json
50+ ngôn ngữ khácthông qua OpenAPI codegen—openapi-generator generate -g <lang> -i https://docs.predictasiax.com/downloads/openapi.json

Bắt đầu nhanh với TypeScript

# 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();

Hướng dẫn nhanh Python

# 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()

Tải trực tiếp (bản sao cho môi trường cách ly / xem xét kiểm toán; cùng các tệp như trên PyPI): pax_api-3.3.2-py3-none-any.whl (SHA-256 6be3f9ad00533b540728239b7ec133dcbfe8d118b3f3269b027765b659077bc3) · pax_api-3.3.2.tar.gz (SHA-256 c4ef72a0dbbe155f9a0c7ffd458211bb5de7198d5952b88a5bfe219fe3437c3a).

Máy chủ giả lập (Prism)

Khởi tạo một máy chủ mock cục bộ dựa trên thông số kỹ thuật OpenAPI để phát triển ngoại tuyến:

npm i -g @stoplight/prism-cli
prism mock https://docs.predictasiax.com/downloads/openapi.json
# → mock server on http://localhost:4010

Prism tạo các phản hồi giả theo các ví dụ OpenAPI — rất hữu ích cho CI hoặc phát triển client trước khi được cấp quyền truy cập sandbox.