Skip to Content
HTTP APIMarket data

Top of the order book

Build your request

Change the values and the command follows. The token is never typed here: the command reads it from the SPECTRE_LOCAL_API_TOKEN environment variable. Run it in your own terminal.

Command
curl 'http://127.0.0.1:48180/v1/market/orderbook?instrument=binance:futures:BTCUSDT&depth=20' \
  -H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN"
GET
/market/orderbook

The top levels of the order book. A level is [price, size]. If the full book does not arrive within 3 s, the answer is 503 unavailable, because an empty book would look like an empty market.

Authorization

bearerToken market:read
headerAuthorizationBearer <token>

The Local API token: spt_ and 64 hex characters. Copy it from Settings App → General → Local API. It is accepted only in the Authorization header. The names listed with an operation are the scopes it requires. The token of the terminal carries all of them.

Scope: market:read

Query Parameters

instrument*string

Instrument address, exchange:market:symbol.

connection_id?integer

The connection to read through. Without it the terminal uses the enabled trading connection of the exchange and market, or the read-only one if there is none.

Formatint64
depth?integer

Levels on each side.

Range1 <= value <= 200
Default50

Response Body

The top of the book.

application/json
  1. response
instrument*string
connection_id*integer
Formatint64
ts*integer
Formatint64
depth*integer

The requested depth.

bids*array<array<string>>

From the best price down.

asks*array<array<string>>

From the best price up.

Example Request
curl 'http://127.0.0.1:48180/v1/market/orderbook?instrument=binance:futures:BTCUSDT&depth=20' \  -H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN"
Example Response
{  "instrument": "binance:futures:BTCUSDT",  "connection_id": 12,  "ts": 1730294400123,  "depth": 20,  "bids": [    [      "67000.1",      "1.25"    ]  ],  "asks": [    [      "67000.2",      "0.40"    ]  ]}