Sequence/docs

Algo Management

Deploy custom WASM algorithms that run on Sequence venue edges.

Tip

Prefer the CLI for algo management. The sequence CLI handles build, deploy, and lifecycle in one tool:

bash
sequence build && sequence deploy BTC-USD --start
sequence logs BTC-USD --follow

See the CLI Install & Login guide and the full command reference.

Note

Sandbox isolation: All algo endpoints respect your API key mode. Requests authenticated with a seq_test_ (sandbox) key only interact with sandbox infrastructure - deployments go to sandbox edges, lists return only sandbox algos, and start/stop only affect sandbox deployments. Live (seq_live_) and sandbox (seq_test_) deployments for the same symbol are fully isolated. Pass --sandbox to the CLI or use a seq_test_ API key.


List Deployed Algos

GET/v1/algos

Returns deployed algos for the authenticated client.

Query Parameters

ParameterDefaultDescription
detailomittedSet detail=edge to include per-edge deployment details

Response

json
{
  "algos": [
    {
      "symbol": "XRP/USD",
      "size_bytes": 10658,
      "modified_at": 1706500000,
      "status": "running"
    }
  ]
}
FieldTypeDescription
symbolstringTrading pair
size_bytesnumberWASM binary size
modified_atnumberUnix timestamp of last update
statusstringAggregate status across edges (running, paused, accepted, pending, rejected)

Response (?detail=edge)

json
{
  "algos": [
    {
      "symbol": "XRP/USD",
      "size_bytes": 10658,
      "modified_at": 1706500000,
      "status": "running"
    }
  ],
  "edges": [
    {
      "symbol": "XRP/USD",
      "edge_id": "venue-edge-kraken",
      "deploy_id": "5c1b0c4a-0f8f-4f11-9a2e-5e8f7f3f17f5",
      "status": "running",
      "size_bytes": 10658,
      "deployed_at": 1706500000,
      "last_heartbeat": 1706500123,
      "pause_reason": null,
      "position_1e8": 0,
      "realized_pnl_1e9": 0,
      "session_realized_pnl_1e9": 0,
      "unrealized_pnl_1e9": 0,
      "callback_latency_ns": 42000,
      "update_count": 18211
    }
  ]
}

Deploy Algo

POST/v1/algos/deploy

Upload and deploy a WASM algo.

Note

Algos deploy in stopped state by default (start_immediately=false).

Request Body

json
{
  "symbol": "XRP/USD",
  "wasm_base64": "<base64-encoded .wasm file>",
  "start_immediately": false,
  "venue": "kraken"
}
FieldRequiredDefaultDescription
symbolYes-Trading pair (e.g., XRP/USD, BTC-USD) - both hyphen and slash formats are accepted
wasm_base64Yes-Base64-encoded WASM binary (max 1MB)
start_immediatelyNofalseIf true, algo starts trading immediately
venueNonullTarget a single venue (e.g. kraken, coinbase); omitted = all algo-capable edges
Note

Algo endpoints accept both BTC-USD (hyphen) and BTC/USD (slash). Symbols are normalized to slash format (BTC/USD) in all responses and the dashboard. All other API endpoints use hyphen format exclusively.

Response

json
{
  "symbol": "XRP/USD",
  "size_bytes": 10658,
  "status": "deployed (pushed to 3/5 capable edges) - stopped (click Start to begin)",
  "paused": true,
  "pushed_to": 3,
  "capable_edges": 5
}
Warning

If no algo-capable edges are connected, deploy returns 400.


Start Algo

POST/v1/algos/{symbol}/start

Resume a stopped algo. The algo will start receiving market data and can place orders.

Path Parameters

ParameterDescription
symbolTrading pair (URL-encoded, e.g., XRP%2FUSD)

Query Parameters

ParameterDescription
venueOptional venue target (kraken, coinbase, etc.). Omit to target all capable edges for that symbol.

Response

json
{
  "symbol": "XRP/USD",
  "status": "running",
  "edges_notified": 4
}

Stop Algo

POST/v1/algos/{symbol}/stop

Pause a running algo. The algo keeps its state but stops receiving market data and placing orders.

Path Parameters

ParameterDescription
symbolTrading pair (URL-encoded)

Query Parameters

ParameterDescription
venueOptional venue target (kraken, coinbase, etc.). Omit to target all capable edges for that symbol.

Response

json
{
  "symbol": "XRP/USD",
  "status": "stopped",
  "edges_notified": 4
}
Note

State persists across restarts. If you stop an algo and restart the server, it will remain stopped.


Undeploy (Delete) Algo

DELETE/v1/algos/{symbol}

Remove a deployed algo artifact and broadcast undeploy to edges.

Query Parameters

ParameterDescription
venueOptional venue target (kraken, coinbase, etc.). Omit to undeploy across all capable edges.

Response

json
{
  "symbol": "XRP/USD",
  "deleted": true
}

Get Algo Logs

GET/v1/algos/{symbol}/logs

Get recent log entries from the algo.

Query Parameters

ParameterDefaultDescription
edge_idall edgesOptional edge filter (example: venue-edge-kraken)

Response

json
{
  "symbol": "XRP/USD",
  "logs": [
    {
      "ts_ns": 1705420800000000000,
      "level": "INFO",
      "message": "BUY: trip=1 order=5001 @$1.800"
    },
    {
      "ts_ns": 1705420800000000000,
      "level": "WARN",
      "message": "BUY FILL: order=5001 qty=220000000 @$1.801 latency=19ms"
    }
  ]
}
Note

Logs endpoint currently returns the latest in-memory window (up to 100 entries). Timestamps are returned as ts_ns (nanosecond epoch), not formatted strings. Convert client-side as needed.


Get Algo Stats

GET/v1/algos/{symbol}/stats

Returns aggregate best-effort stats for the symbol.

Response

json
{
  "symbol": "XRP/USD",
  "status": "running",
  "position": 0,
  "pnl": 0.0,
  "trades": 12,
  "orders": 44,
  "fills": 12,
  "rejects": 2,
  "uptime_secs": 138
}

Deployment API (v2)

Deployment-keyed endpoints manage multi-symbol algo deployments as a single unit. Each deployment gets a unique deployment_id and can contain one or more symbols.

Note

The legacy /v1/algos/* endpoints above still work, but deployment-keyed endpoints are recommended for new integrations.

Create Deployment

POST/v1/deployments

Create a new deployment with one or more symbols.

Request Body

json
{
  "symbols": ["ETH-USDC", "BTC-USDC"],
  "name": "My MM",
  "wasm_base64": "<base64-encoded .wasm file>",
  "start_immediately": false,
  "venue": "kraken",
  "bundle_id": "bun_abc123"
}
FieldRequiredDefaultDescription
symbolsYes-Array of trading pairs
nameNonullHuman-readable deployment name
wasm_base64No-Base64-encoded WASM binary (omit if using bundle_id)
start_immediatelyNofalseStart trading immediately after deploy
venueNonullTarget a single venue
bundle_idNonullDeploy a registered bundle (omit wasm_base64 if set)

List Deployments

GET/v1/deployments

Returns all deployments for the authenticated client.

Response

json
{
  "deployments": [
    {
      "deployment_id": "dep_8f3a1b2c-4d5e-6f7a-8b9c-0d1e2f3a4b5c",
      "name": "My MM",
      "symbols": ["ETH-USDC", "BTC-USDC"],
      "size_bytes": 42000,
      "desired_state": "running",
      "edges": [
        {
          "edge_id": "venue-edge-kraken",
          "symbol": "ETH-USDC",
          "status": "running"
        }
      ]
    }
  ]
}

Get Deployment

GET/v1/deployments/{deployment_id}

Returns a single deployment with full edge details.


Rename Deployment

PATCH/v1/deployments/{deployment_id}

Request Body

json
{
  "name": "New Name"
}

Delete Deployment

DELETE/v1/deployments/{deployment_id}

Soft-deletes the deployment. Stops all edges and removes the deployment from listings.


Start Deployment

POST/v1/deployments/{deployment_id}/start

Start a stopped deployment.

Query Parameters

ParameterDescription
venueOptional venue filter. Omit to start across all edges.

Stop Deployment

POST/v1/deployments/{deployment_id}/stop

Stop a running deployment. State is preserved.

Query Parameters

ParameterDescription
venueOptional venue filter. Omit to stop across all edges.

Get Deployment Logs

GET/v1/deployments/{deployment_id}/logs

Returns recent log entries for the deployment.

Response

json
{
  "logs": [
    {
      "ts_ns": 1710700000000000000,
      "level": "INFO",
      "message": "BUY: trip=1 order=5001 @$1.800",
      "edge_id": "venue-edge-kraken"
    }
  ]
}
Note

Timestamps are returned as ts_ns (nanosecond epoch), not formatted strings. Convert client-side as needed.


Get Deployment Metrics

GET/v1/deployments/{deployment_id}/metrics

Returns time-series metrics for the deployment.

Query Parameters

ParameterRequiredDescription
fromYesStart time (ISO 8601 or Unix timestamp)
toYesEnd time
intervalYesAggregation interval (e.g., 1m, 5m, 1h)
edge_idNoFilter to a specific edge
symbolNoFilter to a specific symbol

Response

json
{
  "deployment_id": "dep_8f3a1b2c-4d5e-6f7a-8b9c-0d1e2f3a4b5c",
  "series": [
    {
      "ts": 1710700000,
      "position_1e8": 150000000,
      "realized_pnl_1e9": 1234560000,
      "unrealized_pnl_1e9": -50000000,
      "callback_latency_ns": 42000,
      "fill_count": 12
    }
  ]
}

Get Deployment Traces

GET/v1/deployments/{deployment_id}/traces

Returns callback traces showing algo decision-making.

Query Parameters

ParameterDefaultDescription
limit100Maximum number of traces to return
typeallFilter by callback type: on_book, on_fill, on_reject

Response

json
{
  "traces": [
    {
      "callback_type": "on_book",
      "symbol": "ETH-USDC",
      "ts_ns": 1710700000000000000,
      "latency_ns": 38000,
      "edge_id": "venue-edge-kraken",
      "input": {
        "book": { "best_bid": "3450.50", "best_ask": "3450.80" },
        "spread_bps": 0.87,
        "position_1e8": 50000000,
        "pnl": 123.45
      },
      "output": {
        "actions": ["cancel_all", "place_bid@3450.40", "place_ask@3450.90"]
      },
      "logs": ["spread tight, quoting aggressively"]
    }
  ]
}

Create Backtest

POST/v1/backtest

Submit a backtest job for a deployment.

Request Body

json
{
  "deployment_id": "dep_8f3a1b2c-4d5e-6f7a-8b9c-0d1e2f3a4b5c",
  "symbols": ["ETH-USDC"],
  "start_date": "2026-01-01",
  "end_date": "2026-01-31",
  "capital_usd": 100000,
  "seed": 42
}
FieldRequiredDefaultDescription
deployment_idYes-Deployment to backtest
symbolsNoall deployment symbolsSubset of symbols to backtest
start_dateNo-Start date (YYYY-MM-DD)
end_dateNo-End date (YYYY-MM-DD)
capital_usdNo100000Initial capital
seedNo42PRNG seed for deterministic replay

Response

json
{
  "job_id": "bt_a1b2c3d4",
  "status": "queued"
}

Get Backtest Status

GET/v1/backtest/{job_id}

Poll backtest job progress.

Response

json
{
  "job_id": "bt_a1b2c3d4",
  "status": "running",
  "progress_pct": 45.2,
  "events_processed": 1250000,
  "total_events": 2764000,
  "error": null
}
FieldDescription
statusqueued, running, completed, failed
progress_pctCompletion percentage
events_processedNumber of market events replayed so far
total_eventsTotal events in the date range
errorError message if status is failed

Get Backtest Results

GET/v1/backtest/{job_id}/results

Returns the full backtest result once the job completes.

Response

json
{
  "job_id": "bt_a1b2c3d4",
  "metrics": {
    "total_pnl": 1234.56,
    "sharpe": 2.1,
    "max_drawdown_pct": 3.4,
    "fill_count": 847,
    "trade_count": 423
  },
  "equity_curve": [
    { "ts": 1704067200, "equity": 100000.0 },
    { "ts": 1704153600, "equity": 100234.56 }
  ],
  "trades": [],
  "traces": []
}
Note

Results are only available when status is completed. Requesting results for a running or failed job returns 404.


Dashboard Upload

You can also deploy algos via the Terminal dashboard:

  1. Go to Algo Studio
  2. Click Upload .wasm
  3. Select your compiled WASM file
  4. Algo deploys in stopped state
  5. Click Start when ready

File Naming Convention

Filename parsing is optional in the dashboard. If you follow this pattern, symbol is auto-detected:

FilenameSymbol
algo_btc_usd.wasmBTC/USD
algo_xrp_usd.wasmXRP/USD
algo_eth_usdt.wasmETH/USDT

Any .wasm filename is accepted if you manually enter symbol as BASE/QUOTE.


Algo Lifecycle

code
┌──────────┐     Deploy      ┌──────────┐
│          │ ───────────────▶│          │
│   None   │                 │ Stopped  │◀───┐
│          │                 │          │    │
└──────────┘                 └────┬─────┘    │
                                  │          │
                              Start│          │Stop
                                  │          │
                                  ▼          │
                             ┌──────────┐    │
                             │          │────┘
                             │ Running  │
                             │          │
                             └────┬─────┘
                                  │
                              Delete
                                  │
                                  ▼
                             ┌──────────┐
                             │  None    │
                             └──────────┘
Warning

Deleting an algo stops it immediately and removes all logs. This cannot be undone.