API Reference

Complete documentation for accessing Gothix AI platform data and services

🔗 Base URL & Configuration

Base URL: http://your-bot-server-ip:3001/api

All API endpoints are prefixed with the base URL above. Replace your-bot-server-ip with your actual bot server IP address.

Configuration

Update the API configuration in your JavaScript:

const API_CONFIG = {
    baseUrl: 'http://YOUR_BOT_SERVER_IP:3001/api',
    endpoints: {
        platformStats: '/platform/stats',
        activeTrades: '/trades/active',
        recentTrades: '/trades/recent',
        participants: '/participants/stats',
        tradingPairs: '/trading-pairs',
        performance: '/performance/daily',
        health: '/system/health'
    }
};
GET

📊 Platform Statistics

Retrieve comprehensive platform statistics including user counts, trading metrics, and financial data.

/platform/stats

Response Schema

Field Type Description
platform.totalUsers number Total number of registered users
platform.activeTraders number Users with trading enabled
platform.tradingPairs number Number of active trading pairs
platform.totalVolume string Formatted total trading volume
trading.totalTrades number Total number of pool trades
trading.successRate number Success rate percentage

Example Response

{
  "platform": {
    "totalUsers": 1247,
    "activeTraders": 834,
    "tradingPairs": 10,
    "totalVolume": "2.4M",
    "totalVolumeRaw": 2400000
  },
  "trading": {
    "totalTrades": 3892,
    "todayTrades": 45,
    "successRate": 72,
    "activeNetworks": 3
  },
  "financial": {
    "totalDeposits": "1.8M",
    "totalWithdrawals": "1.2M",
    "depositCount": 2341,
    "withdrawalCount": 1567,
    "totalTransactions": 3908
  },
  "uptime": {
    "status": "online",
    "availability": "99.9%",
    "lastUpdate": "2024-12-19T10:30:00.000Z"
  }
}
GET

📈 Active Trades

Get currently active pool trades with participant information.

/trades/active

Example Response

{
  "count": 2,
  "trades": [
    {
      "id": 156,
      "pair": "BTC/USDT",
      "type": "LONG",
      "entryPrice": 43250.50,
      "amount": 12500.00,
      "leverage": 10,
      "participants": 23,
      "participantsList": [
        {
          "name": "John D.",
          "amount": 500.00
        }
      ],
      "openedAt": "2024-12-19T09:15:00.000Z",
      "scheduledCloseTime": "2024-12-19T10:45:00.000Z",
      "targetProfitPercentage": 1.8,
      "status": "OPEN"
    }
  ]
}
GET

📉 Recent Trades

Retrieve recently completed trades with profit/loss information.

/trades/recent?limit=10

Query Parameters

Parameter Type Default Description
limit number 10 Number of trades to return (max 50)

Example Response

{
  "count": 5,
  "trades": [
    {
      "id": 155,
      "pair": "ETH/USDT",
      "type": "SHORT",
      "entryPrice": 2340.75,
      "exitPrice": 2298.50,
      "amount": 8750.00,
      "profit": 157.50,
      "profitPercentage": 1.8,
      "leverage": 15,
      "participants": 18,
      "openedAt": "2024-12-19T08:30:00.000Z",
      "closedAt": "2024-12-19T09:15:00.000Z",
      "duration": 45,
      "isWin": true,
      "status": "CLOSED"
    }
  ]
}
GET

👥 Participant Statistics

Get detailed statistics about trading participants and performance.

/participants/stats

Example Response

{
  "totalParticipations": 5678,
  "uniqueParticipants": 834,
  "activeParticipants": 45,
  "topPerformers": [
    {
      "name": "Anonymous",
      "profit": 245.80,
      "amount": 1000.00
    }
  ]
}
GET

💹 Trading Pairs

List all available trading pairs with trade counts.

/trading-pairs

Example Response

{
  "count": 10,
  "pairs": [
    {
      "id": 1,
      "symbol": "BTC/USDT",
      "name": "Bitcoin / Tether",
      "active": true,
      "totalTrades": 892
    },
    {
      "id": 2,
      "symbol": "ETH/USDT",
      "name": "Ethereum / Tether",
      "active": true,
      "totalTrades": 743
    }
  ]
}
GET

📊 Performance Metrics

Get daily performance metrics for the specified time period.

/performance/daily?days=7

Query Parameters

Parameter Type Default Description
days number 7 Number of days to retrieve (max 30)

Example Response

{
  "period": "7 days",
  "data": [
    {
      "date": "2024-12-19",
      "totalTrades": 45,
      "completedTrades": 42,
      "totalVolume": 125000,
      "totalProfit": 75.6,
      "successRate": 74,
      "averageProfit": 1.8
    }
  ]
}
GET

🔍 System Health

Check the overall health and status of the trading system.

/system/health

Example Response

{
  "status": "healthy",
  "timestamp": "2024-12-19T10:30:00.000Z",
  "uptime": 2547891,
  "database": "connected",
  "recentActivity": 45,
  "settings": {
    "winPercentage": "70",
    "dailyTarget": "3",
    "poolTradePercentage": "10"
  }
}

⚠️ Error Handling

All API endpoints return appropriate HTTP status codes and error messages.

HTTP Status Codes

Status Code Description
200 Success - Request completed successfully
404 Not Found - API endpoint not found
500 Internal Server Error - Server-side error occurred

Error Response Format

{
  "error": "Failed to retrieve platform statistics",
  "timestamp": "2024-12-19T10:30:00.000Z"
}

Best Practices

  • Always check the HTTP status code before processing responses
  • Implement fallback mechanisms for when the API is unavailable
  • Cache responses appropriately to reduce API load
  • Use reasonable request intervals (recommended: 30 seconds minimum)