Strategies Endpoints

abstract

Full CRUD for trading strategies plus account binding management, manual trigger, and performance stats — the core configuration layer that drives the automated trading scheduler.

🔒 Authentication

PropertyValue
MechanismNone
RequiredNo

Endpoints in this group (13 total)

MethodPathDescription
GET/api/v1/strategiesList all strategies
GET/api/v1/strategies/registryList registered strategy class types
POST/api/v1/strategiesCreate new strategy
GET/api/v1/strategies/{id}Get strategy detail
PATCH/api/v1/strategies/{id}Update strategy fields
DELETE/api/v1/strategies/{id}Delete strategy (cascades to bindings + backtests)
POST/api/v1/strategies/{id}/triggerManually fire analysis for this strategy now
POST/api/v1/strategies/{id}/activate-all (or similar)Activate/deactivate
PATCH/api/v1/strategies/{id}/bind/{account_id}Bind strategy to account
DELETE/api/v1/strategies/{id}/bind/{account_id}Unbind strategy from account
GET/api/v1/strategies/{id}/bindingsList all account bindings
GET/api/v1/strategies/{id}/runsList recent pipeline runs
GET/api/v1/strategies/{id}/statsPerformance statistics

GET /api/v1/strategies

Returns all strategies with type, execution mode, symbols, and active status.

Logic Flow

200 OK example:

[
  {
    "id": 3,
    "name": "Harmonic EURUSD",
    "strategy_type": "code",
    "execution_mode": "multi_agent",
    "primary_tf": "H1",
    "symbols": ["EURUSD"],
    "is_active": true,
    "maintenance_enabled": true,
    "llm_provider": "anthropic",
    "llm_model": "claude-opus-4-7"
  }
]

Pydantic Schema: backend/api/routes/strategies.py :: StrategyResponse


POST /api/v1/strategies

Create a new strategy. The scheduler immediately registers cron/interval jobs for all bound accounts.

Request body: StrategyCreate schema — all fields documented in DB - strategies.

Status: 201 Created


POST /api/v1/strategies//trigger

Manually fire the strategy's analysis pipeline right now (background task, returns 202 immediately).

Logic:

→ Resolve bound accounts
→ For each account: run LLM analysis pipeline
→ Return 202 Accepted immediately
→ Results appear in /api/v1/pipeline/runs

PATCH /api/v1/strategies//bind/

Creates or updates an account_strategy binding. Scheduler adds cron job for this combination.

Triggers: add_binding_jobs(strategy_id, account_id) in services/scheduler.py


DELETE /api/v1/strategies//bind/

Removes binding + removes cron job for this combination.

Triggers: remove_binding_jobs(strategy_id, account_id) in services/scheduler.py


GET /api/v1/strategies//stats

Performance metrics for this strategy: win rate, total P&L, trade count.

Source: Aggregates from trades table where strategy_id = ?


RolePath
Routerbackend/api/routes/strategies.py
Schedulerbackend/services/scheduler.py :: add_binding_jobs(), remove_binding_jobs()
DB TableDB - strategies
DB TableDB - account_strategy
RoleLink
Frontend PagePage - Strategies
DB SchemaDB - strategies
DB SchemaDB - account_strategy
Related EndpointAPI-GET-v1-Scheduler