Start a strategy on a live market feed
Changed onStarts your strategy against a live market feed. A new run begins in the sandbox stage — a short trial that compares an independent second execution against the first for agreement — before it is eligible for promotion to the live stage where it actually publishes signals other systems can act on. Poll GET /strategy/{strategyId}/live (or PATCH/DELETE /live/{runId} once you have the runId) to watch stage move from SANDBOX to LIVE.
A strategy that has already been through that trial does not go through it again. When an earlier run of yours of the same compiled strategy was promoted to LIVE, and none of that compilation's runs was stopped for using more resources than allowed, the new run starts in LIVE at once: the response says stage: LIVE and carries the earlier verdict in gate. The parameters, sources and instruments may differ from the earlier run. Submitting the strategy again (POST /strategy) compiles it anew, and a new compilation goes through the sandbox like a first run. Send sandbox: true to start in the sandbox anyway — for example to read the run's signals back over the connection while you debug it, which the live stage does not keep.
Only one run per strategy at a time — starting again while one is already running is 409; stop the current one first.
sources takes exactly one entry today (multi-source strategies are not supported yet). type is ticker or kline; anything else is rejected. Both connect to the lightest (fastest) cadence available for the exchange — today that is 1 tick/second on every supported exchange; choosing among several cadences is not offered yet.
instruments can be left out. A QTScript strategy can declare which instruments it accepts with an instruments line in its source; when the compilation of the strategy records that selection as a list of pairs, a start that leaves instruments out, or sends ["*"], takes that list, and otherwise the run reads every instrument the exchange/segment offers. A list you send is taken as sent. Either side of an entry can be * (any base paired with USDT). The instruments the run reads come back in sources. See the "Live execution" guide, "Sources".
params is passed straight through to the strategy at start — the same free-form object POST /strategy/{strategyId}/validate and the backtest endpoints already accept. To change a parameter while the run is live, use PUT /live/{runId}/params instead; this endpoint only sets the values a run starts with.
Consuming a run's own output — its signals, and updating its parameters over a live connection instead of polling — is a WebSocket protocol on top of these REST endpoints; see the "Live execution" guide linked from this tag's description for the full flow (minting a connection token, the channel and RPC method).
Paper trading. Pass a paper block to have the run's hints executed in simulation from its first tick, as a backtest would execute them: fills, closed trades, equity and KPIs, with one simulated account per quote currency. Omitted, the run has no paper trading. It takes the same economics as a backtest's baseConfig plus where its output goes; read it back with GET /live/{runId}/paper. A strategy that listens to its own execution events (it overrides getExecutionCallback()) has no other execution venue, so it cannot start without a paper block.
Warming up. Pass warmFrom to choose how many seconds before its start the run replays the market feed from, so that its indicators and windows have history when the first live tick arrives. 0 replays nothing: the run delivers its first signal as soon as it is running, but its indicators start empty and the first bar of a window can be partial. Omitted, the platform replays from the start of the current 15-minute block, which is between 0 and 900 seconds before the run's start, so the first bar of a 15-minute window is complete. The value in effect, yours or the platform's, comes back as warmFrom. It can be set only here, when the run is started. See the "Live execution" guide, "Warming up".
A plain WebSocket stream. Pass stream: true to get a secret URL for this run's signals that a simple client, or a service that passes them on to others, can open as an ordinary WebSocket, from the sandbox stage on. The URL is in the response (streamUrl) and in GET /strategy/{strategyId}/live; treat it like a password. See the "Live execution" guide.
Request
- Base URL: https://api.qtsurfer.net/v1
- URL: https://api.qtsurfer.net/v1/strategy/{strategyId}/live
- Auth: HTTP bearer
Path parameters
Unique identifier for a compiled strategy, derived from the source itself: the same code always yields the same id, for every caller. How much formatting the id ignores depends on the language — see POST /strategy for exactly which rewrites preserve it and which do not.
The id returned by POST /strategy
Request body
Example request
{
"sources": [
{
"venueType": "cx",
"exchange": "binance",
"segment": "spot",
"instruments": [
"BTC/USDT"
]
}
]
}Response
Started — the run's own state, in the sandbox stage (in the live stage for a strategy that has already been through the sandbox), with its streamUrl when you asked for a stream
Example response
{
"strategyId": "6bsh31ikwkuivhtgcoa6s4",
"sources": [
{
"venueType": "cx",
"exchange": "binance",
"segment": "spot",
"instruments": [
"BTC/USDT"
]
}
]
}Changes
- info
endpoint added
- info