Connecting via API

Testnet Connection URL: wss://api.gte.xyz/ws

Once connected, you can send subscription messages to receive real-time updates.

Include some code snippets here of how to connect to WS via endpoint

Streams

Orderbook

The orderbook channel provides real-time updates for the order book of a specified trading pair.

Request Format

Orderbook Subscription Request
{
    "method": "subscribe",
    "subscription": "orderbook",
    "args": {
        "pair": "ETH-USDC"
    }
}
Orderbook Unsubscription Request
{
    "method": "unsubscribe",
    "subscription": "orderbook",
    "args": {
        "pair": "ETH-USDC"
    }
}

Response Format

The response structure is as follows:

Orderbook Stream
{
  "s": "orderbook",
  "d": {
    "m": "ETHUSD",
    "t": 1672515782136,
    "b": [
      {
        "px": "price",
        "sz": "size",
        "n": "number of orders"
      }
    ],
    "a": [
      {
        "px": "price",
        "sz": "size",
        "n": "number of orders"
      }
    ]
  }
}
  • s: Stream type (always “orderbook” for this endpoint)
  • d: Data object
    • m: Market pair (e.g., “ETHUSD”)
    • t: Event time (timestamp in milliseconds)
    • b: Array of bid updates
    • a: Array of ask updates
      • px: Price level
      • sz: Size at this price level
      • n: Number of orders at this price level

Trades

The trades channel provides real-time updates for trades of a specified trading pair.

Request Format

Trades Subscription Request
{
    "method": "subscribe",
    "subscription": "trades",
    "args": {
        "pair": "ETH-USDC"
    }
}
Trades Unsubscription Request
{
    "method": "unsubscribe",
    "subscription": "trades",
    "args": {
        "pair": "ETH-USDC"
    }
}

Response Format

The response structure is as follows:

Trades Stream
{
   "s": "trades",
   "d": {
      "p": "ETHUSD",
      "ts": [
         {
            "sd": "B",
            "px": "3442.0",
            "sz": "0.0995",
            "h": "0x0000000000000000000000000000000000000000000000000000000000000000",
            "id": 495549488075006,
            "t": 1721166232023
         }
      ]
   }
}
  • s: Stream type (always “trades” for this endpoint)
  • d: Data object
    • p: Trading pair (e.g., “ETHUSD”)
    • ts: Array of trade objects
      • sd: Side of the trade (“B” for buy, “S” for sell)
      • px: Price of the trade
      • sz: Size of the trade
      • h: Transaction hash
      • id: Trade ID
      • t: Trade time (timestamp in milliseconds)

TradingView Price Chart

The TradingView Price chart uses Datafeed API to return KLine candlestick data.

Request Format

Response Format

The response structure is as follows:

{
  "s": "candle",
  "d": {
    "p": "ETHUSD",
    "t": 1672515780000,
    "T": 1672515839999,
    "i": "1m",
    "o": "3442.9",
    "c": "3442.9",
    "h": "3442.9",
    "l": "3442.9",
    "v": "1.2569",
    "n": 2
  }
}
  • s: Stream type (always “candle” for this endpoint)
  • d: Data object
    • p: Trading pair (e.g., “ETHUSD”)
    • t: Candle start time (timestamp in milliseconds)
    • T: Candle close time (timestamp in milliseconds)
    • i: Interval (e.g., “1m” for 1 minute)
    • o: Open price
    • c: Close price
    • h: High price
    • l: Low price
    • v: Volume (base unit)
    • n: Number of trades

Error Handling

In case of an error, the following structure will be returned:

Error Response
{
   "s": "error",
   "d": "error reason"
}
  • s: Always “error” for error messages
  • d: Description of the error