Introduction
Developers can easily connect to the GTE WebSocket API to stream available market data. We recommend using a single connection to subscribe to multiple topics. Each subscription requires the following fields:
- id
- An arbitrary
int64
identifier chosen by the developer. The Websocket server will respond with the same id
to confirm actions.
- method
- Specifies the topic to subscribe or unsubscribe from.
- params
- Parameters specific to the subscription topic. When unsubscribing, the params must match the original subscription.
Trades
The trades channel provides real-time updates for trades of a specified market.
Trades Subscription Request
{
"id": 0,
"method": "trades.subscribe",
"params": {
"market": string, // market address
}
}
Trades Unsubscription Request
{
"id": 0,
"method": "trades.unsubscribe",
"params": {
"market": string, // market address
}
}
The response structure is as follows:
{
"s": "trades",
"d": {
"sd": "buy",
"m": "0x...",
"px": "3442.0",
"sz": "0.0995",
"h": "0x0000000000000000000000000000000000000000000000000000000000000000",
"id": 2934702386,
"t": 1721166232023
}
}
s
: Stream type (always “trade” for this endpoint)
d
: Data object
sd
: Side of the trade (“buy” or “sell”)
m
: Market address
px
: Price of the trade
sz
: Size of the trade
h
: Transaction hash
id
: Trade ID
t
: Trade time (timestamp in milliseconds)
Candes
The candles channel provide OHLCV
Candles Subscription Request
{
"id": 0,
"method": "candles.subscribe",
"params": {
"market": string, // market address
"interval": number
}
}
Candles Unsubscription Request
{
"id": 0,
"method": "candles.unsubscribe",
"params": {
"market": string, // market address
"interval": number
}
}
The supported intervals are: 1s, 30s, 1m, 3m, 5m, 15m, 30m, 1h, 4h, 6h, 8h, 12h, 1d, 1w
The response structure is as follows:
{
"s": "candle",
"d": {
"m": "0x...",
"t": 1672515780000,
"i": "1m",
"o": "3442.9",
"h": "3456.3",
"l": "3421.2",
"c": "3432.4",
"v": "1.2569",
"n": 2
}
}
s
: Stream type (always “candle” for this endpoint)
d
: Data object
m
: Market address
t
: Candle start 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
L2 Orderbook
The orderbook channel provides real-time updates for the order book of a specified market.
Orderbook Subscription Request
{
"id": 0,
"method": "book.subscribe"
"params": {
"market": string, // market address
"limit": number // optional - defaults to 10
}
}
Orderbook Unsubscription Request
{
"id": 0,
"method": "book.unsubscribe"
"params": {
"market": string, // market address
"limit": number // optional - defaults to 10
}
}
The response structure is as follows:
{
"s": "book",
"d": {
"a": [{"px": string, "sz": string , "n": number}], // sorted from lowest to highest (px)
"b": [{"px": string, "sz": string , "n": number}], // sorted from highest to lowest (px)
"t": number, // timestamp in millis
"m": string // market address
}
}
Error Handling
In case of an error, the following structure will be returned:
{
"id": 0,
"status": 1,
"error": "<error_message>"
}
id
: Unique identifier for the request
status
: Always 1 for error messages
error
: Description of the error
Responses are generated using AI and may contain mistakes.