WebSocket
Websocket Streams
Real-time updates for various data streams including orderbook, TradingView price chart, and trades.
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
Orderbook Unsubscription Request
Response Format
The response structure is as follows:
Orderbook Stream
s
: Stream type (always “orderbook” for this endpoint)d
: Data objectm
: Market pair (e.g., “ETHUSD”)t
: Event time (timestamp in milliseconds)b
: Array of bid updatesa
: Array of ask updatespx
: Price levelsz
: Size at this price leveln
: 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
Trades Unsubscription Request
Response Format
The response structure is as follows:
Trades Stream
s
: Stream type (always “trades” for this endpoint)d
: Data objectp
: Trading pair (e.g., “ETHUSD”)ts
: Array of trade objectssd
: Side of the trade (“B” for buy, “S” for sell)px
: Price of the tradesz
: Size of the tradeh
: Transaction hashid
: Trade IDt
: 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
: Stream type (always “candle” for this endpoint)d
: Data objectp
: 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 pricec
: Close priceh
: High pricel
: Low pricev
: Volume (base unit)n
: Number of trades
Error Handling
In case of an error, the following structure will be returned:
Error Response
s
: Always “error” for error messagesd
: Description of the error