Docs / Developers
API and SDK
REST
GET /api/v1/markets | listed markets with live odds |
GET /api/v1/markets/{id} | one market, its source book and health |
GET /api/v1/markets/{id}/history?range=1D | source price history (1H, 1D, 1W, 1M) |
GET /api/v1/quote?market=&side=&margin=&leverage= | entry, size, liquidation, max gain, fee at the current book |
GET /api/v1/positions?wallet= | account, open positions, history |
GET /api/v1/ledger | ledger batches and their Memos |
POST /api/trade/open|close|withdraw | signed requests, same as the app |
Signed requests
Trading through the API uses the same wallet-signed messages as the app. Sign this text with the wallet (ed25519, signMessage) and post { wallet, message, signature } with the signature in base64:
verdict.open
market: pm-123456
side: long
margin: 25
leverage: 3
wallet: <address>
nonce: <increasing integer>
time: <ISO 8601 UTC>
domain: <site host>The nonce must increase for each request and the time must be within two minutes.
SDK
A small TypeScript SDK is served from this site, built at deploy time:
curl -sO https://<site>/sdk/verdict.js
import { Verdict } from "./verdict.js";
const v = new Verdict("https://<site>");
const markets = await v.markets();
const q = await v.quote(markets[0].id, "long", 25, 3);
// with a signer: (text) => Promise<Uint8Array>
await v.open({ wallet, sign }, markets[0].id, "long", 25, 3);