Skip to Content
HTTP APIMarket data

Candle history

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/candles?instrument=binance:futures:BTCUSDT&interval=1m&limit=100' \
  -H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN"
GET
/market/candles

The candle history of an instrument, read the same way the chart of the terminal reads it. ts is the opening time of a bar.

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
interval*string

An interval code from GET /market/intervals.

limit?integer

The number of bars.

Rangevalue <= 2000
Default500
end?integer

The right boundary in UTC milliseconds. The default is now.

Formatint64

Response Body

The bars, oldest first.

application/json
  1. response
instrument*string
connection_id*integer

The connection the history was read through.

Formatint64
interval*string
data*array<>
Example Request
curl 'http://127.0.0.1:48180/v1/market/candles?instrument=binance:futures:BTCUSDT&interval=1m&limit=100' \  -H "Authorization: Bearer $SPECTRE_LOCAL_API_TOKEN"
Example Response
{  "instrument": "binance:futures:BTCUSDT",  "connection_id": 12,  "interval": "1m",  "data": [    {      "ts": 1730294400000,      "open": "67000.1",      "high": "67010.5",      "low": "66990.0",      "close": "67003.4",      "volume": "52.1",      "quote_volume": "3490000.5",      "closed": true    }  ]}