Unduhan

Spesifikasi yang dapat dibaca mesin + koleksi Postman. Buat SDK Anda sendiri melalui codegen, atau impor ke alat HTTP apa pun.

OpenAPI 3.1 (REST)

Spesifikasi REST publik — 209 paths / 240 operations di 21 grup tag: Discovery, Builders, Apps, Attribution, Revenue, Orders, Auth, Subaccounts, Competitions, Composer, Weather, Liquidity, Data, Webhooks, Marketplace, Oracle, Sandbox, Audit, Portfolio, Copy trading, Provider Keys. Rantai audit (/v1/audit/head, /root, /batches, /health, /anchor) bersifat publik dan tanpa autentikasi. Endpoint admin/team/settle ada di runtime tetapi sengaja dikecualikan dari spesifikasi publik. Codegen menggunakan openapi-generator (50+ bahasa target).

FormatBerkasUkuranPenggunaan
YAML openapi.yaml 273 KB Bisa dibaca manusia, mudah di-diff
JSON openapi.json 388 KB Redoc / Swagger UI / alat 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)

Spesifikasi WebSocket — 94 pesan server (Ev*) + 12 pesan klien (Cmd*: sebelas perintah dan ping keepalive), total 106 di components.messages. Setiap pesan membawa x-access: 43 channel public, 16 channel account (SUBSCRIBE setelah AUTH), 20 event push (dikirim ke socket terautentikasi Anda sendiri) dan 15 balasan control. Perintah klien: AUTH / SUBSCRIBE / UNSUBSCRIBE / LOCALE / RFQ_SUBSCRIBE / RFQ_UNSUBSCRIBE (dua kata kerja RFQ mendaftarkan socket untuk pembaruan request-for-quote) / BOOK_SNAPSHOT (snapshot baru sebuah channel book:) / PLACE_ORDER / PLACE_ORDERS / CANCEL_ORDER / CANCEL_ALL (order untuk API key, masing-masing dijawab dengan balasan ber-req_id yang sama). Daftar channel public dan account sesuai dengan ACL gateway live.

FormatBerkasUkuranPenggunaan
YAML asyncapi.yaml 50 KB Bisa dibaca manusia, mudah di-diff
JSON asyncapi.json 73 KB AsyncAPI Studio, alat 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

Koleksi Postman

PredictAsiaX diterbitkan di Postman sebagai Public Workspace. Fork ke workspace Postman Anda sendiri dan ia akan tetap tersinkron saat kami memperbarui spec:

Unduhan langsung (mirror untuk airgapped / audit review):

BerkasTujuanUkuran
postman.json Koleksi — semua 239 operasi REST publik dengan contoh body, dihasilkan dari openapi.json; atur apiKey di lingkungan 486 KB
pax-sandbox.postman_environment.json Lingkungan sandbox — baseUrl, apiKey, rahasia HMAC <1 KB
pax-production.postman_environment.json Lingkungan produksi — struktur sama, URL prod <1 KB

Impor ke Postman

  1. Buka Postman → Import (kiri atas).
  2. Seret semua 3 file (koleksi + 2 lingkungan), atau tempel URL-nya:
    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. Pemilih lingkungan di kanan atas → pilih PAX Sandbox.
  4. Tab Environment → isi apiKey = kunci sandbox Anda sk_live_* (dari POST /v1/sandbox-keys, tier=sandbox). Simpan.
  5. Buka permintaan apa pun → tekan Send. Selesai.
Postman → cURL: Setelah mengonfigurasi permintaan di Postman, klik tombol Code (pojok kanan atas panel permintaan) untuk menyalin snippet cURL, Python, Node, atau Go yang setara.

MCP Server

PredictAsiaX dipublikasikan di MCP Registry resmi sebagai com.predictasiax/mcp. Aplikasi agen AI (Claude Desktop, Cursor, Windsurf, agen kustom) dapat menemukan server melalui pencarian registry klien MCP dan terhubung secara langsung:

FieldNilai
Nama registrycom.predictasiax/mcp
URL Serverhttps://mcp.predictasiax.com
TransportSSE + HTTP yang dapat di-stream
AutentikasiBearer sk_live_* (mint mandiri di POST /v1/sandbox-keys); 19 tool yang membaca data publik (market, order book, biaya, dokumentasi) tidak memerlukan kredensial
Tools (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 — dengan namespace pax.* melalui tools/list

SDK

SDK native tersedia. Keduanya menargetkan gateway di https://api.predictasiax.com (metode menambahkan path /v1/…) dengan autentikasi Bearer atau HMAC (header PAX-*), verifier audit offline, generasi otomatis Idempotency-Key pada operasi tulis, dan default yang aman (hanya HTTPS, batas respons streaming, penjaga header CRLF, batas ukuran respons 10 MB).

BahasaPaketVersiInstal
Python pax-api 3.3.3 LIVE pip install "pax-api>=3"
TypeScript / JavaScript @predictasiax/api 3.4.2 LIVE npm i @predictasiax/api@3
Gomelalui OpenAPI codegen—oapi-codegen -package pax https://docs.predictasiax.com/downloads/openapi.yaml
Rustmelalui OpenAPI codegen—openapi-generator generate -g rust -i https://docs.predictasiax.com/downloads/openapi.json
50+ bahasa lainnyamelalui OpenAPI codegen—openapi-generator generate -g <lang> -i https://docs.predictasiax.com/downloads/openapi.json

Panduan cepat 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();

Panduan cepat 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()

Unduhan langsung (mirror untuk audit review / airgapped; file yang sama dengan PyPI): pax_api-3.3.3-py3-none-any.whl (SHA-256 f655c30837de553f66a87b3a7f4ec4c91756657567940d72f2791c598da557b5) · pax_api-3.3.3.tar.gz (SHA-256 33957130fd356a5b9b80640cf3b58ff5f2e592f527e5415d1014ef3f740b3d65).

Konektor Hummingbot

predictasiax-hummingbot-v2.18.0.patch (171 KB, SHA-256 11ee15beebdfa1e0eace3b8c7eaf3f9be1bafdfe6a15bdde5fbbc80f9ff514ef). Patch ini diterapkan pada Hummingbot v2.18.0; langkah instalasi: Hummingbot connector.

Server mock (Prism)

Jalankan mock server lokal terhadap spesifikasi OpenAPI untuk pengembangan offline:

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

Prism menghasilkan respons palsu sesuai contoh OpenAPI — sangat cocok untuk CI atau pengembangan klien sebelum akses sandbox disiapkan.