Marketdata

Websocket

wss://api.sandbox.x.architect.co/md/ws

Authentication

Once connected to the websocket, the client must first login. The login message contains a username and token pair which must be present in the auth_gateway.

Login

Authenticate with the websocket server. For authentication and authorization purposes, one must get a valid user token from the auth_gateway.

Request
{
    "request_id": 101,
    "type": "login",
    "username": "ABC",
    "token": "token-from-auth-gateway"
}
Response
{
    "request_id": 101,
    "result": {
        "logged_in": "ABC"
    }
}

Logout

Terminate the current session.

Request
{
    "request_id": 104,
    "type": "logout"
}
Response
{
    "request_id": 104,
    "result": {
        "logged_out": "ABC"
    }
}

Subscribe

Subscribe to market data for a specific symbol. Upon successful subscription, stats and the most recent update will be sent. LEVEL_1 is top level, price and quantity. LEVEL_2 is all levels, price and quantity. LEVEL_3 is all levels, price, quantity and orders per level.

Request
{
    "request_id": 102,
    "type": "subscribe",
    "symbol": "EURUSD-PERP",
    "level": "LEVEL_3"
}
Response
{
    "request_id": 102,
    "result": {
        "subscribed": "EURUSD-PERP"
    }
}

Unsubscribe

Unsubscribe from market data for a specific symbol.

Request
{
    "request_id": 103,
    "type": "unsubscribe",
    "symbol": "6B-P"
}
Response
{
    "request_id": 103,
    "result": {
        "unsubscribed": "6B-P"
    }
}

Feed events

Common Fields

All feed messages include these common fields.

Field
Type
Description

t

string

Message type (h=heartbeat, s=stats, 1=level 1, 2=level 2, 3=level 3)

ts

integer

Timestamp in seconds since epoch (Unix time)

tn

integer

Nanosecond component of timestamp

You can convert epoch timestamps to human-readable dates using EpochConverter.

Heartbeat

{
    "t": "h",
    "ts": 1746431612,
    "tn": 86465000
}

Ticker Stats

Field
Description

s

Symbol

p

Last trade price

q

Last trade quantity

o

Open price for the trading session

l

Low price for the trading session

h

High price for the trading session

v

Total traded volume

{
    "t": "s",
    "ts": 1746431612,
    "tn": 86465000,
    "s": "EURUSD-PERP",
    "p": "88.12",
    "q": 1,
    "o": "55.55",
    "l": "0.80",
    "h": "900.00",
    "v": 891
}

Marketdata Update

Field
Description

t

1, 2 or 3 representing level of market data update detail

s

Symbol

b

Array of bid levels sorted by price in descending order

a

Array of ask levels sorted by price in ascending order

Each level in the bid and ask arrays contains:

Field
Description

p

Price of the level

q

Total quantity at this price level

o

Array of individual order quantities (only in Level 3 feeds)

LEVEL_1
{
    "t": "1",
    "ts": 1746431612,
    "tn": 86465000,
    "s": "EURUSD-PERP",
    "b": [
        {
            "p": "88.12",
            "q": 1
        }
    ],
    "a": [
        {
            "p": "88.16",
            "q": 5
        }
    ]
}
LEVEL_2
{
    "t": "2",
    "ts": 1746431612,
    "tn": 86465000,
    "s": "EURUSD-PERP",
    "b": [
        {
            "p": "88.12",
            "q": 1
        },
        {
            "p": "88.11",
            "q": 5
        },
        {
            "p": "88.08",
            "q": 9
        }
    ],
    "a": [
        {
            "p": "88.16",
            "q": 5
        },
        {
            "p": "88.17",
            "q": 7
        }
    ]
}
LEVE
{
    "t": "3",
    "ts": 1746431612,
    "tn": 86465000,
    "s": "EURUSD-PERP",
    "b": [
        {
            "p": "88.12",
            "q": 1,
            "o": [1]
        },
        {
            "p": "88.11",
            "q": 5,
            "o": [1, 1, 3]
        },
        {
            "p": "88.08",
            "q": 9,
            "o": [8, 1]
        }
    ],
    "a": [
        {
            "p": "88.16",
            "q": 5,
            "o": [1, 1, 3]
        },
        {
            "p": "88.17",
            "q": 7,
            "o": [3, 1, 2, 1]
        }
    ]
}

Error Responses

{
    "request_id": 105,
    "error": {
        "code": 400,
        "message": "Symbol XRPUSD-PERP not found"
    }
}

REST

https://api.sandbox.x.architect.co

Get Historical Candles

post
Body
marketstringRequired
intervalstringRequired
start_timestring · date-timeRequired
end_timestring · date-timeRequired
Responses
200

Successful Response

application/json
Responseany of
or
post
POST /candle/historical_candles HTTP/1.1
Host: 
Content-Type: application/json
Accept: */*
Content-Length: 113

{
  "market": "text",
  "interval": "text",
  "start_time": "2025-09-27T21:24:26.363Z",
  "end_time": "2025-09-27T21:24:26.363Z"
}
{
  "market": "text",
  "interval": "text",
  "candles": [
    {
      "timestamp": "2025-09-27T21:24:26.363Z",
      "open": "text",
      "high": "text",
      "low": "text",
      "close": "text",
      "volume": "text",
      "buy_volume": "text",
      "sell_volume": "text"
    }
  ]
}

Last updated