Skip to main content

Market Data Endpoints

Access comprehensive market data including prices, volumes, order book depth, and trading pairs information.

Get All Markets

Retrieve information about all available trading pairs on GTX DEX.
curl "https://api.gtxdex.xyz/api/markets"

Response

[
  {
    "symbol": "ETHUSDC",
    "baseAsset": "ETH",
    "quoteAsset": "USDC",
    "poolId": "0x123...",
    "baseDecimals": 18,
    "quoteDecimals": 6,
    "volume": "1500000000000000000000",
    "volumeInQuote": "3750000000",
    "latestPrice": "2500000000",
    "age": 86400,
    "bidLiquidity": "500000000000000000000",
    "askLiquidity": "300000000000000000000",
    "totalLiquidityInQuote": "1250000000",
    "createdAt": 1640995200
  }
]

Response Fields

FieldTypeDescription
symbolstringTrading pair symbol (e.g., “ETHUSDC”)
baseAssetstringBase currency symbol
quoteAssetstringQuote currency symbol
poolIdstringUnique pool identifier
baseDecimalsnumberDecimal places for base asset
quoteDecimalsnumberDecimal places for quote asset
volumestring24h trading volume in base asset
volumeInQuotestring24h trading volume in quote asset
latestPricestringMost recent trade price
agenumberMarket age in seconds
bidLiquiditystringTotal bid side liquidity
askLiquiditystringTotal ask side liquidity
totalLiquidityInQuotestringTotal liquidity in quote currency
createdAtnumberMarket creation timestamp

Get Trading Pairs

Get simplified trading pair information.
curl "https://api.gtxdex.xyz/api/pairs"

Response

[
  {
    "symbol": "ETHUSDC",
    "baseAsset": "ETH",
    "quoteAsset": "USDC",
    "poolId": "0x123...",
    "baseDecimals": 18,
    "quoteDecimals": 6
  }
]

Get 24hr Ticker Statistics

Get 24-hour price and volume statistics for a specific trading pair.
curl "https://api.gtxdex.xyz/api/ticker/24hr?symbol=ETHUSDC"

Parameters

ParameterTypeRequiredDescription
symbolstringYesTrading pair symbol

Response

{
  "symbol": "ETHUSDC",
  "priceChange": "50.25",
  "priceChangePercent": "2.05",
  "weightedAvgPrice": "2475.80",
  "prevClosePrice": "2450.00",
  "lastPrice": "2500.25",
  "lastQty": "1.5",
  "bidPrice": "2499.50",
  "askPrice": "2501.00",
  "openPrice": "2450.00",
  "highPrice": "2510.00",
  "lowPrice": "2440.00",
  "volume": "1500.75",
  "quoteVolume": "3712500.00",
  "openTime": 1640908800000,
  "closeTime": 1640995200000,
  "firstId": "1",
  "lastId": "1250",
  "count": 1250
}

Response Fields

FieldTypeDescription
symbolstringTrading pair symbol
priceChangestring24h price change
priceChangePercentstring24h price change percentage
weightedAvgPricestring24h weighted average price
prevClosePricestringPrevious day closing price
lastPricestringLatest trade price
lastQtystringLatest trade quantity
bidPricestringBest bid price
askPricestringBest ask price
openPricestring24h opening price
highPricestring24h highest price
lowPricestring24h lowest price
volumestring24h trading volume (base)
quoteVolumestring24h trading volume (quote)
openTimenumber24h window open time
closeTimenumber24h window close time
firstIdstringFirst trade ID in 24h
lastIdstringLast trade ID in 24h
countnumberTotal trades in 24h

Get Current Price

Get the current price for a specific trading pair.
curl "https://api.gtxdex.xyz/api/ticker/price?symbol=ETHUSDC"

Parameters

ParameterTypeRequiredDescription
symbolstringYesTrading pair symbol

Response

{
  "symbol": "ETHUSDC",
  "price": "2500.25"
}

Get Order Book Depth

Get current order book depth for a trading pair.
curl "https://api.gtxdex.xyz/api/depth?symbol=ETHUSDC&limit=100"

Parameters

ParameterTypeRequiredDefaultDescription
symbolstringYes-Trading pair symbol
limitnumberNo100Number of price levels to return

Response

{
  "lastUpdateId": 1640995200000,
  "bids": [
    ["2499.50", "1.5"],
    ["2499.00", "2.3"],
    ["2498.50", "0.8"]
  ],
  "asks": [
    ["2501.00", "1.2"],
    ["2501.50", "2.1"],
    ["2502.00", "1.8"]
  ]
}

Response Fields

FieldTypeDescription
lastUpdateIdnumberLast update timestamp
bidsarrayArray of [price, quantity] for buy orders
asksarrayArray of [price, quantity] for sell orders
Order book data is sorted by price with best bid (highest) first and best ask (lowest) first.

Error Responses

Status CodeErrorDescription
400Symbol parameter is requiredMissing required symbol parameter
404Pool not foundTrading pair does not exist
500Failed to fetch market dataInternal server error

Rate Limits

Market data endpoints have the following rate limits:
  • General market data: 1200 requests per minute
  • Order book depth: 600 requests per minute
  • 24hr ticker: 300 requests per minute
Exceeding rate limits will result in HTTP 429 responses. Implement appropriate retry logic with exponential backoff.