Skip to content

Strategies API

List Strategies

GET /api/strategies

Response:

json
{
  "strategies": [
    {
      "id": "str_abc123",
      "name": "MeanReversion",
      "description": "Mean reversion strategy on BTC",
      "marketType": "LINEAR",
      "version": 3,
      "createdAt": "2024-01-15T10:30:00Z",
      "updatedAt": "2024-02-01T14:20:00Z"
    }
  ]
}

Get Strategy

GET /api/strategies/:id

Returns the strategy with full source code and version history.

Create Strategy

POST /api/strategies

Body:

json
{
  "name": "MeanReversion",
  "description": "Mean reversion on linear futures",
  "source": "use tradectl_sdk::prelude::*; ...",
  "marketType": "LINEAR"
}

Source code max size: 500 KB.

Update Strategy

PUT /api/strategies/:id

Body:

json
{
  "name": "MeanReversion v2",
  "description": "Updated description",
  "source": "..."
}

Updating source creates a new version automatically.

Delete Strategy

DELETE /api/strategies/:id

Fails if the strategy has active deployments.

tradectl — Automate Crypto Trading