XDCTrade API
REST + WebSocket API for trading bots and integrations
Base URL
https://api.xdctrade.xyz/api/v1
WebSocket
wss://api.xdctrade.xyz/ws
Rate Limit
300 requests/min (read), 60/min (write)
Quick Start
// TypeScript
import { XDCTradeClient } from '@xdctrade/sdk';
const client = new XDCTradeClient('https://api.xdctrade.xyz');
const markets = await client.getMarkets();
const book = await client.getOrderBook(1);
const result = await client.submitOrder({
owner: '0x...', market_id: 1, side: 'Buy',
price: '65000', size: '1'
});
// WebSocket
client.connect();
client.subscribe('ticker:1', (data) => console.log(data));REST Endpoints
GET/marketsList all markets
GET/markets/:id/orderbookGet order book
GET/markets/:id/tickerGet ticker data
GET/candles/:id?resolution=1hGet OHLCV candles
GET/trades/:marketIdGet recent trades
GET/positions/:addressGet open positions
GET/orders/:addressGet open orders
POST/ordersSubmit new order
DELETE/orders/:idCancel order
GET/collateral/:addressGet collateral balance
POST/collateral/depositDeposit collateral
GET/leaderboardGet leaderboard rankings
GET/points/:addressGet points balance
GET/vault/stateGet vault TVL and APY
POST/vault/depositDeposit to vault
GET/staking/stateGet staking stats
POST/staking/stakeStake PRFI tokens
GET/competitionsList competitions
GET/builder-codesList builder codes
GET/statsProtocol statistics
GET/spotList spot markets
POST/spot/orderPlace spot order
GET/options/chainsOption chains
POST/options/orderPlace option order
GET/prelaunchPre-launch markets
GET/whales/activityWhale activity feed
POST/agentsCreate AI trading agent
POST/otc/rfqRequest for quote
GET/bridge/chainsSupported bridge chains
GET/oracle/pricesOracle price feeds
POST/paper/orderPaper trade order
GET/funding-arb/comparisonFunding rate comparison
POST/orders/twapSubmit TWAP order
GET/healthHealth check
WebSocket Channels
ticker:{marketId}Real-time price updates
orderbook:{marketId}Live order book updates
trades:{marketId}Real-time trade stream
blocksNew block notifications
// Subscribe: { "action": "subscribe", "channel": "ticker:1" }
// Unsubscribe: { "action": "unsubscribe", "channel": "ticker:1" }API Key Management
Include your API key in request headers: X-API-Key: your-key
Connect wallet to manage API keys