Developer Tools

API Documentation

Build powerful trading applications, bots, and integrations with DEGX's comprehensive REST API and WebSocket streams.

Quick Start

Get started with DEGX API in minutes. Follow these simple steps to make your first API call.

1. Get API Keys

Log into your DEGX account and navigate to API Management to generate your API key and secret.

2. Choose Your Language

Use our official SDKs for Python, JavaScript, Java, or make direct HTTP requests.

3. Test in Sandbox

Use our sandbox environment to test your integration without risking real funds.

GET
/api/v3/ping
Test connectivity to the REST API. This endpoint does not require authentication.
JavaScript
// Using fetch API
fetch('https://api.degx.com/api/v3/ping')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

// Expected response:
// {}
Python
import requests

response = requests.get('https://api.degx.com/api/v3/ping')
print(response.json())

# Expected response:
# {}

Authentication

Secure your API requests using API keys and signature-based authentication.

API Keys
All private API requests require a valid API key and signature. You can create API keys in your DEGX account settings.
Header Description Required
X-MBX-APIKEY Your API key Yes
signature HMAC SHA256 signature Yes
timestamp Current timestamp in milliseconds Yes
JavaScript
const crypto = require('crypto');

function createSignature(queryString, secret) {
  return crypto
    .createHmac('sha256', secret)
    .update(queryString)
    .digest('hex');
}

// Example for account info endpoint
const timestamp = Date.now();
const queryString = `timestamp=${timestamp}`;
const signature = createSignature(queryString, 'YOUR_API_SECRET');

const headers = {
  'X-MBX-APIKEY': 'YOUR_API_KEY',
  'Content-Type': 'application/json'
};

fetch(`https://api.degx.com/api/v3/account?${queryString}&signature=${signature}`, {
  method: 'GET',
  headers: headers
})

Market Data Endpoints

Access real-time market data including prices, order books, and trading history.

GET
/api/v3/ticker/24hr
24 hour price change statistics for all symbols or a specific symbol.
Parameter Type Description Required
symbol STRING Trading pair symbol (e.g., BTCUSDT) No
Response Example
{
  "symbol": "BTCUSDT",
  "priceChange": "-94.99999800",
  "priceChangePercent": "-95.960",
  "weightedAvgPrice": "0.29628482",
  "prevClosePrice": "0.10002000",
  "lastPrice": "4.00000200",
  "lastQty": "200.00000000",
  "bidPrice": "4.00000000",
  "askPrice": "4.00000200",
  "openPrice": "99.00000000",
  "highPrice": "100.00000000",
  "lowPrice": "0.10000000",
  "volume": "8913.30000000",
  "quoteVolume": "15.30000000",
  "openTime": 1499783499040,
  "closeTime": 1499869899040,
  "firstId": 28385,
  "lastId": 28460,
  "count": 76
}

Rate Limits

Understand and manage API rate limits to ensure optimal performance.

IP Rate Limit
1,200 requests / minute
Order Rate Limit
100 orders / 10 seconds
WebSocket Connections
5 connections / IP
Historical Data
1,000 requests / hour
Rate Limit Headers
Each API response includes headers with rate limit information to help you manage your usage.
Header Description
X-MBX-USED-WEIGHT-1M Current weight used in the last 1 minute
X-MBX-ORDER-COUNT-10S Current order count in the last 10 seconds
X-MBX-ORDER-COUNT-1D Current order count in the last 24 hours

Frequently Asked Questions

Common questions and answers about DEGX API integration.

How do I handle API rate limits?

Monitor the rate limit headers in each response and implement exponential backoff when you approach the limits. Consider using WebSocket streams for real-time data instead of frequent REST API calls.

What's the difference between REST API and WebSocket?

REST API is request-response based and suitable for occasional data fetching. WebSocket provides real-time streaming data and is more efficient for high-frequency updates like price ticks and order book changes.

How do I test my integration safely?

Use our sandbox environment at https://testnet.degx.com with test API keys. The sandbox mimics the production environment but uses test funds, allowing you to develop and test without financial risk.

What programming languages are supported?

We provide official SDKs for JavaScript/Node.js, Python, and Java. However, our REST API can be used with any programming language that can make HTTP requests. Community-maintained SDKs are also available for other languages.

How do I handle disconnections in WebSocket?

Implement automatic reconnection logic with exponential backoff. Monitor connection status and resubscribe to streams after reconnection. Always validate data integrity after reconnection.

Ready to Build with DEGX API?

Start integrating DEGX's powerful trading API into your applications. Access real-time market data, execute trades, and build advanced trading tools.