Live Execution API
Subscribe a strategy to a live asset and timeframe — get a signal the moment its entry or exit condition fires on a real, closed candle.
Overview
A live subscription watches one asset pair at one timeframe. Every time a candle closes for that pair, your strategy is evaluated against it — the same Strategy DSL and the same evaluation engine the Backtesting API uses, just running continuously instead of over a historical date range.
Base URL: https://live.emidlabs.com/api/public/v1/live
x-api-key header with a valid API key scoped for the live service. Keys are generated in the Console — the Live Execution toggle appears there next to Backtesting.#How it works
There's no polling loop to build. Subscribe once; a signal only exists because a real entry or exit condition became true on a real, closed candle:
| Step | What happens |
|---|---|
| 1. Subscribe | POST a strategy + assetPair. The timeframe comes from the strategy's own configuration.timeframe. |
| 2. Candle closes | Every closed candle for that asset+timeframe evaluates your strategy — the same StrategyRunner the Backtesting API uses. |
| 3. Signal fires | If entry or exit evaluates true, it's recorded immediately — poll GET .../signals or check the Console dashboard. |
| 4. Stop anytime | DELETE the subscription — no more evaluations happen for it, no partial-period charge. |
#POST /subscriptions — Create
/subscriptionsSubscribe a strategy to live evaluation on one asset pair.
Same strategySnapshotJson shape as the Backtesting API — see Strategy System for the full DSL reference. configuration.timeframe inside it is what determines the candle boundary your strategy evaluates on (15M, 1H, etc.) — there's no separate timeframe field on the subscription itself.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| strategySnapshotJson | object | Yes | Strategy object — configuration, inputs, conditions, score, decision, riskManagement. configuration.timeframe drives evaluation frequency. |
| assetPair | string | Yes | Trading pair. E.g. "BTC-USDC", "ETH-USDC" — same pairs the Backtesting API supports. |
Response
| Field | Type | Description |
|---|---|---|
| id | string (UUID) | Unique identifier for the subscription. |
| status | string | "Active" immediately after creation. |
#DELETE /subscriptions/{id} — Stop
/subscriptions/{id}Stop a subscription. No further candles are evaluated for it.
Returns 404 if the subscription doesn't exist or doesn't belong to your account.
#GET /subscriptions/{id} — Status
/subscriptions/{id}Fetch a single subscription's current status.
Response fields
| Field | Type | Description |
|---|---|---|
| id | string | UUID of the subscription. |
| assetPair | string | Asset pair being watched. |
| timeframe | string | Resolved from the strategy's own configuration at creation time. |
| status | string | "Active" or "Stopped". |
| lastEvaluatedCandleOpenTime | number | null | Unix seconds — OpenTime of the most recent candle this subscription evaluated. null if none yet. |
| createdAtUtc | string | Creation timestamp (UTC). |
| stoppedAtUtc | string | null | When the subscription was stopped, if it has been. |
#GET /subscriptions — List
/subscriptionsList every subscription on your account, active and stopped.
Same fields as the single-subscription response above, wrapped in an items array.
#GET /subscriptions/{id}/signals — Signal Format
/subscriptions/{id}/signalsThe emitted signal log for a subscription — the live analogue of the Backtesting API's tradesDetail.
Response fields
| Field | Type | Description |
|---|---|---|
| candleOpenTime | number | Unix seconds — OpenTime of the candle whose close triggered this signal. |
| type | string | "Entry" or "Exit". |
| price | number | Close price of the triggering candle. |
#Strategy DSL
Live Execution and Backtesting share the exact same DSL and evaluation engine — a strategy that passes a backtest can be subscribed live unchanged. See the full Strategy System reference for indicators, conditions, and the built-in function list.
warmupBars still matters live: the first candles after a subscription starts are excluded from evaluation until enough history has accumulated for your indicators to stabilize — same rule as backtesting, just measured from subscription time instead of the backtest's start date.#Error Codes
Every error response has the same shape: { "error": "<code>", "message": "<text>" }.
| Status | Code | Description |
|---|---|---|
| 400 | invalid_payload | The request body is malformed, missing required fields, or the strategySnapshotJson fails validation. |
| 401 | api_key_missing | The x-api-key header wasn't provided. |
| 401 | api_key_invalid | The provided API key is invalid, revoked, or inactive. |
| 403 | service_not_enabled | This API key is not scoped for the live execution service — enable it in the Console when creating or editing the key. |
| 404 | not_found | The subscription doesn't exist or doesn't belong to your account. |
| 429 | rate_limit_exceeded | Too many requests for this account. Back off and retry. |