GX Core Tools
Overview
GX Core tools provide direct access to the GX Core matching engine, orderbook, and trading APIs. These tools are designed for trading bots, market makers, data aggregators, and applications that need low-latency access to the exchange.
API Endpoints
| Interface | URL | Protocol |
|---|---|---|
| REST API | https://api.gx.exchange/v4/ | HTTP/JSON |
| WebSocket | wss://ws.gx.exchange | WebSocket/JSON |
| Testnet REST | https://testnet-api.gx.exchange/v4/ | HTTP/JSON |
| Testnet WebSocket | wss://testnet-ws.gx.exchange | WebSocket/JSON |
REST API
Public Endpoints (No Authentication)
# Markets
GET /v4/markets
# Orderbook
GET /v4/orderbook?market=BTC-USD&depth=20
# Recent trades
GET /v4/trades?market=BTC-USD&limit=100
# Candles
GET /v4/candles?market=BTC-USD&interval=1h&limit=500
# Funding rates
GET /v4/funding?market=BTC-USD
# Open interest
GET /v4/openInterest?market=BTC-USDAuthenticated Endpoints (EIP-712 Signature Required)
# Place order
POST /v4/order
{
"market": "BTC-USD",
"side": "buy",
"type": "limit",
"price": "67400.00",
"size": "0.1",
"timeInForce": "GTC",
"signature": "0x..."
}
# Cancel order
DELETE /v4/order?orderId=12345&signature=0x...
# Account positions
GET /v4/account?address=0x...&signature=0x...
# Order history
GET /v4/orders?address=0x...&signature=0x...WebSocket API
Subscriptions
const ws = new WebSocket("wss://ws.gx.exchange");
// Subscribe to L2 orderbook
ws.send(JSON.stringify({
method: "subscribe",
subscription: { type: "l2Book", coin: "BTC" }
}));
// Subscribe to trades
ws.send(JSON.stringify({
method: "subscribe",
subscription: { type: "trades", coin: "BTC" }
}));
// Subscribe to candles
ws.send(JSON.stringify({
method: "subscribe",
subscription: { type: "candle", coin: "BTC", interval: "1m" }
}));
// Subscribe to user fills (requires auth)
ws.send(JSON.stringify({
method: "subscribe",
subscription: { type: "userFills", user: "0x..." }
}));EIP-712 Order Signing
All authenticated requests require an EIP-712 typed data signature:
const domain = {
name: "GXExchange",
version: "1",
chainId: 42069,
};
const types = {
Order: [
{ name: "market", type: "string" },
{ name: "side", type: "string" },
{ name: "price", type: "string" },
{ name: "size", type: "string" },
{ name: "nonce", type: "uint256" },
{ name: "expiry", type: "uint256" },
],
};
const signature = await wallet._signTypedData(domain, types, order);Rate Limits
| Tier | Requests/Minute | WebSocket Subscriptions |
|---|---|---|
| Free | 60 | 5 |
| Authenticated | 300 | 20 |
| GX Staker | 1,000 | 50 |
| Market Maker | 10,000 | Unlimited |
Order Types
| Type | Description |
|---|---|
limit | Limit order at specified price |
market | Market order at best available price |
stopLimit | Stop-limit trigger order |
stopMarket | Stop-market trigger order |
Time-in-Force Options
| Option | Description |
|---|---|
GTC | Good-til-cancelled |
IOC | Immediate-or-cancel |
FOK | Fill-or-kill |
PostOnly | Post-only (maker only, rejects if would cross) |
Error Codes
| Code | Description |
|---|---|
| 400 | Bad request — invalid parameters |
| 401 | Unauthorized — invalid or missing signature |
| 403 | Forbidden — rate limit exceeded |
| 404 | Not found — market or order does not exist |
| 429 | Too many requests — rate limited |
| 500 | Internal server error |