API Reference

1. JSON‑RPC Methods

Method

Params

Returns

Description

eth_blockNumber

hex block number

Returns current block number.

eth_call

{ to, data }

hex encoded return data

Executes a call without state change.

dex_getOrderBook

{ pair: string, depth: number }

OrderBook object

Fetches on‑chain order book snapshot.

dex_placeOrder

OrderParams

txHash

Submits a signed order placement transaction.

dex_cancelOrder

{ orderId: string }

txHash

Cancels an existing order.

2. REST API

  • GET /markets — List all available trading pairs.

  • GET /markets/{pair}/trades?limit={n} — Retrieve recent trade history for a given pair.

  • GET /users/{address}/positions — Fetch open positions for a user address.

  • POST /users/{address}/orders — Create a new limit or market order; body schema: OrderParams.

  • DELETE /users/{address}/orders/{orderId} — Cancel a specific order.

3. GraphQL API

Example query:

query OrderBook($pair: String!, $limit: Int!) {
  orderBook(pair: $pair, limit: $limit) {
    bids { price, quantity }
    asks { price, quantity }
  }
}

Schemas & Models

  • OrderParams: { pair: string; side: 'buy' | 'sell'; price: string; quantity: string; type: 'limit' | 'market'; clientOrderId?: string; }

  • OrderBook: { bids: [OrderLevel]; asks: [OrderLevel]; }

  • OrderLevel: { price: string; quantity: string; }

  • Position: { id: string; pair: string; entryPrice: string; quantity: string; leverage: number; }

Authentication for REST and GraphQL requires an API key passed via Authorization: Bearer <API_KEY>.

Last updated