QTSurfer API (0.95.1)

Download OpenAPI specification:

QTSurfer backend services API

Auth

The auth endpoint exchanges a long-lived API key for a short-lived JWT used by every other endpoint. Issue an API key via the web app, then call POST /auth/token at the start of each session (and on 401 responses) to obtain a fresh JWT.

Key functionalities:

  • Exchange an API key for a JWT carrying the caller's subscription tier.
  • Refresh the JWT before expiry without re-using the API key against any other endpoint.

Exchange API key for a short-lived JWT

Exchanges a long-lived API key for a short-lived JWT used by every other endpoint. This is the only endpoint that accepts an API key directly — callers should obtain a JWT here, then send it as Authorization: Bearer <token> to all other operations.

The returned JWT carries the caller's subscription tier as a claim and expires after expires_in seconds. Callers should refresh the token before expiry (or on a 401 response) by calling this endpoint again.

Authorizations:
apiKeyAuth

Responses

Response samples

Content type
application/json
{
  • "access_token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiI3NmI5MDIwMy0wM2MyLTQ2ZjYtYjM2Ni05OTQ0ZjE2N2U4MTgiLCJzY29wZXMiOltdLCJ0aWVyIjoiZnJlZSIsImlhdCI6MTc3OTczNTQ2MiwiZXhwIjoxNzc5NzM5MDYyfQ.signature",
  • "token_type": "Bearer",
  • "expires_in": 3600,
  • "scopes": [ ],
  • "tier": "free"
}

Exchange

This set of endpoints allows interaction with various exchanges for cryptocurrencies and financial assets. With these endpoints, users can access information about available exchanges, retrieve the instruments (currency pairs or assets) offered by each exchange, and perform analyses on them. The data provided by these endpoints is crucial for strategic decision-making within the trading platform.

Key functionalities:

  • Retrieve the list of available exchanges on the platform.
  • Get the instruments available on a specific exchange (currency pairs, assets, etc.).

Get a list of available exchanges

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get a list of Instruments from a specific exchange

path Parameters
exchangeId
required
string
Example: binance

ID of the exchange to retrieve instruments for

Responses

Response samples

Content type
application/json
[
  • {
    },
  • {
    }
]

Download one hour of tickers for an instrument as a Lastra segment

Serves exactly one hour of raw ticker data for the given instrument on the requested exchange. The payload is a native Lastra file — QTSurfer's columnar format for tick-precision timeseries — with no JSON envelope.

One segment = one hour, aligned to UTC. The hour query parameter selects the segment and must match YYYY-MM-DDTHH (no minutes/seconds, no timezone suffix). Example: hour=2026-01-15T10 returns h10.lastra for 2026-01-15, covering [10:00:00Z, 11:00:00Z). Hours not yet available return 404.

A format=parquet query parameter switches the response to on-the-fly Parquet conversion via lastra-convert for clients that don't yet read Lastra. Lastra is the primary format and cheaper when the client can consume it.

Clients:

  • lastra-java — reference Java reader/writer with per-column codecs (ALP, Gorilla, delta-varint, ZSTD) and CRC32 integrity.
  • lastra-ts — TypeScript reader (~4 kB bundle, browser + Node.js).
  • duckdb-lastra — DuckDB extension for ad-hoc SQL over Lastra files.
  • lastra-convert — CLI + Java API for converting to/from Parquet, Reef, and CSV.
  • curl -OJ for offline dumps (the Content-Disposition header sets a descriptive filename).
path Parameters
exchangeId
required
string
Example: binance

ID of the exchange (e.g. binance).

base
required
string
Example: BTC

Base asset symbol (first leg of the pair).

quote
required
string
Example: USDT

Quote asset symbol (second leg of the pair).

query Parameters
hour
required
string^\d{4}-\d{2}-\d{2}T\d{2}$
Example: hour=2026-01-15T10

Hour selector in YYYY-MM-DDTHH (UTC). The returned segment covers [HH:00:00Z, HH+1:00:00Z).

format
string
Default: "lastra"
Enum: "lastra" "parquet"
Example: format=lastra

Response wire format. lastra (default) returns raw Lastra bytes. parquet returns Parquet via on-the-fly conversion using lastra-convert.

Responses

Response samples

Content type
application/json
{
  • "code": 400,
  • "message": "Invalid request"
}

Download one hour of klines for an instrument as a Lastra segment

Same shape and semantics as /exchange/{exchangeId}/tickers/{base}/{quote}, but serves klines (aggregated bars) instead of raw ticks. One Lastra segment = one hour of klines at the exchange's native kline cadence, aligned to UTC.

Klines use the same columnar layout as tickers — readers that handle one format read the other with the same code. Use this endpoint when a per-tick payload would be too large for the window of interest.

path Parameters
exchangeId
required
string
Example: binance

ID of the exchange (e.g. binance).

base
required
string
Example: BTC

Base asset symbol.

quote
required
string
Example: USDT

Quote asset symbol.

query Parameters
hour
required
string^\d{4}-\d{2}-\d{2}T\d{2}$
Example: hour=2026-01-15T10

Hour selector in YYYY-MM-DDTHH (UTC). The returned segment covers [HH:00:00Z, HH+1:00:00Z).

format
string
Default: "lastra"
Enum: "lastra" "parquet"
Example: format=lastra

Response wire format. lastra (default) returns raw Lastra bytes. parquet returns Parquet via on-the-fly conversion.

Responses

Response samples

Content type
application/json
{
  • "code": 400,
  • "message": "Invalid request"
}

Backtesting

The backtest endpoints enable users to test trading strategies based on historical data before applying them in real-time trading. This functionality is essential for traders who want to evaluate the performance of a strategy under past market conditions and optimize it before implementing it in a live trading environment.

Key functionalities:

  • Prepare historical market data for fast access.
  • Run simulations of trading strategies using prepared historical market data.
  • Assess performance and optimize strategies based on past results and metrics.

Prepare backtesting data

Enqueues a prepare task over the requested date range. Returns immediately with a jobId; poll GET /backtest/{exchangeId}/{type}/prepare/{jobId} for completion.

The same params always return the same jobId (idempotent). Repeated calls with identical params do not enqueue duplicate work — they reuse the existing job.

Authorizations:
bearerAuth
path Parameters
exchangeId
required
string
Example: binance

ID of the exchange to prepare the backtesting for

type
required
string (DataSourceType)
Value: "ticker"
Example: ticker

The type of data source to prepare from

Request Body schema: application/json
required

The required data to prepare a backtesting

instrument
required
string (Instrument)

Exchange instrument identifier (e.g. a currency pair)

from
required
string

Start date for the preparation process. Supports the following formats:

  • ISO-8601 (e.g. 2024-12-14T23:59:59Z)
  • ISO DATE (e.g. 2024-12-14)
  • BASIC ISO DATE (e.g., 20241214)
to
required
string

End date for the preparation process. Supports the following formats:

  • ISO-8601 (e.g. 2024-12-14T23:59:59Z)
  • ISO DATE (e.g. 2024-12-14)
  • BASIC ISO DATE (e.g., 20241214)
cadence
string
Default: "1s"
Enum: "1s" "5s" "1m" "5m" "15m" "1h" "4h" "1d"

Output bar cadence for the prepared range. Defaults to the publisher's native cadence (1s); coarser cadences are produced on demand via resampling and stored alongside the native blob in cache. Coarser-than- source values must be exact multiples of the source cadence — invalid labels return 400.

Responses

Request samples

Content type
application/json
{
  • "instrument": "BTC/USDT",
  • "from": "2024-12-13T00:00:00Z",
  • "to": "2024-12-14T00:00:00Z",
  • "cadence": "1m"
}

Response samples

Content type
application/json
{
  • "jobId": "13RBLGQlPnfDjO6wyKSX8i"
}

Get the status of a prepare job

Retrieves the current state of the prepare job identified by jobId. Poll until status is Completed, Failed, or Aborted.

Authorizations:
bearerAuth
path Parameters
exchangeId
required
string
Example: binance

ID of the exchange for the backtesting process

type
required
string (DataSourceType)
Value: "ticker"
Example: ticker

The type of data source to prepare from

jobId
required
string
Example: 13RBLGQlPnfDjO6wyKSX8i

Job ID returned by POST /prepare

Responses

Response samples

Content type
application/json
{
  • "contextId": "ctx_0bjmoxd4vahkgc0hnvdldh",
  • "status": "Completed",
  • "statusDetail": null,
  • "size": 0,
  • "completed": 24,
  • "startTime": "2026-04-14T15:00:00Z",
  • "endTime": "2026-04-14T15:00:01Z"
}

Execute a compiled strategy against a prepared dataset

Enqueues an execute task that runs the strategy identified by strategyId over the data prepared by the prepare job identified by prepareJobId. The instrument and date range are recovered from the prepare job — they do not need to be sent again.

Returns immediately with a jobId; poll GET /backtest/{exchangeId}/{type}/execute/{jobId} for the result.

The same params (same prepareJobId, strategyId, storeSignals) always return the same jobId (idempotent).

Authorizations:
bearerAuth
path Parameters
exchangeId
required
string
Example: binance

ID of the exchange for the backtesting process

type
required
string (DataSourceType)
Value: "ticker"
Example: ticker

The type of data source to execute from

Request Body schema: application/json
required

Execute task parameters

prepareJobId
required
string

Job ID returned by POST /prepare (must be in Completed state)

strategyId
required
string (strategyId)

Unique identifier for a compiled strategy

storeSignals
boolean
Default: false

When true, the worker uploads emitted signals to object storage and the response includes signalsUrl / signalsId fields. Defaults to false.

Responses

Request samples

Content type
application/json
{
  • "prepareJobId": "13RBLGQlPnfDjO6wyKSX8i",
  • "strategyId": "6bsh31ikwkuivhtgcoa6s4",
  • "storeSignals": false
}

Response samples

Content type
application/json
{
  • "jobId": "13RBLGQlPnfDjO6wyKSX8i"
}

Cancel a running backtest execution

Requests cancellation of the specified execution. The execution status will transition to Aborted once the cancellation is processed. Cancellation is asynchronous — poll the GET endpoint to confirm the final status.

Authorizations:
bearerAuth
path Parameters
exchangeId
required
string
Example: binance
type
required
string (DataSourceType)
Value: "ticker"
Example: ticker

Managed exchange data sources available for backtesting.

jobId
required
string
Example: 13RBLGQlPnfDjO6wyKSX8i

Job ID returned by POST /execute

Responses

Response samples

Content type
application/json
{
  • "status": "cancelling",
  • "jobId": "13RBLGQlPnfDjO6wyKSX8i"
}

Get the result of a backtest execution job

Retrieves the current state and results of the execute job identified by jobId. Poll until state.status is Completed, Failed, or Aborted.

Authorizations:
bearerAuth
path Parameters
exchangeId
required
string
Example: binance

ID of the exchange for the backtesting process

type
required
string (DataSourceType)
Value: "ticker"
Example: ticker

The type of data source to execute from

jobId
required
string
Example: 13RBLGQlPnfDjO6wyKSX8i

Job ID returned by POST /execute

Responses

Response samples

Content type
application/json
{
  • "state": {
    },
  • "results": {
    }
}

Strategy

The strategy endpoints allow users to submit, compile, and validate trading strategies within the platform. This feature is crucial for traders who develop automated trading systems and wish to ensure their strategy is both executable and effective before deploying it in a live/backtesting environment.

Key functionalities:

  • Submit rich Java™ based trading strategies for validation and compilation.
  • Ensure strategies meet the required syntax and operational constraints.
  • Validate strategies to identify potential issues or errors before execution.
  • Integrate strategies with specific exchanges and market instruments for tailored use.

Compile a strategy from source code

Submits raw strategy source for compilation. By default the call is synchronous and returns the strategyId once compilation succeeds. Set the header X-Compile-Async: true to enqueue the compile task and return immediately with a jobId — poll GET /strategy/{strategyId} to check status.

The strategyId is deterministic: the same source for the same user always produces the same id.

Authorizations:
bearerAuth
header Parameters
X-Compile-Async
boolean
Default: false

When true, compile asynchronously and return 202 with a jobId.

Request Body schema: text/plain
required

The raw strategy source code

string

Raw strategy Java source code

Responses

Response samples

Content type
application/json
{
  • "strategyId": "6bsh31ikwkuivhtgcoa6s4"
}

Get the status of an async compile task

Polls the status of a strategy compilation. Useful when the strategy was submitted with X-Compile-Async: true. Returns the resolved strategyId once compilation completes.

Authorizations:
bearerAuth
path Parameters
strategyId
required
string
Example: 6bsh31ikwkuivhtgcoa6s4

The id returned by POST /strategy (sync) or the jobId returned in async mode

Responses

Response samples

Content type
application/json
{
  • "jobId": "6bsh31ikwkuivhtgcoa6s4",
  • "status": "Completed",
  • "strategyId": "6bsh31ikwkuivhtgcoa6s4",
  • "statusDetail": "string"
}