Messages
{
"rid": 2,
"type": "subscribe",
"symbol": "XAU-PERP",
"level": "LEVEL_2"
}{
"rid": 3,
"type": "unsubscribe",
"symbol": "XAU-PERP"
}{
"rid": 4,
"type": "subscribe_candles",
"symbol": "XAU-PERP",
"width": "1m"
}{
"rid": 5,
"type": "unsubscribe_candles",
"symbol": "XAU-PERP",
"width": "1m"
}{
"rid": 6,
"type": "subscribe_bbo_candles",
"symbol": "XAU-PERP",
"width": "1m"
}{
"rid": 7,
"type": "unsubscribe_bbo_candles",
"symbol": "XAU-PERP",
"width": "1m"
}{
"rid": 2,
"result": {
"subscribed": "XAU-PERP"
}
}{
"rid": 2,
"error": {
"message": "Symbol XAU-PERP is not available",
"code": 404
}
}{
"t": "h",
"ts": 1609459200,
"tn": 123456789
}{
"t": "s",
"ts": 1609459200,
"tn": 123456789,
"s": "XAU-PERP",
"p": "50000.00",
"q": 100,
"o": "49500.00",
"l": "49000.00",
"h": "50500.00",
"v": 125000,
"oi": 50000,
"m": "50010.00",
"i": "OPEN",
"pl": "47500.00",
"pu": "52500.00",
"ef": {
"symbol": "XAU-PERP",
"status": "ready",
"funding_rate": "0.00012",
"funding_amount": "6.00",
"benchmark_price": "50005.00",
"settlement_price": "50010.00",
"timestamp": "2021-01-01T00:00:00Z"
}
}{
"t": "t",
"ts": 1609459200,
"tn": 123456789,
"s": "XAU-PERP",
"p": "50000.00",
"q": 100,
"d": "B"
}{
"t": "c",
"symbol": "XAU-PERP",
"ts": 123456789,
"open": "49500.00",
"low": "49000.00",
"high": "50500.00",
"close": "50000.00",
"volume": 5000,
"buy_volume": 3000,
"sell_volume": 2000,
"width": "1m"
}{
"t": "bc",
"symbol": "XAU-PERP",
"ts": 123456789,
"bid_open": "49990.00",
"bid_high": "50010.00",
"bid_low": "49980.00",
"bid_close": "50000.00",
"ask_open": "50010.00",
"ask_high": "50030.00",
"ask_low": "50000.00",
"ask_close": "50020.00",
"mid_open": "50000.00",
"mid_high": "50020.00",
"mid_low": "49990.00",
"mid_close": "50010.00",
"width": "1m"
}{
"t": "1",
"ts": 1609459200,
"tn": 123456789,
"s": "XAU-PERP",
"b": [
{
"p": "49999.50",
"q": 500
}
],
"a": [
{
"p": "50000.50",
"q": 300
}
]
}{
"t": "2",
"ts": 1609459200,
"tn": 123456789,
"s": "XAU-PERP",
"b": [
{
"p": "49999.50",
"q": 500
},
{
"p": "49999.00",
"q": 300
},
{
"p": "49998.50",
"q": 200
},
{
"p": "49998.00",
"q": 150
},
{
"p": "49997.50",
"q": 100
}
],
"a": [
{
"p": "50000.50",
"q": 300
},
{
"p": "50001.00",
"q": 400
},
{
"p": "50001.50",
"q": 250
},
{
"p": "50002.00",
"q": 200
},
{
"p": "50002.50",
"q": 150
}
],
"st": true
}{
"t": "3",
"ts": 1609459200,
"tn": 123456789,
"s": "XAU-PERP",
"b": [
{
"p": "49999.50",
"q": 500,
"o": [
200,
150,
100,
50
]
},
{
"p": "49999.00",
"q": 300,
"o": [
150,
100,
50
]
},
{
"p": "49998.50",
"q": 200,
"o": [
100,
100
]
}
],
"a": [
{
"p": "50000.50",
"q": 300,
"o": [
150,
100,
50
]
},
{
"p": "50001.00",
"q": 400,
"o": [
200,
150,
50
]
},
{
"p": "50001.50",
"q": 250,
"o": [
150,
100
]
}
],
"st": true
}Marketdata
Websocket marketdata
WSS
/
md
/
ws
Quickstart
1. Get a token
curl -s -X POST https://gateway.sandbox.architect.exchange/api/authenticate \
-H "Content-Type: application/json" \
-d '{"api_key":"YOUR_KEY","api_secret":"YOUR_SECRET","expiration_seconds":3600}'
# Response: {"token":"<bearer-token>"}
2. Connect to the WebSocket
Pass the token as anAuthorization header on the WebSocket upgrade request. Invalid or missing tokens are rejected with HTTP 401 before the connection is established.
# Store the token
TOKEN=$(curl -s -X POST https://gateway.sandbox.architect.exchange/api/authenticate \
-H "Content-Type: application/json" \
-d '{"api_key":"YOUR_KEY","api_secret":"YOUR_SECRET","expiration_seconds":3600}' \
| python3 -c "import sys,json; print(json.load(sys.stdin)['token'])")
# Connect
wscat -c wss://gateway.sandbox.architect.exchange/md/ws \
-H "Authorization: Bearer $TOKEN"
# Store the token
TOKEN=$(curl -s -X POST https://gateway.sandbox.architect.exchange/api/authenticate \
-H "Content-Type: application/json" \
-d '{"api_key":"YOUR_KEY","api_secret":"YOUR_SECRET","expiration_seconds":3600}' \
| python3 -c "import sys,json; print(json.load(sys.stdin)['token'])")
# Connect
websocat -H="Authorization: Bearer $TOKEN" \
wss://gateway.sandbox.architect.exchange/md/ws
gateway.sandbox.architect.exchange with gateway.architect.exchange for production.
3. Subscribe
Once connected, send a subscribe message to start receiving market data:{"rid":1,"type":"subscribe","symbol":"XAU-PERP","level":"LEVEL_2"}
level: "TRADES":
{"rid":2,"type":"subscribe","symbol":"XAU-PERP","level":"TRADES"}
trades and ticker fields (both
default true) independently suppress trade or ticker delivery. For example, a
book-only feed (no trades, no ticker):
{"rid":3,"type":"subscribe","symbol":"XAU-PERP","level":"LEVEL_2","trades":false,"ticker":false}
{"rid":4,"type":"subscribe_candles","symbol":"XAU-PERP","width":"1m"}
subscribe at a book level (LEVEL_1/LEVEL_2/LEVEL_3), you receive:
- Ticker updates (
t = "s") — unlessticker: false - Trade updates (
t = "t") — unlesstrades: false - Order book updates matching your selected
level:LEVEL_1->t = "1"LEVEL_2->t = "2"LEVEL_3->t = "3"
subscribe at level: "TRADES", you receive only trade updates (t = "t") — no ticker or order book events. The trades and ticker fields have no effect on a TRADES subscription.
After a successful subscribe_candles, you receive candle updates (t = "c").
Details
Request ID (rid)
ridis used to correlate request/response pairs.- Server acknowledgements and request errors include the same
ridas your request. - Market data events do not include
rid.
Symbol fields in events
- Ticker, trade, and order book events use
sfor symbol. - Candle events use
symbol.
Estimated funding rate
- Ticker events (
t = "s") carry an optionalefobject with the live estimated funding rate, present only for symbols that have a live index feed configured (e.g. WTI-PERP). ef.statusis one ofready,settlement_pending, orunavailable:ready— a current estimate is available. All numeric fields (funding_rate,funding_amount,benchmark_price,settlement_price) are populated andef.reasonis absent.settlement_pending— funding settlement is in progress for the symbol, so the live estimate is temporarily suppressed. The numeric fields are null andef.reasonindicates a settlement is pending.unavailable— no current estimate can be produced. The numeric fields are null andef.reasonexplains why — for example the index or mark price data needed for the estimate is not yet available, is insufficient, or is too stale, or no estimate has been published for the symbol yet.
- When no estimate applies to a symbol, the
effield is omitted entirely.
{
"t": "s",
"ts": 1609459200,
"tn": 123456789,
"s": "WTI-PERP",
"ef": {
"symbol": "WTI-PERP",
"status": "ready",
"funding_rate": "0.00012",
"funding_amount": "6.00",
"benchmark_price": "50005.00",
"settlement_price": "50010.00",
"timestamp": "2021-01-01T00:00:00Z"
}
}
Heartbeat events
- The server emits heartbeat events (
t = "h"):
{
"t": "h",
"ts": 1609459200,
"tn": 123456789
}
Messages
{
"rid": 2,
"type": "subscribe",
"symbol": "XAU-PERP",
"level": "LEVEL_2"
}{
"rid": 3,
"type": "unsubscribe",
"symbol": "XAU-PERP"
}{
"rid": 4,
"type": "subscribe_candles",
"symbol": "XAU-PERP",
"width": "1m"
}{
"rid": 5,
"type": "unsubscribe_candles",
"symbol": "XAU-PERP",
"width": "1m"
}{
"rid": 6,
"type": "subscribe_bbo_candles",
"symbol": "XAU-PERP",
"width": "1m"
}{
"rid": 7,
"type": "unsubscribe_bbo_candles",
"symbol": "XAU-PERP",
"width": "1m"
}{
"rid": 2,
"result": {
"subscribed": "XAU-PERP"
}
}{
"rid": 2,
"error": {
"message": "Symbol XAU-PERP is not available",
"code": 404
}
}{
"t": "h",
"ts": 1609459200,
"tn": 123456789
}{
"t": "s",
"ts": 1609459200,
"tn": 123456789,
"s": "XAU-PERP",
"p": "50000.00",
"q": 100,
"o": "49500.00",
"l": "49000.00",
"h": "50500.00",
"v": 125000,
"oi": 50000,
"m": "50010.00",
"i": "OPEN",
"pl": "47500.00",
"pu": "52500.00",
"ef": {
"symbol": "XAU-PERP",
"status": "ready",
"funding_rate": "0.00012",
"funding_amount": "6.00",
"benchmark_price": "50005.00",
"settlement_price": "50010.00",
"timestamp": "2021-01-01T00:00:00Z"
}
}{
"t": "t",
"ts": 1609459200,
"tn": 123456789,
"s": "XAU-PERP",
"p": "50000.00",
"q": 100,
"d": "B"
}{
"t": "c",
"symbol": "XAU-PERP",
"ts": 123456789,
"open": "49500.00",
"low": "49000.00",
"high": "50500.00",
"close": "50000.00",
"volume": 5000,
"buy_volume": 3000,
"sell_volume": 2000,
"width": "1m"
}{
"t": "bc",
"symbol": "XAU-PERP",
"ts": 123456789,
"bid_open": "49990.00",
"bid_high": "50010.00",
"bid_low": "49980.00",
"bid_close": "50000.00",
"ask_open": "50010.00",
"ask_high": "50030.00",
"ask_low": "50000.00",
"ask_close": "50020.00",
"mid_open": "50000.00",
"mid_high": "50020.00",
"mid_low": "49990.00",
"mid_close": "50010.00",
"width": "1m"
}{
"t": "1",
"ts": 1609459200,
"tn": 123456789,
"s": "XAU-PERP",
"b": [
{
"p": "49999.50",
"q": 500
}
],
"a": [
{
"p": "50000.50",
"q": 300
}
]
}{
"t": "2",
"ts": 1609459200,
"tn": 123456789,
"s": "XAU-PERP",
"b": [
{
"p": "49999.50",
"q": 500
},
{
"p": "49999.00",
"q": 300
},
{
"p": "49998.50",
"q": 200
},
{
"p": "49998.00",
"q": 150
},
{
"p": "49997.50",
"q": 100
}
],
"a": [
{
"p": "50000.50",
"q": 300
},
{
"p": "50001.00",
"q": 400
},
{
"p": "50001.50",
"q": 250
},
{
"p": "50002.00",
"q": 200
},
{
"p": "50002.50",
"q": 150
}
],
"st": true
}{
"t": "3",
"ts": 1609459200,
"tn": 123456789,
"s": "XAU-PERP",
"b": [
{
"p": "49999.50",
"q": 500,
"o": [
200,
150,
100,
50
]
},
{
"p": "49999.00",
"q": 300,
"o": [
150,
100,
50
]
},
{
"p": "49998.50",
"q": 200,
"o": [
100,
100
]
}
],
"a": [
{
"p": "50000.50",
"q": 300,
"o": [
150,
100,
50
]
},
{
"p": "50001.00",
"q": 400,
"o": [
200,
150,
50
]
},
{
"p": "50001.50",
"q": 250,
"o": [
150,
100
]
}
],
"st": true
}Subscribe Request
type:object
Subscribe to market data for a symbol
Unsubscribe Request
type:object
Unsubscribe from market data for a symbol
Subscribe Candle Request
type:object
Subscribe to candle updates on a symbol and width
Unsubscribe Candle Request
type:object
Unsubscribe from candle updates on a symbol and width
Subscribe BBO Candles Request
type:object
Subscribe to BBO (Best Bid and Offer) candle updates on a symbol and width
Unsubscribe BBO Candles Request
type:object
Unsubscribe from BBO candle updates on a symbol and width
Success Response
type:object
Confirmation of a successful client request
Error Response
type:object
Response indicating a failed client request
Heartbeat Event
type:object
Heartbeat/timestamp event (t="h")
Ticker Event
type:object
Ticker statistics update (t="s")
Trade Event
type:object
Trade event (t="t")
Candle Event
type:object
Candle update (t="c")
BBO Candle Event
type:object
BBO (Best Bid and Offer) candle update (t="bc")
Level 1 Book Update Event
type:object
Level 1 orderbook update - best bid/ask (t="1")
Level 2 Book Update Event
type:object
Level 2 orderbook update - aggregated price levels (t="2")
Level 3 Book Update Event
type:object
Level 3 orderbook update - individual order quantities (t="3")